PX4 Sync / Q&A: Oct 09, 2024
Agenda
Announcements
Release Discussion
Q&A
Announcements
Release Discussion
Bug report / Q&A
1- @AustinMeyer Trying to bring in X-plane working with PX4 SITL.
@dagar recommended a way to define a specified rate for sensors’ fusion not only following the game engine would help since this was an old issue.
opened 03:37PM - 09 Oct 24 UTC
bug-report
### Describe the bug
RECVFROM waits a TENTH of a second when it should wait a T… OUSANDTH of a second.
Here's a totyal stack crawl from my code at the bottom. ordering a 1 microsecond wait!
enum tv2ds_remainder_e
{
TV2DS_TRUNC = 0, /* Truncate microsecond remainder */
TV2DS_ROUND, /* Round to the nearest full decisecond */
TV2DS_CEIL /* Force to next larger full decisecond */
};
unsigned int net_timeval2dsec(FAR struct timeval *tv,
enum tv2ds_remainder_e remainder)
{
unsigned long adjust = 0;
switch (remainder)
{
default:
case TV2DS_TRUNC: /* Truncate microsecond remainder */
break;
case TV2DS_ROUND: /* Round to the nearest full decisecond */
adjust = (USEC_PER_DSEC / 2);
break;
case TV2DS_CEIL: /* Force to next larger full decisecond */
adjust = (USEC_PER_DSEC - 1);
break;
}
return (unsigned int)(tv->tv_sec * DSEC_PER_SEC +
(tv->tv_usec + adjust) / USEC_PER_DSEC);
}
static int psock_socketlevel_option(FAR struct socket *psock, int option,
FAR const void *value,
socklen_t value_len)
{
...
timeo = (socktimeo_t)net_timeval2dsec(tv, TV2DS_CEIL);
...
}
int psock_setsockopt(FAR struct socket *psock, int level, int option,
FAR const void *value, socklen_t value_len)
{
...
case SOL_SOCKET: /* Socket-level options (see include/sys/socket.h) */
ret = psock_socketlevel_option(psock, option, value, value_len);
break;
...
}
int setsockopt(int sockfd, int level, int option, const void *value,
socklen_t value_len)
{
...
ret = psock_setsockopt(psock, level, option, value, value_len);
...
}
MY CODE:
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 1; // this is actually 0.1 second wait... the shortest wait the system handles, due to a bug in the px4 code!
if(setsockopt(udp_socket_recv, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
PX4_INFO("setsockopt error: %s\n", strerror(errno));
### To Reproduce
Write those code.. and watch the system slow to 10 frames per second as each listen waits for 0.1 seconds!
(setting socket to non-blocking causes resource-deadlock and the then breaks the listen after a minute or two)
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 1; // this is actually 0.1 second wait... the shortest wait the system handles, due to a bug in the px4 code!
if(setsockopt(udp_socket_recv, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
PX4_INFO("setsockopt error: %s\n", strerror(errno));
### Expected behavior
wait a MICROSECOND to listen before moving on.. but instead it takes a TENTH of s econd before moving on past the RECVFROM
### Screenshot / Media
<img width="1250" alt="Screenshot 2024-10-09 at 11 30 29 AM" src="https://github.com/user-attachments/assets/fd90ca57-eb09-437e-b9aa-43d7fdf013f4">
### Flight Log
_No response_
### Software Version
nsh> ver all
HW arch: PX4_FMU_V6XRT
HW type: V6XRT
HW FMUM ID: 0x000
HW BASE ID: 0x000
PX4 git-hash: e4dd3f28715b83ee49cf39b3ce68853b3926d52e
PX4 version: 1.15.0 80 (17760384)
PX4 git-branch: origin/release/1.15
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: d140f96627bd55edd24060cb90fe4c55ed3b9efd
Build datetime: Oct 9 2024 08:47:30
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 13.3.1 20240614
PX4GUID: 000900000000000000008292b37f0419600e
MCU: i.MX RT1170 rB0, rev. 0
nsh>
### Flight controller
pixhawk 6xrt
### Vehicle type
None
### How are the different components wired up (including port information)
none
### Additional context
none
A useful example to POLL data from:
int ret = poll(&fds[0], 1, timeout);
if (ret > 0) {
if (_mavlink.get_protocol() == Protocol::SERIAL) {
/* non-blocking read. read may return negative values */
nread = ::read(fds[0].fd, buf, sizeof(buf));
if (nread == -1 && errno == ENOTCONN) { // Not connected (can happen for USB)
usleep(100000);
}
}
#if defined(MAVLINK_UDP)
else if (_mavlink.get_protocol() == Protocol::UDP) {
if (fds[0].revents & POLLIN) {
nread = recvfrom(_mavlink.get_socket_fd(), buf, sizeof(buf), 0, (struct sockaddr *)&srcaddr, &addrlen);
}
2- @Rowan_Dempster : How biases between sensor frames are tracked for EKF?
@dagar : the best case scenario is to rely on one source frame and then apply all the biases from different VIO sources to that one. Usually the current framework is to make the origin to what GSP sees.
3- @AlexKlimaj
opened 06:09PM - 25 Sep 24 UTC
bug-report
### Describe the bug
Firmware updating on 1.15 works but is broken on main afte… r the Dronecan submodule update. Nodes fail the update then the update restarts and fails again indefinitely.
```
Online nodes (Node ID, Health, Mode):
71 CRIT SW_UPD
uavcan: cycle time: 71419 events, 4965837us elapsed, 69.53us avg, min 10us max 72605us 488.892us rms
uavcan: cycle interval: 71419 events, 2893.50us avg, min 19us max 266795us 2696.179us rms
nsh> INFO [uavcan:71:Boot] Es
ERROR [uavcan:71:Boot] Pf
INFO [uavcan:71:Boot] Es
ERROR [uavcan:71:Boot] Pf
INFO [uavcan:71:Boot] Es
```
### To Reproduce
_No response_
### Expected behavior
_No response_
### Screenshot / Media
_No response_
### Flight Log
_No response_
### Software Version
_No response_
### Flight controller
_No response_
### Vehicle type
None
### How are the different components wired up (including port information)
_No response_
### Additional context
_No response_
PRs needing review: