March 2018
Intermediate to advanced
1396 pages
42h 14m
English
The C++ implementation of twist_to_motor.py is discussed in this section. This node will convert the twist message (geometry_msgs/Twist) to motor target velocities. The topics subscribing by this node is the twist message from teleop node or Navigation stack and it publishes the target velocities for the two motors. The target velocities are fed into the PID nodes, which will send appropriate commands to each motor. The CPP file name is twist_to_motor.cpp and you can get it from the chapter_9_codes/chefbot_navig_cpp/src folder.
TwistToMotors::TwistToMotors() { init_variables(); get_parameters(); ROS_INFO("Started Twist to Motor node"); cmd_vel_sub = n.subscribe("cmd_vel_mux/input/teleop",10, ...