Hello,
I am having trouble understanding how the effort_controller/JointTrajectoryController works in control terms. I understand how to use it and what it does, however I am having trouble grasping how it performs its calculations. I understand that it takes a joint trajectory as input, and outputs effort with the effort interface.
However, how does it implement the PID controller? Does it implment a PID controller for both the desired position and velocity, or just for the desired position?
And does it use a feedforward controller for the desired velocity?
Also, how does it determine the desired velocity from the trajectory and how can this be specified?
I hope you can help me gain a better understanding. Thank you.
Hello @volvo2,
as you correctly said the effort_controller/JointTrajectoryController executes joint trajectories on a set of joints and sends commands to an effort interface.
The nice thing about the JointTrajectoryController is that you can provide just a few waypoints and the controller will interpolate new points and will send smooth control command updates to the robot.
From the documentation the trajectory_msgs/JointTrajectory message is as follows:
In this message you must provide at least positions and you can optionally also provide velocities. Internally, when the trajectory is sampled, the position+velocity trajectory following error is mapped to effort commands through a PID loop. I am not an expert of each controller internals, but this is what I noticed when examining the source code that is in the official ros_controllers repository.
For instance by inspecting this file here:
In fact as you can see the command is computed adding feedforward+feedback control:
Feedforward term: Desired velocity, as computed by the joint trajectory controller.
Feedback: PID that compensates drift from the desired position.
This was also taken form that source code file:
The following is an example configuration of a controller that uses this adapter.
Notice the parameters gains and velocity_ff :
Hope I could help a little bit, I definitely recommend diving deeper into the source code of the controller to get all the details about its implementation.
Hello Roberto @rzegers ,
Thank you very much for the answer.
Understanding the JointTrajectory message helped a lot.
Am I correct in understanding that Moveit uses this message with the follow_joint_trajectory action?
So, in other words Moveit! plans a path using one of its planning algorithms, and then uses this for the follow_joint_trajectory action?
Does Moveit! provide the planned path as a set of waypoints which the controller then interpolates between?
Thank you for the patience- I am trying to gain a greater understanding of how the different mechanisms work.