Up:Tutorial? Previous:Robot dynamics (humanoid)? Next: Distance sensor
This tutorial explains how to control a wheeled mobile robot.
(※This sample code is valid only for later than v2.1.1)
The following model is used in this tutorial.
Figure from overhead view
Figure from bottom view
This mobile robot has two wheels on both sides and two casters attached on back and forth. The both of two wheels are connected to the main body with joint name "JOINT_LWHEEL" and "JOINT_RWHEEL", respectively. In this example, the wheels are rotated by setting the angular velocity of these joint angles. The radius of the wheel (8cm) and the size of the robot 20x8x25(cm) are defined in a 3D model file such as "mobile_base.xml" The mass, color and so on are also defined in the 3D model file.
$ emacs wheelController.cpp
wheelController.cpp
You can control the velocity of the two wheels by sending messages. For example, if you want to set the velocity of the left wheel as 1.5[rad/s] and the right wheel as 2.0[rad/s], you should send "1.5 2" to the robot agent.
Compile the controller by the following command.
$ ./sigmake.sh wheelController.cpp
$ emacs wheelWorld.xml
wheelWorld.xml
This world file specifies the 3D model file of the mobile robot as "mobile_base.xml" A camera is attached on a link named "LINK_CENTER" which is the main body of the mobile robot. A plastic bottle is also appeared as an obstacle.
$ sigserver.sh -w ./wheelWorld.xml
You can see a plastic bottle in front of the mobile robot.
For example, send a message "1 0.5" from the SIGViewer. The mobile robot will move to the right ahead.
The robot can go backward.
Up:Tutorial? Previous:Robot dynamics (humanoid)? Next: Distance sensor