Open RbtsEvrwhr-Riley opened 1 year ago
If there's any bogus init happening in simulator_mavlink
before there's a valid connection we can certainly fix it, but I would still suggest the proper fix here is to directly start only the desired interface in the first place.
I cannot find any build option to change the init interface to UDP, having gone through source and had to modify it to allow such. TCP was hardcoded everywhere.
The bug is definitely the init issue that's causing stopping and starting a new interface to break sensors, though; on the other hand, a menuconfig option or something to default UDP would be nice.
Describe the bug
On a WSL2 environment, we set up a simulation that required a UDP bridge (mav2xplane UDP https://github.com/RbtsEvrwhr-Riley/mav2xplane). By default it starts a TCP listener for the sim. Stopping this and starting UDP prevents sensors from acquiring.
To Reproduce
make px4_sitl none "simulator_mavlink stop" "simulator mavlink start udp"
Starts the UDP listener.
When it connects, accel 0 and gyro 0 will always provide invalid data, because they will not be updated on the correct ID. Baro and compass work as expected.
Expected behavior
The TCP sim that never connected should not set up any sensors.
Log Files and Screenshots
There is no flight, simulated flight could not start.
If you need more screenshots to reproduce I can get them but I need coffee.
Additional context
The following code block works as a workaround if added to px4-rc.simulator
This is not a fix, it just replaces starting TCP with starting UDP, then everything works.
`# otherwise start simulator (mavlink) module simulator_udp_port=$((14560+px4_instance))