Skip to Content
Mastering ROS for Robotics Programming - Second Edition
book

Mastering ROS for Robotics Programming - Second Edition

by Lentin Joseph, Jonathan Cacace
February 2018
Beginner
580 pages
13h 20m
English
Packt Publishing
Content preview from Mastering ROS for Robotics Programming - Second Edition

Step 4 – Explaining the controller source file

In this section, we can see the explanation of each section of the code:

/// Controller initialization in non-real-time 
bool MyControllerClass::init(hardware_interface::PositionJointInterface* hw, ros::NodeHandle &n) 
{ 

The preceding is the init() function definition of the controller. This will be called when a controller is loaded by the controller manager. Inside the init() function, we are creating an instance of the state of the robot (hw) and NodeHandle, and we also get the manager of the joint interacting with the controller. In our example, we defined the joint to control in the my_contoller.yaml file, loading the joint name into the ROS parameter server. This function returns the success ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ROS for Robotics Programming - Third Edition

Mastering ROS for Robotics Programming - Third Edition

Lentin Joseph, Jonathan Cacace
Effective Robotics Programming with ROS - Third Edition

Effective Robotics Programming with ROS - Third Edition

Luis Sanchez, Enrique Fernandez Perdomo, Anil Mahtani

Publisher Resources

ISBN: 9781788478953Supplemental Content