Ask Your Question
3

How do I spawn a urdf object programmatically?

asked 2011-11-20 13:46:30 -0500

Raskolnikov gravatar image

updated 2014-11-22 17:05:15 -0500

ngrennan gravatar image

I take a .pcd file as input and process the pointcloud using pcl. I then want to spawn an object in Gazebo using the results of that processing so that I can simulate the manipulation of that object with a pr2. Is there a programmatic way to do this , i.e. using c++.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2011-11-21 02:52:52 -0500

updated 2011-11-21 02:53:59 -0500

When you spawn it in a launch file it works like this:

 <node name="spawned_object_name" pkg="gazebo" type="spawn_model" 
 args="-urdf -file $(find rospackagename)/path/to/file.urdf -model 
 object_name_from_gazebo_perspective  -x 0.50 -y 0.05 -z 0.65" 
 respawn="false" output="screen" />

If you look at

http://www.ros.org/wiki/simulator_gazebo/Tutorials/Gazebo_ROS_API

it tells you that there is also a ROS service gazebo/spawn_model which you can call programmatically through a ROS message - this seems like the right way to do it.

Here is the documentation of the service:

http://www.ros.org/doc/api/gazebo/html/srv/SpawnModel.html

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-11-20 13:46:30 -0500

Seen: 2,548 times

Last updated: Nov 21 '11