PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Functions | |
void | thrustToAttitude (const matrix::Vector3f &thr_sp, const float yaw_sp, vehicle_attitude_setpoint_s &attitude_setpoint) |
Converts thrust vector and yaw set-point to a desired attitude. More... | |
Vector2f | constrainXY (const matrix::Vector2f &v0, const matrix::Vector2f &v1, const float &max) |
Outputs the sum of two vectors but respecting the limits and priority. More... | |
bool | cross_sphere_line (const matrix::Vector3f &sphere_c, const float sphere_r, const matrix::Vector3f &line_a, const matrix::Vector3f &line_b, matrix::Vector3f &res) |
This method was used for smoothing the corners along two lines. More... | |
matrix::Vector2f ControlMath::constrainXY | ( | const matrix::Vector2f & | v0, |
const matrix::Vector2f & | v1, | ||
const float & | max | ||
) |
Outputs the sum of two vectors but respecting the limits and priority.
The sum of two vectors are constraint such that v0 has priority over v1. This means that if the length of (v0+v1) exceeds max, then it is constraint such that v0 has priority.
v0 | a 2D vector that has priority given the maximum available magnitude. |
v1 | a 2D vector that less priority given the maximum available magnitude. |
Definition at line 107 of file ControlMath.cpp.
References matrix::Vector< Type, M >::dot(), f(), matrix::Vector< Type, M >::length(), matrix::max(), and matrix::Vector< Type, M >::normalized().
Referenced by PositionControl::_positionController(), and TEST().
bool ControlMath::cross_sphere_line | ( | const matrix::Vector3f & | sphere_c, |
const float | sphere_r, | ||
const matrix::Vector3f & | line_a, | ||
const matrix::Vector3f & | line_b, | ||
matrix::Vector3f & | res | ||
) |
This method was used for smoothing the corners along two lines.
sphere_c | |
sphere_r | |
line_a | |
line_b | |
res | return boolean |
Note: this method is not used anywhere and first requires review before usage.
Definition at line 172 of file ControlMath.cpp.
References f(), matrix::Vector< Type, M >::length(), and matrix::Vector< Type, M >::normalize().
Referenced by TEST().
void ControlMath::thrustToAttitude | ( | const matrix::Vector3f & | thr_sp, |
const float | yaw_sp, | ||
vehicle_attitude_setpoint_s & | attitude_setpoint | ||
) |
Converts thrust vector and yaw set-point to a desired attitude.
thr_sp | a 3D vector |
yaw_sp | the desired yaw |
Definition at line 47 of file ControlMath.cpp.
References matrix::Matrix< Type, M, N >::copyTo(), f(), matrix::Vector< Type, M >::length(), matrix::Vector< Type, M >::normalize(), matrix::Vector3< Type >::normalized(), vehicle_attitude_setpoint_s::pitch_body, vehicle_attitude_setpoint_s::q_d, vehicle_attitude_setpoint_s::q_d_valid, vehicle_attitude_setpoint_s::roll_body, vehicle_attitude_setpoint_s::thrust_body, vehicle_attitude_setpoint_s::yaw_body, and matrix::Matrix< Type, M, N >::zero().
Referenced by PositionControl::getAttitudeSetpoint(), and TEST().