MAV'RIC
|
The manual control structure. More...
#include <manual_control.hpp>
Classes | |
struct | conf_t |
Configuration for manual control. More... | |
Public Types | |
enum | mode_source_t { MODE_SOURCE_REMOTE = 0, MODE_SOURCE_GND_STATION = 1, MODE_SOURCE_JOYSTICK = 2 } |
The source mode enum. | |
enum | control_source_t { CONTROL_SOURCE_REMOTE = 0, CONTROL_SOURCE_NONE = 1, CONTROL_SOURCE_JOYSTICK = 2 } |
Control source. | |
Public Member Functions | |
Manual_control (Satellite *sat, conf_t config, remote_conf_t remote_config) | |
Constructor. | |
float | throttle () const |
Selects the source input and returns the throttle. | |
float | roll () const |
Selects the source input and returns the roll. | |
float | pitch () const |
Selects the source input and returns the pitch. | |
float | yaw () const |
Selects the source input and returns the yaw. | |
void | get_torque_command (torque_command_t &command, float scale_roll=1.0f, float scale_pitch=1.0f, float scale_yaw=1.0f) const |
Compute torque command from the manual input. | |
void | get_rate_command (rate_command_t &command, float scale_roll=1.0f, float scale_pitch=1.0f, float scale_yaw=1.0f) const |
Compute rate command from the manual input. | |
void | get_thrust_command_copter (thrust_command_t &command, float scale=1.0f) const |
Compute thrust command from the manual input. | |
void | get_thrust_command_wing (thrust_command_t &command, float scale=1.0f) const |
Compute thrust command from the manual input. | |
void | get_attitude_command_absolute_yaw (attitude_command_t &command, float scale_roll=1.0f, float scale_pitch=1.0f, float scale_yaw=1.0f) const |
Compute attitude command from the manual input (absolute angles) | |
void | get_attitude_command (attitude_command_t &command, const quat_t ¤t_attitude, float scale_roll=1.0f, float scale_pitch=1.0f, float scale_yaw=0.5f) const |
Compute attitude command from manual control source (absolute roll and pitch, relative yaw) | |
void | get_attitude_command_vtol (attitude_command_t &command, const quat_t ¤t_attitude, float reference_pitch, float scale_roll=1.0f, float scale_pitch=1.0f, float scale_yaw=0.25f) const |
Compute attitude command from the manual input (absolute roll and pitch, integrated yaw) | |
void | get_velocity_command_copter (velocity_command_t &command, const quat_t ¤t_attitude, const velocity_command_t ¤t_velocity_command, float scale_x=10.0f, float scale_y=10.0f, float scale_z=1.5f, float scale_heading=0.25f) const |
Compute velocity command from the manual input. | |
Mav_mode | get_mode_from_source (Mav_mode mode_current) |
Returns the value of the mode from the desired source input. | |
void | set_mode_of_source (Mav_mode mode_current) |
Sets the internal state of the joystick. | |
signal_quality_t | get_signal_strength () |
Returns the quality of the strength of the remote receiver. | |
void | set_mode_source (mode_source_t mode_source) |
Set the mode source (which control source can change the mode (remote, joystick, groundstation)) | |
mode_source_t | mode_source () const |
Return the mode source (which control source can change the mode (remote, joystick, groundstation)) | |
void | set_control_source (control_source_t control_source) |
Set the control source (which control source has control (remote, joystick, none)) | |
control_source_t | control_source () const |
Return the control source (which control source has control (remote, joystick, none)) | |
Static Public Member Functions | |
static conf_t | default_config () |
Public Attributes | |
remote_t | remote |
The pointer to the remote structure. | |
Joystick | joystick |
The pointer to the joystick structure. | |
mode_source_t | mode_source_ |
The source mode. | |
control_source_t | control_source_ |
Flag to tell whether the remote is active or not. |
The manual control structure.
Manual_control::Manual_control | ( | Satellite * | sat, |
conf_t | config, | ||
remote_conf_t | remote_config | ||
) |
Constructor.
config | The pointer to the configuration structure of the module |
remote_config | The pointer to the remote structure |
control_source_t Manual_control::control_source | ( | ) | const [inline] |
Return the control source (which control source has control (remote, joystick, none))
void Manual_control::get_attitude_command | ( | attitude_command_t & | command, |
const quat_t & | current_attitude, | ||
float | scale_roll = 1.0f , |
||
float | scale_pitch = 1.0f , |
||
float | scale_yaw = 0.5f |
||
) | const |
Compute attitude command from manual control source (absolute roll and pitch, relative yaw)
Yaw is relative to current yaw (command.yaw = current.yaw + 0.5 * input.yaw)
command | Attitude command (output) |
current_attitude | Current attitude of the vehicle |
scale_roll | Scale (maximum output / max remote input) |
scale_pitch | Scale (maximum output / max remote input) |
scale_yaw | Scale (maximum output / max remote input) |
void Manual_control::get_attitude_command_absolute_yaw | ( | attitude_command_t & | command, |
float | scale_roll = 1.0f , |
||
float | scale_pitch = 1.0f , |
||
float | scale_yaw = 1.0f |
||
) | const |
Compute attitude command from the manual input (absolute angles)
command | Attitude command (output) |
scale_roll | Scale (maximum output / max remote input) |
scale_pitch | Scale (maximum output / max remote input) |
scale_yaw | Scale (maximum output / max remote input) |
void Manual_control::get_attitude_command_vtol | ( | attitude_command_t & | command, |
const quat_t & | current_attitude, | ||
float | reference_pitch, | ||
float | scale_roll = 1.0f , |
||
float | scale_pitch = 1.0f , |
||
float | scale_yaw = 0.25f |
||
) | const |
Compute attitude command from the manual input (absolute roll and pitch, integrated yaw)
command | Attitude command (output) |
current_attitude | Current attitude of the vehicle |
reference_pitch | Transition factor (0: forward flight, PI/2:hover) |
scale_roll | Scale (maximum output / max remote input) |
scale_pitch | Scale (maximum output / max remote input) |
scale_yaw | Scale (maximum output / max remote input) |
Mav_mode Manual_control::get_mode_from_source | ( | Mav_mode | mode_current | ) |
Returns the value of the mode from the desired source input.
mode_current | The current mode of the MAV |
void Manual_control::get_rate_command | ( | rate_command_t & | command, |
float | scale_roll = 1.0f , |
||
float | scale_pitch = 1.0f , |
||
float | scale_yaw = 1.0f |
||
) | const |
Compute rate command from the manual input.
command | Rate command (output) |
scale_roll | Scale (maximum output / max remote input) |
scale_pitch | Scale (maximum output / max remote input) |
scale_yaw | Scale (maximum output / max remote input) |
signal_quality_t Manual_control::get_signal_strength | ( | ) |
Returns the quality of the strength of the remote receiver.
void Manual_control::get_thrust_command_copter | ( | thrust_command_t & | command, |
float | scale = 1.0f |
||
) | const |
Compute thrust command from the manual input.
command | Thrust command (output) |
scale | Scale |
void Manual_control::get_thrust_command_wing | ( | thrust_command_t & | command, |
float | scale = 1.0f |
||
) | const |
Compute thrust command from the manual input.
command | Thrust command (output) |
scale | Scale |
void Manual_control::get_torque_command | ( | torque_command_t & | command, |
float | scale_roll = 1.0f , |
||
float | scale_pitch = 1.0f , |
||
float | scale_yaw = 1.0f |
||
) | const |
Compute torque command from the manual input.
command | Torque command (output) |
scale_roll | Scale (maximum output / max remote input) |
scale_pitch | Scale (maximum output / max remote input) |
scale_yaw | Scale (maximum output / max remote input) |
void Manual_control::get_velocity_command_copter | ( | velocity_command_t & | command, |
const quat_t & | current_attitude, | ||
const velocity_command_t & | current_velocity_command, | ||
float | scale_x = 10.0f , |
||
float | scale_y = 10.0f , |
||
float | scale_z = 1.5f , |
||
float | scale_heading = 0.25f |
||
) | const |
Compute velocity command from the manual input.
command | Velocity command (output) |
current_attitude | Current attitude of the vehicle |
current_velocity_command | Current velocity command |
scale_x | Scale (maximum output / max remote input) |
scale_y | Scale (maximum output / max remote input) |
scale_z | Scale (maximum output / max remote input) |
mode_source_t Manual_control::mode_source | ( | ) | const [inline] |
Return the mode source (which control source can change the mode (remote, joystick, groundstation))
float Manual_control::pitch | ( | ) | const |
Selects the source input and returns the pitch.
float Manual_control::roll | ( | ) | const |
Selects the source input and returns the roll.
void Manual_control::set_control_source | ( | control_source_t | control_source | ) | [inline] |
Set the control source (which control source has control (remote, joystick, none))
control_source | which control source has control (remote, joystick, none) |
void Manual_control::set_mode_of_source | ( | Mav_mode | mode_current | ) |
Sets the internal state of the joystick.
only mode of joystick is overwritten, remote keeps its interal state
mode_current | The current mode of the MAV |
void Manual_control::set_mode_source | ( | mode_source_t | mode_source | ) | [inline] |
Set the mode source (which control source can change the mode (remote, joystick, groundstation))
mode_source | which control source can change the mode (remote, joystick, groundstation) |
float Manual_control::throttle | ( | ) | const |
Selects the source input and returns the throttle.
float Manual_control::yaw | ( | ) | const |
Selects the source input and returns the yaw.