Computing odometry from encoder ticks

In this section, we will see the C++ interpretation of the diff_tf.py node, which subscribes the encoder data and computes the odometry, and publishes the odometry and tf of the robot. We can see the C++ interpretation of this node, called diff_tf.cpp, which can be found in the src folder of a package named chefbot_navig_cpp.

Discussed next are the important code snippets of this code and their explanations. The following code snippet is the constructor of the Odometry_calc class. This class contains the definition of computing odometry. The following code declares the subscriber for the left and right wheel encoders along with the publisher for the odom value:

Odometry_calc::Odometry_calc(){ //Initialize ...

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.