-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
launch: multiple sdf models #12306
launch: multiple sdf models #12306
Conversation
<!-- PX4 configs --> | ||
<arg name="interactive" default="true"/> | ||
<!-- generate sdf vehicle model --> | ||
<arg name="cmd" default="xmlstarlet ed -d '//plugin[@name="mavlink_interface"]/mavlink_tcp_port' -s '//plugin[@name="mavlink_interface"]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/sitl_gazebo/models/$(arg vehicle)/$(arg vehicle).sdf"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the magic happens.
I also did this (as before) again to allow different vehicles, params, and missions from colliding. Probably not an ideal solution, but its here if anyone wants to look or discuss the issue. lamping7@15325ff |
Hey @lamping7 how would this launch file change if I wanted to launch 2 drones of different types? one irirs and one typhoon for example. An even harder example, if i need to launch typhoon and pr2 robot in one world together.. |
Look at my fork. You'll find the commit link in the comment above #12306 (comment) |
Describe problem solved by the proposed pull request
Allows the launch of multiple sdf models. This topic seems to come up every so often.
Test data / coverage
Tested with the plane model (set default in here) on Ubuntu 16.04 with ROS Kinetic and Gazebo 7.
Shell output: https://pastebin.com/NNf6FmWT
Describe your preferred solution
This solution doesn't require copying multiple models or changing port numbers in the model. It works much like the xacro version for the iris, but it relies on xmlstarlet instead. This will need to be documented as a dependency to use this.
Essentially the command in here first deletes the
mavlink_tcp_port
element. This will be necessary if sitl_gazebo changes and adds this to the model. It then, adds the element back with the correct value. This file is not saved, not overwriting the stored model, but passed directly to gazebo's spawn-model node as a param, just like the urdf generated from xacro.Describe possible alternatives
None considered.
Additional context
This doesn't fix the shared parameter or dataman problem. It will likely fail with multiple different models due to different param sets and waypoint missions will likely be incorrect if they're to be following different waypoints at the same time. Old history: #9046 #9088 and motivated by: #7235 (comment)