Robots
BaseRobot
Bases: ABC
Base class for a robot.
Initializes the robot with a control rate and initial state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hertz |
float
|
Control rate of the robot [#cycles / second]. |
required |
state |
ndarray
|
Initial state of the robot. Shape: (num_states, ). |
required |
Source code in pypolo/robots/base_robot.py
error
abstractmethod
Error function for the robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state |
ndarray
|
Current state of the robot. Shape: (num_states, ). |
required |
goal |
ndarray
|
Goal state of the robot. Shape: (num_states, ). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: An error array of shape (num_actions, ). |
Source code in pypolo/robots/base_robot.py
step
abstractmethod
Transition function for the robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action |
ndarray
|
Action to be taken by the robot. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: New state of the robot. |
Source code in pypolo/robots/base_robot.py
take
Takes an action and updates the state of the robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action |
ndarray
|
Action to be taken by the robot. |
required |
DifferentialDriveRobot
Bases: BaseRobot
A robot with differential drive wheels.
Initializes the robot with a control rate and initial state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hertz |
float
|
Control rate of the robot [#cycles / second]. |
required |
state |
ndarray
|
Initial state of the robot [x, y, θ, v, ω]. Shape: (num_states, ). |
required |
Source code in pypolo/robots/differential_drive_robot.py
error
Given a goal location [x, y], returns an error array with the same shape as the action space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
float
|
Goal x position. |
required |
y |
float
|
Goal y position. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: An error array of shape (num_actions, ). |
Source code in pypolo/robots/differential_drive_robot.py
step
Transition function for the robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state |
ndarray
|
Current state of the robot [x, y, θ, v, ω]]. |
required |
action |
ndarray
|
Action to be taken by the robot [dv, dω]. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: New state of the robot. |