You can probably achieve what you want by using the Gazebo services that are available when you start gazebo with ROS support. Once Gazebo is started you can do a
rosservice list
and you should multiple services offered by Gazebo that allow retrieving model properties, spawning models, moving them etc (here are the srv definitions).
Most services offered are also described in the Gazebo "Connect to ROS" tutorial.
Originally posted by Stefan Kohlbrecher with karma: 24361 on 2015-08-17
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by ktiwari9 on 2015-08-17:
So in the Connect to ROS tutorial they mention something like rosservice call /gazebo/set_model_state to spawn a coke can at a specific location and orientation, Is it possible to do this via a ROS node ?
Comment by Stefan Kohlbrecher on 2015-08-17:
Yes, you can cal ROS service from the command line (by typing "rosservice call ...", but you can of course also call them from code (see Python or C++ tutorials for "Writing a Simple Service and Clieant" here: http://wiki.ros.org/ROS/Tutorials).
Comment by ktiwari9 on 2015-08-18:
Hi Stefan,
Please see my comments above. I uploaded my code and I have some trouble adding both pedestrian and robot to the scene. Could you help me out ?