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 ...