Controllers
BaseController
Bases: ABC
Interface of a controller.
Initialize the controller.
Source code in pypolo/controllers/base_controller.py
has_goals
property
Check if the controller has goals.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the controller has goals, False otherwise. |
control
abstractmethod
Compute the control action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state |
ndarray
|
The current state of the system. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The control action. |
Source code in pypolo/controllers/base_controller.py
set_goals
Set the goals of the controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
goals |
ndarray
|
The goals of the controller. |
required |
PIDController
Bases: BaseController
A Proportional–Integral–Derivative controller.
Initialize the PID controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error_fn |
Callable
|
The robot's error function. It should take the goal [x, y] as arguments and return the error of shape (num_actions, ). |
required |
dt |
float
|
The time step. |
required |
kp |
float
|
The proportional gain. |
required |
ki |
float
|
The integral gain. |
required |
kd |
float
|
The derivative gain. |
required |
error_threshold |
float
|
If the error is less than this threshold, the goal is considered reached. |
required |
Source code in pypolo/controllers/pid_controller.py
control
Compute the control action using the PID algorithm.
Returns:
| Name | Type | Description |
|---|---|---|
float |
ndarray
|
The control action. |