The orders to control library has been designed for the development of any control system for robots
and Ros two.
For this reason, this library offers various interfaces and configurations to adapt to the different
needs of each robot.
In particular, this library offers three different interfaces that corresponds to three different control
logics.
The control of an actuator in fact can be implemented for position, velocity or force or torque.
The position control is exactly what we will be using in this course to control our robot.
Controlling an actuator for position means implementing a control logic that moves a certain system
from its current position to a desired position and potentially following a specific trajectory during
these movement, reaching intermediate configurations between the initial and the final position.
Let's consider a real case where a motor that controls a link of a robotic arm needs to rotate to reach
a position of 90 degrees.
Let's also assume that the motor is currently stationary at the zero degree position.
The error variable, which is provided as an input to the control system is calculated as the difference
between the desired position.
So 90 degrees and the current position of the motor.
So zero degrees.
Therefore the error variable is also equal to 90 degrees.
This value is passed as an input to the control system, which applies a specific logic to calculate
the commands to be sent to the motor, to reach the desired position and minimize the error variable.
So the motor that controls the robot link starts to rotate.
And in the next time step when the control loop is executed again, it will have rotated by a certain
angle.
Let's assume, for example, that it has rotated by 30 degrees, so the error variable is recalculated
as the difference between the target position, which still remains 90 degrees and the current position
of the motor, which now is 30 degrees.
Therefore, in this iteration of the loop, the error variable corresponds to 60 degrees.
Once again, this error variable is passed as an input to the control system which calculates the new
commands to be sent to the robot.
Once again, the motor executes the command received from the control system and moves towards the desired
pose.
At the next time step the control loop repeats.
So this time the motor is at the 60 degrees position in the error variable is recalculated as the difference
between the desired position.
So 90 degrees and the current position.
So 60 degrees resulting in 30 degrees.
We can see that with each control loop iteration.
The error variable is effectively decreasing, indicating that the system is approaching the desired
position.
So the arm continues to move and a new control loop begins.
So the current position of the motor is 90 degrees.
The error variable is also recalculated and represents the difference between the desired position.
So 90 degrees and the current position that is also 90 degrees.
And therefore in this case the error variable is zero.
However, depending on the implemented control system, even when the error variable reaches zero and
the system reaches the desired position, the control system is not turned off or stopped.
It continues its execution to correct any external disturbance, such as gravity, acting on the robotic
arm which can push the robots downwards.
The control system tasks in this case is to maintain the arm stable in the current position.
In addition to position control, the Ros2 Control Library also supports the velocity control.
In this type of control, the goal changes.
Instead of having a motor to reach a specific position, we want it to start moving to start rotating
with a certain velocity.
Therefore, the input to the control system is represented by the desired velocity and the error variable
is calculated as the difference between the desired velocity and the current velocity of the motor.
And so the control system sends commands to the actuator to rotate at the desired velocity in order
to minimize the error variable.
Furthermore, the Ros2 control also supports force or torque control applied to the motors.
This type of control is useful, for example, in manipulation application where fragile objects needs
to be grasped without breaking them.
In this case, our position control could apply too much pressure and break the object.
Or it could apply not enough pressure.
And so drop it.
In this case, a force torque control is used where the input variable is.
For example, the force to be applied in order to grasp an object.
And the error variable is calculated as the difference between the desired force and the current force
that the gripper is applying.
And so the control system ensures that the gripper is closed with the right force in order to grasp
and manipulate the object without breaking it.