Skip to content

3.2 Controls

Anthony Tan edited this page Sep 4, 2023 · 24 revisions

Controls

The control system's primary task is to listen to desired setpoint commands from the planner and continually generate an effort (force/torque) that is most likely to guide the AUV towards the desired setpoint.

Table of Contents

Overview

The controls package operates in two modes: State mode and Superimposer mode. In both cases, the control system runs an action server that listens to commands from an action client in the planner package. When the server receives a command, it is processed depending on the mode of operation.

State Mode

In State mode, the control system comprises three layers:

  1. State Server: The state server listens to state goals from the planner. State goals may contain four optional degrees of freedom: x, y, z, and orientation. These degrees of freedom are optional, meaning not all of them need to be enabled. If a degree of freedom is not enabled, the control system makes no effort to adjust the AUV's pose in that specific degree of freedom. For example, if the state server receives a state goal that only specifies a z position, the AUV will ascend or descend to the desired depth without controlling its x and y position or orientation. After receiving a goal, the state server publishes setpoints to the PID nodes. It monitors the progress of the goal and informs the planner when the goal pose has been achieved and maintained for a certain period.

  2. PID nodes: Detailed information about PID and quaternions is covered later in this document. There are four PID nodes: x, y, z, and quaternion (orientation). Each PID node is responsible for a specific degree of freedom. The x, y, and z PID nodes publish topics called global_x, global_y, and global_z, respectively. These topics represent the desired force to be exerted by the thrusters in the global coordinate frame. It's important to note that the effort published by the controls is body-framed, not global-framed. The transformation to the body frame is handled by the superimposer. The quaternion PID node is responsible for running PID controls on the AUV's rotation. Unlike the x, y, and z PID nodes, the quaternion PID node outputs three topics: roll, pitch, and yaw. These topics correspond to the x, y, and z components of the desired torque.

  3. Superimposer: The superimposer subscribes to the global_x, global_y, global_z, roll, pitch, and yaw topics and combines them into a single effort wrench. The global x, y, z forces are combined into a single global force vector and rotated to find the desired linear force within the AUV's body frame. This force constitutes the force component of the wrench. The torque component of the wrench is simply the roll, pitch, and yaw values. No further transformation is necessary for the torques.

Superimposer Mode

In Superimposer mode, the controls package consists of two layers:

  1. Superimposer Server: The superimposer server is an action server that listens to superimposer goals from the planner package. A superimposer goal consists of six optional effort components: force x, y, z, and torque x, y, z. If a specific degree of freedom is specified, that value is passed to the superimposer to be incorporated into the effort. For the force x, y, z degrees of freedom, the topics are surge, sway, and heave. These forces are body-framed. For the torque x, y, z degrees of freedom, the topics are roll, pitch, and yaw.

  2. Superimposer: The superimposer subscribes to the surge, sway, heave, roll, pitch, and yaw topics and combines them into a single effort vector.

It's worth noting that these modes of operation are not mutually exclusive and can be used simultaneously. For instance, you can use the state server to maintain the AUV's orientation while simultaneously using the superimposer server to apply a constant surge force.

Usage

Interacting with the controls package should be done using an action client in the planner. The planner features a Controller class that provides abstractions for all control actions. You can find this class in controller.py. In a mission plan, you can instantiate a controller object from controller.py and use its methods to control the AUV.

Launch Files

Configuration

If your package has configurable parameters, explain how to configure them. This could involve editing configuration files or using ROS parameter

Dependencies

PID Algorithm

The PID (Proportional-Integral-Derivative) control algorithm is a widely used method for controlling systems in various applications, including the control of Autonomous Underwater Vehicles (AUVs) in the context of this package. PID control aims to maintain a desired setpoint by adjusting an actuator's control effort based on the error between the setpoint and the current system state. This section provides an overview of the PID algorithm as it applies to this control package.

PID Components

PID control consists of three main components:

  1. Proportional (P) Term: The proportional term calculates an output based on the current error (the difference between the setpoint and the current state). This term is directly proportional to the error and helps the system react to the present error. A higher proportional gain (P-gain) amplifies the correction effort in response to larger errors, but it may lead to overshooting.

  2. Integral (I) Term: The integral term considers the accumulation of past errors over time. It helps eliminate steady-state errors by integrating the error signal. The integral term is particularly useful when there are small, persistent errors that the proportional term alone cannot eliminate. However, an excessive integral gain (I-gain) can cause the system to become unstable or oscillate.

  3. Derivative (D) Term: The derivative term predicts future error by evaluating the rate of change of the error. It helps dampen the system's response, preventing overshooting and oscillations. The derivative term is sensitive to rapid changes in the error signal and reduces control effort as the error approaches zero. A higher derivative gain (D-gain) increases damping but can lead to overshooting if set too high.

PID Control in the Package

In the controls package, PID control is utilized to maintain and adjust the AUV's position and orientation as needed. There are four PID controllers operating on different degrees of freedom: x, y, z, and quaternion (orientation).

  • X, Y, Z PID Controllers: These controllers are responsible for controlling the AUV's position in the X, Y, and Z axes, respectively. They receive error signals corresponding to the desired position and the current position and compute control efforts to adjust the AUV's position.

  • Quaternion PID Controller: This controller operates on the AUV's orientation and is responsible for maintaining the desired roll, pitch, and yaw angles. It receives error signals representing the desired and current orientation and computes control efforts to adjust the AUV's orientation.

Tuning PID Controllers

Tuning PID controllers involves finding the appropriate gains (P-gain, I-gain, and D-gain) for each controller to achieve stable and responsive control. The tuning process typically requires experimentation and adjustment based on the specific dynamics of the AUV and the desired control behavior.

To facilitate PID controller tuning, the package provides a PID configuration GUI that can be launched using ROS. This GUI allows users to interactively adjust the gains for each controller and observe the AUV's response in real-time.

Remember that tuning PID controllers is a dynamic process, and it may be necessary to fine-tune the gains for different operational scenarios and payloads.

Understanding and effectively tuning the PID controllers is crucial for achieving precise control of the AUV's position and orientation, ensuring successful mission execution.

Clone this wiki locally