Skip to content

Lizi_Motion

roboticanyair edited this page Nov 19, 2018 · 3 revisions

Command your robot with simple motion commands

Driving the robot mobile platform

Driving the robot is done simply by publishing a geometry_msgs/Twist message to the /mobile_base_controller/cmd_vel topic.

The geometry_msgs/Twist expanded definition looks like:

Vector3 linear
    float64 x
    float64 y
    float64 z
Vector3 angular
    float64 x
    float64 y
    float64 z

However, our robot can't drive sideways (linear.y), or rotate about the x and y axes! Therefore, we will only be using linear.x and angular.z to control our robot.

One option is to use the rostopic command line tool to publish a driving message, for example:

$ rostopic pub /cmd_vel geometry_msgs/Twist -r 10 -- '[0.3, 0.0, 0.0]' '[0.0, 0.0, -0.9]'

The above command will command the robot to drive with a forward velocity of 0.3 m/s and turn right (positive values will cause the robot to turn left) with angular velocity of 0.9 rad/s. The "-r 10" argument will cause this message to be sent in a rate of 10 Hz, This is necessary because the robot controller have a 0.25 seconds safety stop timeout watch. After a period of 0.25 seconds without any coming message, the robot will stop.

If you want to use a graphical tool for publishing this command you can use the rqt Robot Steering tool or the rqt Message Publisher tool.

Lets, give it a try together. First, lets open a new terminal and launch the lizi robot in the gazebo simulation:

$ roslaunch lizi lizi.launch gazebo:=true

Now, in a new terminal, type the following command for driving the robot:

$ rostopic pub /cmd_vel geometry_msgs/Twist -r 10 -- '[0.2, 0.0, 0.0]' '[0.0, 0.0, 0.6]'
Open the Gazebo window and watch the lizi robot drive.

To stop the robot from driving click Ctrl+C in order to stop publishing.

Now, Lets use the Robot Steering tool. In your second terminal launch rqt by typing:

$ rqt

From the upper toolbar, select Plugins->Robot Tools->Robot Steering.

Enter the /mobile_base_controller/cmd_vel, topic at the top text box.

Your window should look like this:

RobotSteering

Now, play with the two sliders to steer the lizi robot.

Home