MAVSDK: Problems connecting to multiple PX4s in SITL
I want to write a DroneCore program to control a swarm of SITL PX4s simultaneously, through offboard mode. Right now, I’m using a swarm of 4 drones, which is a modification of the scripts here:https://dev.px4.io/en/simulation/multi-vehicle-simulation.html. I’ve been using the takeoff_land example program from DroneCore as a base, When I run the example program, the first drone with a sysid of 1 takes off, which is as expected. Now if I have to control all the 4 drones, I have to add the 4 UDP ports of the drones, which I did, as below.
DroneCore::ConnectionResult connection_result = dc.add_udp_connection(14540);
dc.add_udp_connection(14541);
dc.add_udp_connection(14542);
dc.add_udp_connection(14543);
Of all these, I just want to add device for one drone, for the sake of testing.
Device &device = dc.device(1/2/3/4(mavlink sys ids));
Now here comes the problem. It seems that all the PX4 SITL drones have the same UUID, so even differentiating between the MAVLink sys id 's is useless, because DroneCore won’t even consider them. So I had to comment out this part of code from device_impl.cpp, so that it forces use of sys id.
// if (_target_uuid == 0 && autopilot_version.uid != 0) {
// // This is the best case. The device has a UUID and we were able to get it.
// _target_uuid = autopilot_version.uid;
// }
Even after doing all this, I start getting the following stream of errors, when I use any sys id other than 1 to connect. This is the error beginning
Waiting to discover device...
[06:21:42|Info ] New device on: 127.0.0.1:14553 (udp_connection.cpp:211)
[06:21:42|Error] Remote IP unknown (udp_connection.cpp:140)
[06:21:42|Error] send fail (dronecore_impl.cpp:104)
[06:21:42|Info ] Applying default FollowMe configuration FollowMe to the device... (follow_me_impl.cpp:178)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Info ] New device on: 127.0.0.1:14555 (udp_connection.cpp:211)
[06:21:42|Error] Remote IP unknown (udp_connection.cpp:140)
[06:21:42|Info ] Applying default FollowMe configuration FollowMe to the device... (follow_me_impl.cpp:178)
[06:21:42|Error] send fail (dronecore_impl.cpp:104)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Info ] New device on: 127.0.0.1:14557 (udp_connection.cpp:211)
[06:21:42|Info ] Applying default FollowMe configuration FollowMe to the device... (follow_me_impl.cpp:178)
[06:21:42|Error] Remote IP unknown (udp_connection.cpp:140)
[06:21:42|Error] send fail (dronecore_impl.cpp:104)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Info ] New device on: 127.0.0.1:14559 (udp_connection.cpp:211)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Info ] Applying default FollowMe configuration FollowMe to the device... (follow_me_impl.cpp:178)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 lost (device_impl.cpp:246)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 lost (device_impl.cpp:246)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 lost (device_impl.cpp:246)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 lost (device_impl.cpp:246)
[06:21:42|Debug] MAVLink: info: data link #0 regained (device_impl.cpp:246)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 regained (device_impl.cpp:246)
[06:21:42|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 regained (device_impl.cpp:246)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 4 (dronecore_impl.cpp:90)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:21:42|Debug] MAVLink: info: data link #0 regained (device_impl.cpp:246)
[06:21:42|Debug] sysid: 2 (dronecore_impl.cpp:90)
This is the error end
[06:20:22|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:20:22|Debug] sysid: 2 (dronecore_impl.cpp:90)
[06:20:22|Error] Retrying failed (511) (mavlink_commands.cpp:215)
[06:20:22|Debug] sysid: 3 (dronecore_impl.cpp:90)
[06:20:22|Error] Error: set param busy timeout: NAV_FT_RS (mavlink_parameters.cpp:413)
[06:20:22|Error] Failed to set NAV_FT_RS: 0.5 (follow_me_impl.cpp:266)
Setting rate failed:Timeout
DroneCore is able to detect the presence of other devices, but something amiss happens. What could the problem be? I’ve uploaded the cpp program for reference. Keyboard_test.txt Thanks!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (2 by maintainers)
Thanks @hamishwillee for the issue. I agree it is a good selling point but not something immediately required for the projects that I’m working at.