Deadalus
|
Class for the calculation of the Quadrotor Dynamics. More...
#include <quadrotor_dynamics.hh>
Public Member Functions | |
QuadRotorDynamics (double k_t=1.0, double k_m=1.0, double moment_arm=0.220, int error_type=NO_ERROR, double K=1.0, double C=0.0, double T=0.0, double dead_time=0.0) | |
Constructor. | |
virtual | ~QuadRotorDynamics () |
Destructor. | |
Mechanics | update (ActuationVal actuation_value, double deltaT) |
Updates the Thrusts and Torques. | |
void | activate_limit_constant (bool active) |
Makes check_limits() limit the maximal rotor speed. | |
void | activate_limit_transient (bool active) |
Makes check_limits() limit the maximal rotor acceleration. | |
void | set_limit_const (double rotor_speed_max) |
Set maximal rotor speed for check_limits() | |
void | set_limit_transient (double rotor_acceleration_max) |
Set maximal rotor acceleration for check_limits() | |
void | activate_gyroscopic_torque (bool active) |
Activates/Deactivates consideration of gyroscopic effect in roll_pitch_torque() | |
void | set_k_pt1 (double K) |
Set K coefficient for pt1_element() | |
void | set_t_pt1 (double T) |
Set T coefficient for pt1_element() | |
void | set_c_pt1 (double C) |
Set C coefficient for pt1_elmennt() | |
void | set_dead_time_pt1 (double dead_time) |
Set dead time for pt1_element() (not supported yet) | |
Mechanics | getMechanics () |
Returns the Mechanics on the quadrotor frame including Thrust Forces and Drag Torques. | |
Thrust | getThrust () |
Returns Thrust Forces produced by the motors. | |
Torque | getTorque () |
Returns Torque on the quadrotor frame. | |
void | setErrorType (int error_type) |
Sets the error type needed by disturbance() (NO_ERROR, GAUSSIAN_NOISE and SINE_ERROR supported) | |
Private Member Functions | |
void | check_limits () |
Check limits of maximal rotor speed and maximal rotor acceleration. | |
void | aerodynamics () |
Calculates the Thrust Forces and Drag Torque on the quadrotor frame created by the rotors angular velocities. | |
void | roll_pitch_torque () |
Calculates the roll and pitch torques on the quadrocopter frame. | |
void | disturbance () |
Provides disturbance to the Thrust. | |
void | pt1_element () |
PT1 element K*u + C = T*(d/dt)omega + omega. | |
Private Attributes | |
AngularVel | _rotor_speed |
Current rotor speed. | |
AngularVel | _rotor_speed_prev |
Previous rotor speed. | |
AngularVel | _rotor_acceleration |
Current rotor acceleration. | |
ActuationVal | _actuation_value |
Current actuation value. | |
Mechanics | _mechanics |
Current Mechanics, containing Thrust Forces and Drag Torques. | |
double | _dT |
Simulation time, which has passed since the last simulation step. | |
double | _k_t |
Thrust coefficient. | |
double | _k_m |
Moment coefficient. | |
double | _moment_arm |
Distance between rotor axis and center of quadrotor frame. | |
int | _error_type |
Error for the error provided by disturbance and set by setErrorType(int error_type) | |
double | _sine_index |
Index needed by disturbance for the error type SINE_ERROR. | |
double | _K |
K coefficient for pt1_element() | |
double | _C |
C coefficient for pt1_element() | |
double | _T |
T coefficient for pt1_element() | |
double | _dead_time |
Dead Time for pt1_elment() (not supported yet) | |
double | _rotor_speed_max |
Maximal rotor speed limited by check_limits() | |
double | _rotor_acceleration_max |
Maximal rotor accaleration limited by check_limits() | |
bool | _limit_const_act |
bool | _limit_transient_act |
bool | _gyroscopic_torque_active |
Class for the calculation of the Quadrotor Dynamics.
This class calculates the Torques and Forces on the quadrotor. Since gazebo does not support aerodynamics, this class calculates the Thrust Forces and the Yaw Torques produced by the the rotor speeds of the motors, which is resulting from the current actuation value.
QuadRotorDynamics::QuadRotorDynamics | ( | double | k_t = 1.0 , |
double | k_m = 1.0 , |
||
double | moment_arm = 0.220 , |
||
int | error_type = NO_ERROR , |
||
double | K = 1.0 , |
||
double | C = 0.0 , |
||
double | T = 0.0 , |
||
double | dead_time = 0.0 |
||
) |
Constructor.
constructor with default values
k_t | thrust coefficient |
k_m | moment coefficient |
moment_arm | distance between motor axis and center of frame |
error_type | error type for disturbance function() |
K | K-constant for pt1_element() |
C | C-constant for pt1_element() |
T | T-constant for pt1_element() |
dead_time | dead_time for pt1_element() (not supported yet) |
void QuadRotorDynamics::check_limits | ( | ) | [private] |
Check limits of maximal rotor speed and maximal rotor acceleration.
If activated by activate_limit_constant(bool) and if the maximal rotor speed (_rotor_speed_max) the maximal rotor acceleration is limited to the maximal value, set by set_limit_const. If activated by activate_limit_transient(bool) and if the maximal rotor acceleration value, set by set_limit_transient.
void QuadRotorDynamics::disturbance | ( | ) | [private] |
Provides disturbance to the Thrust.
Provides one of the supported kinds of disturbance to the Thrust, calculated by aerodynamics(). The supported error-types are NO_ERROR, GAUSSIAN_NOISE, SINE_ERROR. They are set by setErrorType(int error_type) and stored to the private member _error_type.
void QuadRotorDynamics::roll_pitch_torque | ( | ) | [private] |
Calculates the roll and pitch torques on the quadrocopter frame.
This function calculates the roll and pitch torques, resulting the thrust forces, calculated by aerodynamics. If activated by activate_gyroscopic_torque(bool) also the torques resulting from the gyroscopic effect are being considered
Mechanics QuadRotorDynamics::update | ( | ActuationVal | actuation_value, |
double | deltaT | ||
) |
Updates the Thrusts and Torques.
This function updates the values of the Thrusts and Torques resulting from the current rotor speeds. It is intended to be called in every simulation step.
actuation_value | actuation value corresponding to desired rotor speed |
deltaT | simulatin time passed since the last simulation step |
bool QuadRotorDynamics::_gyroscopic_torque_active [private] |
If set true, the gyroscopic effect is considered by roll_pitch_torque() it is set by activate_gyroscopic_torque( bool activate )
bool QuadRotorDynamics::_limit_const_act [private] |
If set true, maximal rotor speed limit is checked by check_limits(), it is set by activate_limit_constant( bool activate )
bool QuadRotorDynamics::_limit_transient_act [private] |
If set true, maximal rotor acceleration limit is checked by check_limits(), it is set by activate_limit_transient( bool activate )