ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

spawn urdf model in gazebo by C++

asked 2014-05-28 19:10:11 -0600

Sendoh gravatar image

Hi all,

I plan to spawn a robot urdf model in gazebo by C++. Can anyone kindly introduce me any tutorial or code template for doing this?

My finally objective is to implement my algorithm to control this robot in C++. Thanks for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-07-25 14:45:15 -0600

Charlie Murphy gravatar image

http://answers.ros.org/question/28557...

Check out the above question and following answers.

Or you could always just fork and give a command using system or one of the exec* functions.

something like

pid_t child = fork()
if (child == 0){
  system("rosrun gazebo spawn_model -file <path to xml/urdf file> -urdf -model <model_name>");
}

As to how to control the robot. Just publish to the topics the robot is listening to.

I've been using ros hydro and indigo to simulate and control a Turtlebot 2.0. What I do is launch the gazebo simulator and turtlebot urdf model using

roslaunch turtlebot_gazebo turtlebot_empty_world.launch

and then run my own programs I created with roscpp that issues commands through the cmd_vel_mux topic and listens to the various sensors.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-28 19:10:11 -0600

Seen: 2,898 times

Last updated: Jul 25 '14