Closed bavokn closed 4 years ago
@Jaeyoung-Lim any idea?
@bavokn It seems like you are using the same sdf file for all vehicles. This will make the vehicles share the same tcp port for the HIL mavlink messages.
You need to copy the sdf file and modify the mavlink_tcp_port
as in https://github.com/PX4/sitl_gazebo/blob/master/models/rotors_description/urdf/component_snippets.xacro#L302 for each iris.sdf
If you look at the generation of the launch file you can see i set the mavlink_tcp_port for each drone diffrently :
<arg name=\"mavlink_tcp_port\" value=\"$(expr 4560 + $i)\" />\n\
which results in the launch file :
UAV iris_0
<arg name="mavlink_tcp_port" value="4560" />
UAV iris_1
<arg name="mavlink_tcp_port" value="4561" />
UAV iris_2
<arg name="mavlink_tcp_port" value="4562" />
This sets only the correct ports from the px4 side. Gazebo has to comply to those ports, but .sdf files cannot contain variables. So either you copy the .sdf file multiple times and change the port or you create a .xacro file which can contain variables.
@Jaeyoung-Lim did a PR recently for multi VTOL: https://github.com/PX4/sitl_gazebo/pull/398
Using xarco files worked , thank you !
@bacokn
It seems that in your .sdf file, there is no tag( the tag is in the iris.sdf and you just include it, so xmlstarlet cannot find the tag):
<plugin name='mavlink_interface' filename='libgazebo_mavlink_interface.so'>
So you cannot use
<arg name="cmd" value="xmlstarlet ed -d '//plugin[@name="mavlink_interface"]/14562' -s '//plugin[@name="mavlink_interface"]' -t elem -n 14562 -v 14562 $(find smartuav)/models/iris_depth_camera_lidar/iris_depth_camera_lidar.sdf" />
to change the mavlink_tcp_port, though you set different
<arg name="mavlink_tcp_port" value="4560" />
correctly
Besides -n 14562 -v 14562
should be -n mavlink_tcp_port -v 14562
Hi, i'm trying to spawn multiple PX4's with a depth camera and a lidar but i can only control the first drone spawned. I use some custom scripts to setup and start gazebo in a docker container and generate a .launch file.
first I start the simulation in a container using a script
then in the container I generate the launch file for n drones
for example 3 drones generates this launchfile :
xmlstarlet can find the .sdf file so the path is correct.
the .sdf file i use
Expected behavior I see all the topics using rostopic list and I can see the video feed/pointclouds in rviz but it fails when i try and control the drone after spawning them in the world.
gazebo startup log for example 3 drones
as you can see, a few problems. What am i doing wrong ? The issue is pure in this line (generating the launch file) :
I have tried switching the port numbers from udp to tcp but to no avail. The biggest problem is i dont know exaclty what some arguments do in this command.
Drone :