you have a few tutorials on older versions.
the underscores used to set text to italic are making a few typos, make sure to notice them
1-this tutorial shows how to set the model velocities.
http://gazebosim.org/wiki/Tutorials/1.3/intermediate/control_model
for the above tutorial you might also find this usefull.
// ************* QUATERNION / POSE DATA ******************
static double qw,qx,qy,qz, Rrad, Prad, Yrad;
math::Vector3 p = model->GetWorldPose().pos;
math::Quaternion r = model->GetWorldPose().rot;
//from quaternion to Roll Pitch Yaw, in radians
qw=r.w; qx=r.x; qy=r.y; qz=r.z;
Rrad=atan2( 2*(qw*qx+qy*qz), 1-2*(qx*qx+qy*qy) ); //Roll
Prad=asin(2*(qw*qy-qz*qx)); //Pitch
Yrad=atan2( 2*(qw*qz+qx*qy), 1-2*(qy*qy+qz*qz) ); //Yaw
// ***********************************************
//set velocities
float velx,vely;
velx=Vlin*cos(Yrad);
vely=Vlin*sin(Yrad);
this->model->SetLinearVel(math::Vector3(velx, vely, 0));
this->model->SetAngularVel(math::Vector3(0, 0, Vang));
// ***********************************************
2- or you can control the model using aplying joint forces, but this needs a robot with joints as wheels
http://gazebosim.org/wiki/Tutorials/1.3/control_robot/mobile_base
hope this helps.
Originally posted by GAugusto with karma: 161 on 2013-09-24
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Zahra on 2013-09-24:
Hey, I have a question related to controlling the robot from the keyboard. I made a ros_enabled plugin to control the robot using the following method in this answer, by subscribing the twist type of msgs. http://answers.gazebosim.org/question/1991/what-is-the-best-way-to0-learn-gazebo-in-ros-for/
I am using groovy, and gazebo 1.9.1 with gazebo _ros_pckgs is there a way to use the keyboard-teleop to control the robot (turtlebot) from the keyboard manually instead. thanks in advance!
Comment by GAugusto on 2013-09-24:
the idea should be the same, the robot should have the topics for the vel comands, you just need to edit whatever controller (or the plugin) your using to publish the velocity commands to those topics. you can also change the plugin to match the controllers topics, whatever u see fit, they just need to match.
in the same link at the end i sugest the use of one keyboard controller and to edit the controller to publish to the respective topics.
Comment by GAugusto on 2013-09-24:
for example, if you have a controller publishing twist messages to "robot2/cmdvel" topic then you can change the plugin from "gz/cmdvel" to the same topic by changing the string name1 of the plugin from "gz" to "robot2". in case of a single robot it usualy does not have prefix so if you change the string name1 to "" (empty string) you will get the topic "/cmdvel". hope i was clear enough :S
Comment by GAugusto on 2013-09-24:
for example, if you have a controller publishing twist messages to "robot2/cmdvel" topic then you can change the plugin from "gz/cmdvel" to the same topic by changing the string name1 of the plugin from "gz" to "robot2". in case of a single robot it usualy does not have prefix so if you change the string name1 to "" (empty string) you will get the topic "/cmdvel". hope i was clear enough :S
Comment by vncntmh on 2013-09-28:
@GAuguto, When to load http://gazebosim.org/wiki/Tutorials/1.3/control_robot/mobile_base
get a error:
Error [Plugin.hh:127] Failed to load plugin my_plugin_with_sensor.so: my_plugin_with_sensor.so: cannot open shared object file: No such file or directory