Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rover: Update documentation #3377

Merged
merged 13 commits into from
Oct 9, 2024
Binary file modified assets/airframes/rover/flight_modes/pure_pursuit_algorithm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/airframes/rover/rover_ackermann/cornering_logic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/airframes/rover/rover_ackermann/geometric_parameters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/airframes/rover/rover_differential/wheel_track.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/airframes/rover/rovers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@
- [Helicopter Config/Tuning](config_heli/index.md)
- [Rovers (experimental)](frames_rover/index.md)
- [Drive Modes](flight_modes_rover/index.md)
- [Differential-steering Rover](frames_rover/differential_rover.md)
- [Manual Modes (R)](flight_modes_rover/manual.md)
- [Auto Modes (R)](flight_modes_rover/auto.md)
- [Differential Rover](frames_rover/differential_rover.md)
- [Aion Robotics R1](frames_rover/aion_r1.md)
- [Ackermann Rover](frames_rover/ackermann_rover.md)
- [(Deprecated) Rover Position Control](frames_rover/rover_position_control.md)
Expand Down
60 changes: 60 additions & 0 deletions en/flight_modes_rover/auto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Auto Modes (Rover)

In auto modes the autopilot takes over control of the vehicle to perform autonomous navigation tasks.

## Mission Mode

_Mission mode_ is an automatic mode that causes the vehicle to execute a predefined autonomous [mission](../flying/missions.md) plan that has been uploaded to the flight controller.
The mission is typically created and uploaded with a Ground Control Station (GCS) application, such as [QGroundControl](https://docs.qgroundcontrol.com/master/en/).

### Mission commands

Following is the list of currently implemented and tested mission related commands:

| QGC mission item | Command | Description |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| Mission start | [MAV_CMD_MISSION_START](https://mavlink.io/en/messages/common.html#MAV_CMD_MISSION_START) | Starts the mission. |
| Waypoint | [MAV_CMD_NAV_WAYPOINT](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_WAYPOINT) | Navigate to waypoint. |
| Return to launch | [MAV_CMD_NAV_RETURN_TO_LAUNCH](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_RETURN_TO_LAUNCH) | Return to the launch location. |
| Delay until | [MAV_CMD_NAV_DELAY](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_DELAY) | The rover will stop for a specified amount of time. |
| Change speed | [MAV_CMD_DO_CHANGE_SPEED](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_CHANGE_SPEED) | Change the speed setpoint |
| Set launch location | [MAV_CMD_DO_SET_HOME](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_HOME) | Changes launch location to specified coordinates. |
| Jump to item | [MAV_CMD_DO_JUMP](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_JUMP) (and other jump commands) | Jump to specified mission item. |
| Loiter (all) | [MAV_CMD_NAV_LOITER_UNLIM](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_LOITER_UNLIM) (and other loiter commands) | This will simply stop the rover. |

## Return Mode

This mode uses the [pure pursuit guidance logic](#pure-pursuit-guidance-logic) with the launch position as goal.
Return mode can be activated through the respective [mission command](#mission-commands) or through the ground station UI.

## Pure Pursuit Guidance Logic

The desired yaw setpoints are generated using a pure pursuit algorithm:
The controller takes the intersection point between a circle around the vehicle and a line segment. In mission mode this line is usually constructed by connecting the previous and current waypoint:

![Pure Pursuit Algorithm](../../assets/airframes/rover/flight_modes/pure_pursuit_algorithm.png)

The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.

The look ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).

::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::

The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).

If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.

To summarize, the following parameters can be used to tune the controller:

| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius | m |

::: note
Both [Ackermann](../frames_rover/ackermann_rover.md#mission-parameters) and [differential](../frames_rover/differential_rover.md#auto-modes) rovers have further tuning parameters that are specific to the respective modules.
:::
101 changes: 18 additions & 83 deletions en/flight_modes_rover/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,33 @@ Flight modes (or more accurately "Drive modes" for ground vehicles) provide auto

- [Basic Configuration > Flight Modes](../config/flight_mode.md) - How to map RC control switches to specific flight modes

This section outlines all supported drive modes for rovers. Note that certain flight modes have different implementations for the specific modules.
This section outlines all supported drive modes for rovers. Note that certain flight modes have different implementations for the different rover types.

::: warning
Selecting any other mode than those below will either stop the rover or can lead to undefined behavior.
:::

## Manual Mode
## Supported Flight Modes

The _Manual_ mode stops the rover when the RC control sticks are centred.
To manually move/drive the vehicle you move the sticks outside of the centre.
The different types of rovers support the following flight modes:

[**Differential-steering Rover**](../frames_rover/differential_rover.md): When under manual control the throttle and roll sticks control the _speed_ and _yaw rate_ of the vehicle.
### Manual Modes

[**Ackermann Rover**](../frames_rover/ackermann_rover.md): When under manual control the throttle and roll sticks control the _speed_ and _steering angle_ of the vehicle.
These are modes that require a stick input from the user to drive the vehicle. The different manual modes provide increasing levels of autopilot support.

![Rover Manual Sticks](../../assets/airframes/rover/flight_modes/manual_inputs.png)
| [Differential](../frames_rover/differential_rover.md) | [Ackermann](../frames_rover/ackermann_rover.md) |
| ------------------------------------------------------------- | ----------------------------------------------------- |
| [Manual](../flight_modes_rover/manual.md#manual-mode) | [Manual](../flight_modes_rover/manual.md#manual-mode) |
| [Acro](../flight_modes_rover/manual.md#acro-mode) | |
| [Stabilized](../flight_modes_rover/manual.md#stabilized-mode) | |
| [Position](../flight_modes_rover/manual.md#position-mode) | |

Note that the rover does not attempt to maintain a specific orientation or compensate for external factors like slopes or uneven terrain!
The user is responsible for making the necessary adjustments to the stick inputs to keep the rover on the desired course.
### Auto Modes

## Acro Mode
In these modes the autopilot takes over control of the vehicle to perform autonomous navigation such as executing a mission plan.
Both rover modules support the same auto modes, but differ in implementation:

::: info
Acro mode is only supported for differential-steering rovers.
:::

Acro Mode is similar to [Manual mode](#manual-mode), but with closed-loop yaw rate control.
In this mode, the left stick input remains open-loop for forward speed control, while the right stick input commands a desired yaw rate setpoint, which is then maintained by the rover's closed-loop control system.

- Left Stick:

Behavior remains the same as in manual mode, directly controlling the rover's forward speed in an open-loop manner.

- Right Stick:

- Centered: Rover stops rotating and tries to maintains its current heading.
- Pushed left/right: Rover rotates counter-clockwise/clockwise at the rate commanded by the stick input, using a closed-loop controller (e.g., PID) to try to ensure the vehicle yaw rate matches the given setpoint.

See [Tuning(basic)](../frames_rover/differential_rover.md#tuning-basic) to go through the necessary setup to use acro mode for differential-steering rovers.

## Mission Mode

_Mission mode_ is an automatic mode that causes the vehicle to execute a predefined autonomous [mission](../flying/missions.md) plan that has been uploaded to the flight controller.
The mission is typically created and uploaded with a Ground Control Station (GCS) application, such as [QGroundControl](https://docs.qgroundcontrol.com/master/en/).

### Mission commands

Following is the list of currently implemented and tested mission related commands:

| QGC mission item | Command | Description |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| Mission start | [MAV_CMD_MISSION_START](https://mavlink.io/en/messages/common.html#MAV_CMD_MISSION_START) | Starts the mission. |
| Waypoint | [MAV_CMD_NAV_WAYPOINT](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_WAYPOINT) | Navigate to waypoint. |
| Return to launch | [MAV_CMD_NAV_RETURN_TO_LAUNCH](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_RETURN_TO_LAUNCH) | Return to the launch location. |
| Delay until | [MAV_CMD_NAV_DELAY](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_DELAY) | The rover will stop for a specified amount of time. |
| Set launch location | [MAV_CMD_DO_SET_HOME](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_HOME) | Changes launch location to specified coordinates. |
| Jump to item | [MAV_CMD_DO_JUMP](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_JUMP) (and other jump commands) | Jump to specified mission item. |
| Loiter (all) | [MAV_CMD_NAV_LOITER_UNLIM](https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_LOITER_UNLIM) (and other loiter commands) | This will simply stop the rover. |

### Pure Pursuit Guidance Logic

The steering and throttle setpoints are generated from the mission plan using a pure pursuit algorithm:

![Pure Pursuit Algorithm](../../assets/airframes/rover/flight_modes/pure_pursuit_algorithm.png)

The controller takes the intersection point between a circle around the vehicle and the line segment connecting the previous and current waypoint.
The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance.

The look ahead distance sets how aggressive the controller behaves and is defined as $l_d = v \cdot k$.
It depends on the velocity $v$ of the rover and a tuning parameter $k$ that can be set with the parameter [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN).

::: info
A lower value of [PP_LOOKAHD_GAIN](#PP_LOOKAHD_GAIN) makes the controller more aggressive but can lead to oscillations!
:::

The lookahead is constrained between [PP_LOOKAHD_MAX](#PP_LOOKAHD_MAX) and [PP_LOOKAHD_MIN](#PP_LOOKAHD_MIN).

If the distance from the path to the rover is bigger than the lookahead distance, the rover will target the point on the path that is closest to the rover.

To summarize, the following parameters can be used to tune the controller:

| Parameter | Description | Unit |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------- | ---- |
| <a id="PP_LOOKAHD_GAIN"></a>[PP_LOOKAHD_GAIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_GAIN) | Main tuning parameter | - |
| <a id="PP_LOOKAHD_MAX"></a>[PP_LOOKAHD_MAX](../advanced_config/parameter_reference.md#PP_LOOKAHD_MAX) | Maximum value for the look ahead radius | m |
| <a id="PP_LOOKAHD_MIN"></a>[PP_LOOKAHD_MIN](../advanced_config/parameter_reference.md#PP_LOOKAHD_MIN) | Minimum value for the look ahead radius | m |

:::note
Both [Ackermann](../frames_rover/ackermann_rover.md#mission-parameters) and [differential-steering](../frames_rover/differential_rover.md#tuning-mission) rovers have further tuning parameters that are specific to the respective modules.
:::

## Return Mode

This mode uses the [pure pursuit guidance logic](#pure-pursuit-guidance-logic) with the launch position as goal.
Return mode can be activated through the respective [mission command](#mission-commands) or through the ground station UI.
| Drive Mode |
| ----------------------------------------------------- |
| [Mission](../flight_modes_rover/auto.md#mission-mode) |
| [Return](../flight_modes_rover/auto.md#return-mode) |
77 changes: 77 additions & 0 deletions en/flight_modes_rover/manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Manual Modes (Rover)

Manual modes require stick inputs from the user to drive the vehicle.

![Manual Controls](../../assets/airframes/rover/flight_modes/rover_manual_controls.png)

The different manual modes provide increasing levels of autopilot support:

| Mode | Features |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| [Manual Mode](#manual-mode) | Directly map stick inputs to motor commands, no closed loop control. |
| [Acro Mode](#acro-mode) | Closed loop yaw rate control. |
| [Stabilized Mode](#stabilized-mode) | Closed loop yaw rate and yaw control. |
| [Position Mode](#position-mode) | Closed loop yaw rate, yaw and speed control and usage of GPS coordinates for improved straight line driving. |

## Manual Mode

The _Manual_ mode stops the rover when the RC control sticks are centred.
To manually move/drive the vehicle you move the sticks outside of the centre.

[**Differential Rover**](../frames_rover/differential_rover.md): Moving the left stick up/down controls the _forward speed_ and moving the right stick left/right controls the _yaw rate_ of the vehicle.

[**Ackermann Rover**](../frames_rover/ackermann_rover.md): Moving the left stick up/down controls the _forward speed_ and moving the right stick left/right controls the _steering angle_ of the vehicle.

::: note
The rover does not attempt to maintain a specific orientation or compensate for external factors like slopes or uneven terrain!
The user is responsible for making the necessary adjustments to the stick inputs to keep the rover on the desired course.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the dummies version! This is what we want first! Does not have to be in an info box.

:::

## Acro Mode

::: info
Acro mode is only supported for differential rovers.
:::

::: note
This mode requires a yaw rate estimate.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For MC we needed up-front information about the modes, such as requires GPS, because a vehicle might not have GPS.
But why does a user need to know this up front? I would say it is detail you would only add if we have lots of things that are preconditions, and even so, that box would appear after the "for dummies" explanation of the mode.

:::

Acro Mode is similar to [Manual mode](#manual-mode), but with closed-loop yaw rate control.
hamishwillee marked this conversation as resolved.
Show resolved Hide resolved
In this mode, the left stick input remains open-loop for forward speed control, while the right stick input commands a desired yaw rate setpoint, which is then maintained by the rover's closed-loop control system.

See the tuning for [acro mode](../frames_rover/differential_rover.md#acro-mode) section to go through the necessary setup to use acro mode for differential rovers.

## Stabilized Mode

::: info
Stabilized mode is only supported for differential rovers.
:::

::: note
This mode requires a yaw rate and yaw estimate.
:::

Just like [acro mode](#acro-mode), the left stick input remains open-loop for forward speed control, while the right stick input commands a desired yaw rate setpoint, which is then maintained by the rover's closed-loop control system.
But in addition to that, the rover will do closed loop yaw (or heading) control when the right stick is centered or in other words if the yaw rate setpoint is zero.
This means that the rover will maintain the current heading if the user only gives throttle input, but no yaw rate input.
Compared to [acro mode](#acro-mode), this mode is much better at driving in a straight line as it can more effectively reject disturbances.

See the tuning for [stabilized mode](../frames_rover/differential_rover.md#stabilized-mode) section to go through the necessary setup to use acro mode for differential rovers.

## Position Mode

::: info
Stabilized mode is only supported for differential rovers.
:::

::: note
This mode requires a yaw rate, yaw, speed and position estimate.
:::

This is the most advanced manual mode. It uses _closed loop yaw rate control_, _closed loop speed control_ and a special logic for driving a straight line when there is no yaw rate input.
In this mode, moving the left stick up/down commands a desired speed setpoint and moving the right stick left and right commands a desired yaw rate setpoint which are both close-loop controlled by the autopilot.
If there is no yaw rate input, the controller will remember the gps coordiantes and yaw (or heading) of the vehicle and use those to construct a line that the rover will then follow using the [pure pursuit](../flight_modes_rover/auto.md#pure-pursuit-guidance-logic) algorithm (same path following algorithm as in auto modes).
This way the rover is even better than the [stabilized mode](#stabilized-mode) at rejecting disturbances when driving a straight line.
See the tuning for [position mode](../frames_rover/differential_rover.md#position-mode) section to go through the necessary setup to use acro mode for differential rovers.

Loading
Loading