Book Image

Learning ROS for Robotics Programming Second Edition

Book Image

Learning ROS for Robotics Programming Second Edition

Overview of this book

Table of Contents (27 chapters)
Learning ROS for Robotics Programming Second Edition
Credits
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Reviewer
About the Reviewer
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a base controller


A base controller is an important element in the navigation stack because it is the only way to effectively control your robot. It communicates directly with the electronics of your robot.

ROS does not provide a standard base controller, so you must write a base controller for your mobile platform.

Your robot has to be controlled with the message type geometry_msgs/Twist. This message was used on the Odometry message that we saw before.

So, your base controller must subscribe to a topic with the name cmd_vel, and must generate the correct commands to move the platform with the correct linear and angular velocities.

We are now going to recall the structure of this message. Type the following command in a shell to see the structure:

$ rosmsg show geometry_msgs/Twist

The output of this command is as follows:

geometry_msgs/Vector3 linear
  float64 x
  float64 y
  float64 z
geometry_msgs/Vector3 angular
  float64 x
  float64 y
  float64 z

The vector with the name linear...