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

[ros2] Port spawn model to ROS2 #948

Merged
merged 8 commits into from Aug 14, 2019

Conversation

@shiveshkhaitan
Copy link

commented Jul 6, 2019

Port gazebo_ros node spawn_model to ROS2.

Example usage:
spawn_model.py -model name -file /path/to/model/file.sdf -x 5.0 -y 5.0

@chapulina chapulina self-requested a review Jul 8, 2019

@chapulina chapulina added the ros2 label Jul 8, 2019

@chapulina
Copy link
Contributor

left a comment

I did a first pass, but haven't finished reviewing and trying out all parameters.

Mind adding a note about this script to the spawn migration page?

Also, it would be nice to be able to call the script with ros2 run gazebo_ros spawn_entity ..., and to be able to call it from launch files. I think we may need a setup.cfg file to install it correctly under lib, but it may also be ok to do it with cmake. Once that's working, we could add an example launch file which spawns a model at startup. That's a very common use case on ROS 1.

gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_model.py Outdated Show resolved Hide resolved
gazebo_ros/launch/spawn_entity_demo.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Show resolved Hide resolved
@chapulina

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2019

@osrf-jenkins run tests please

gazebo_ros/scripts/spawn_entity.py Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Outdated Show resolved Hide resolved

@chapulina chapulina force-pushed the shiveshkhaitan:spawn_model branch from 7d234b2 to 14ffd7b Aug 11, 2019

@chapulina
Copy link
Contributor

left a comment

I tried all arguments and everything is working as it should. The only remaining issue is param -> topic, sorry again 😕

gazebo_ros/launch/spawn_entity_demo.launch.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Outdated Show resolved Hide resolved
gazebo_ros/scripts/spawn_entity.py Outdated Show resolved Hide resolved
@mogumbo

This comment has been minimized.

Copy link

commented Aug 12, 2019

Your spawn_model branch generally works for me. The only problem I have is if I add a <gazebo> tag containing a plugin, such as:

<gazebo>
    <plugin filename="libgazebo_ros_p3d.so" name="gazebo_ros_p3d">
      <frameName>map</frameName>
      <bodyName>base_link</bodyName>
      <topicName>ground_truth</topicName>
      <updateRate>30.0</updateRate>
    </plugin>
  </gazebo>

then gzserver always crashes:

[gzserver-1] Error [Element.cc:702] Missing element description for [ros]
[ERROR] [gzserver-1]: process has died [pid 23113, exit code -11, cmd 'gzserver -s libgazebo_ros_init.so -s libgazebo_ros_factory.so -s libgazebo_ros_state.so -e ode /home/me/workspace/mysim/install/mysim/share/mysim/worlds/myworld.world'].

Empty <gazebo> tags or ones containing materials or lights don't cause problems. Have you encountered anything like that?

@shiveshkhaitan

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

[gzserver-1] Error [Element.cc:702] Missing element description for [ros]

This seems to be a problem with the sdf and not the plugin or spawn_entity. Can you please post the problem with link to your complete sdf at http://answers.gazebosim.org/

@chapulina chapulina force-pushed the shiveshkhaitan:spawn_model branch from c2dea2c to c1ecba8 Aug 14, 2019

@chapulina chapulina merged commit 51833ac into ros-simulation:dashing Aug 14, 2019

0 of 2 checks passed

Dpr__gazebo_ros_pkgs__ubuntu_bionic_amd64 Build finished.
Details
ros2_gazebo_pkgs-ci-pr_any_dashing-bionic-amd64 deploying to build.osrfoundation.org
Details
shiveshkhaitan added a commit to shiveshkhaitan/gazebo_ros_pkgs that referenced this pull request Aug 15, 2019
[ros2] Port spawn model to ROS2 (ros-simulation#948)
* [ros2] Port spawn model to ROS2

* Delete .ros1_unported files

* Fixes and add demo

Change spawn_model to spawn_entity

* Rename demo launch and add checks for service

* Fix reading xml file from param and model states

* remove diplicate

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* Use gazebo launch file

* Change topic behaviour
@chapulina

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

Missing element description for [ros]

@mogumbo , I was able to reproduce the error you're getting and opened #983 to fix it. However, there are other issues with your plugin which will prevent it from working, so I recommend you check the P3D migration guide.

@mogumbo

This comment has been minimized.

Copy link

commented Aug 29, 2019

The migration guide helped a lot. Thanks for the tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.