2.2.2. Control System Design
The control system design problem can be approached from two different perspectives, regardless of the controller architecture (PID, state-space controllers, etc.), and the selection of one or the other depends on the available technology. The first approach involves control in the joint (or actuation) space, meaning that the control variables are the individual motor velocities. This can be implemented in two ways, as illustrated in
Figure 10. The second approach consists of control in the workspace, where the control variables are the robot’s linear and angular velocities, as shown in
Figure 11.
where
Vr are the reference velocities of the robot (linear and angular).
are the reference angular velocities for the motors, calculated using IK.
are the angular velocities for each motor measured by the encoders.
Va are the robot’s velocities, approximated using the motors’ velocities and DK.
Vm are the robot’s measured velocities.
The best option is control in the workspace, as the use of inverse or direct kinematics directly depends on the robot’s parameters, meaning that any change in these parameters must be reflected in the kinematic equations. However, control in the workspace requires sensors that directly measure the linear or angular velocities of the robot. In this study, the only sensors available on the robot were the motor encoders, so the only feasible options were control in the joint space using inverse or direct kinematics. Since the mathematical models of the motors were previously obtained, direct control of the actuators’ angular velocities was the best option, using inverse kinematics.
To ensure that the motors’ acceleration did not produce torques greater than previously stated, a response time was proposed that depends on this parameter and the maximum angular velocity.
Using Equation (19), a response time of 0.322 s was obtained, indicating that the dominant pole governing the system dynamics must be located at 12.4224. Once the response time had been defined, an additional design criterion was established to ensure zero steady-state error, at least when the reference input exhibits a step-like behavior. Furthermore, the mathematical models of the plants corresponded to underdamped second-order systems, as described by Equation (20).
where
K is the system’s static gain.
is the natural frequency of the system.
is the damping ratio of the system.
Given the design requirements and the structure of the mathematical model of each system to be controlled, controller options such as PI and PD were discarded. Although a PI controller can achieve zero steady-state error, it lacks the necessary flexibility to shape the time response, as it only introduces one zero, while the plant has two poles. Similarly, a PD controller does not offer sufficient control over the time response for the same reason, and in addition, it cannot ensure a zero steady-state error, due to the absence of a pole at the origin.
On the other hand, classical techniques such as lag, lead, or lag–lead controllers are not suitable options either, since these controllers are essentially “imperfect” versions of integrators or differentiators, which are already present in PI and PD controllers. In the best-case scenario, a lag–lead configuration only approximates the behavior of a full PID controller.
In this context, the viable control strategies for the system included a PID controller, a modern approach based on state-space representation, or an advanced technique such as fuzzy logic or neural networks. The latter two options are typically applied to more complex systems or objectives, such as trajectory tracking or the generation of reference velocities, as discussed in
Section 1 and demonstrated in works such as [
25,
26,
27,
28,
29]. Therefore, for the system considered in this study, the most suitable options were a PID controller or a state-space-based controller.
Of the two options, a PID controller was selected, for the simple reason that a state-space controller requires an observer or estimator to estimate states that cannot be measured in real time (such as the armature current in DC motors). An observer or estimator requires shorter response times, to ensure that the unmeasured states converge before the output response time. Additionally, for the physical implementation discussed in
Section 3.3, shorter sampling times are required, even smaller than the response times. While shorter response times improve system performance, the criteria for these times vary in the literature [
23,
24]. The challenge with shorter response times lies in the encoder resolution of the physical implementation, which provides only 100 samples per revolution. As a result, the sampling time cannot be too short, as this would compromise the reliability of measurements at lower angular velocities of the motors. Thus, the proposal consists of a PID controller, with a transfer function for each motor, as shown in Equation (21).
where
is the proportional gain of the PID controller.
is the derivative time constant.
is the integral time constant.
The PID controller is designed in such a way that the dynamics of the plant to be controlled are nullified, ensuring that, in a closed-loop configuration, the system exhibits a first-order transfer function. This is achieved using the pole-zero cancellation method to determine the PID parameters. In this manner, the desired response time can be freely controlled. However, controllers that include an integrative part to eliminate steady-state error have a drawback: when the control signal saturates, which is inevitable in physical systems, the integral of the error starts to accumulate over time, resulting in the windup effect. To mitigate this, it is essential to implement an anti-windup technique, such as those discussed earlier.
Pole-zero cancellation nullifies the plant’s dynamics, ensuring that Equation (22) is satisfied.
In this way, the direct chain of the system is given by Equation (23).
Therefore, considering the unit feedback as shown in the diagram of
Figure 12, the closed-loop transfer function is given by Equation (24).
Based on the response time equation for a first-order system, and following the criterion proposed by Nise [
23], Equation (25) is obtained.
Equations (22) and (25) allow finding the values of the PID controllers that adjust the response to the desired time and eliminate the steady-state error. These values are shown in
Table 5.
With the controller designed in continuous time, a digital control algorithm can be derived by applying numerical methods to transform the system from the complex domain
s to the complex domain
z. The complexity of these methods depends on the desired level of precision and accuracy in the approximation; some of the most well-known techniques are discussed in [
42]. For the discretization of the controllers, the Backward Euler method was employed, using a sampling time of 25 ms. This value was determined experimentally and corresponds to the minimum interval that ensured accurate measurement of the actual motor velocities.
Notably, this sampling time is approximately 13 times shorter than the system’s response time, which ensures a good approximation of the continuous-time behavior, as demonstrated in
Section 3.2. If a state-space controller with an observer or estimator had been implemented instead, the response time of the system would have needed to be much shorter, and consequently, the sampling time as well. In this way, the necessary equations for the digital control algorithms were derived with 25 ms for the PID controller, as presented below.
where
is the control signal for the right motor in discrete time.
is the error in the right motor in discrete time.
is the integral of the error for the right motor in discrete time.
is the control signal for the left motor in discrete time.
is the error in the left motor in discrete time.
is the integral of the error for the left motor in discrete time.
Equations (26) and (28) correspond to the control laws for the right and left motors, respectively, while Equations (27) and (29) correspond to the equations for the error integrals of both motors, in which the anti-windup technique shown in
Figure 13 is applied.
For the physical implementation, the
joy_node and
teleop_node, shown in
Figure 9, were programmed on the master computer. On the other hand, the robot’s CPU received the
cmd_vel topic and transmitted these values to the controller via serial communication, maintaining the structure outlined in
Figure 7. Based on the robot’s linear and angular velocity values received through the
cmd_vel topic, individual references for each motor were calculated using the robot’s kinematic model. These references were subsequently sent to the discretized PID controller, equipped with an anti-windup system to ensure a quick response under saturation conditions.