Skip to content
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

Merged
merged 1 commit into from
Jun 26, 2019
Merged

launch: multiple sdf models #12306

merged 1 commit into from
Jun 26, 2019

Conversation

lamping7
Copy link
Member

@lamping7 lamping7 commented Jun 18, 2019

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

Screenshot from 2019-06-18 15-22-56

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)

@lamping7 lamping7 added the Sim: gazebo classic Gazebo classic simulator label Jun 18, 2019
@lamping7 lamping7 requested review from dagar and TSC21 June 18, 2019 19:27
@lamping7 lamping7 self-assigned this Jun 18, 2019
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- generate sdf vehicle model -->
<arg name="cmd" default="xmlstarlet ed -d '//plugin[@name=&quot;mavlink_interface&quot;]/mavlink_tcp_port' -s '//plugin[@name=&quot;mavlink_interface&quot;]' -t elem -n mavlink_tcp_port -v $(arg mavlink_tcp_port) $(find px4)/Tools/sitl_gazebo/models/$(arg vehicle)/$(arg vehicle).sdf"/>
Copy link
Member Author

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.

@lamping7
Copy link
Member Author

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

@Ahmad-Drak
Copy link

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..

@lamping7
Copy link
Member Author

lamping7 commented Jul 8, 2019

Look at my fork. You'll find the commit link in the comment above #12306 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sim: gazebo classic Gazebo classic simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants