Firmware
|
Simple functions for vector manipulation that do not fit into matrix lib. More...
#include <matrix/matrix/math.hpp>
#include <uORB/topics/vehicle_attitude_setpoint.h>
Go to the source code of this file.
Functions | |
vehicle_attitude_setpoint_s | ControlMath::thrustToAttitude (const matrix::Vector3f &thr_sp, const float yaw_sp) |
Converts thrust vector and yaw set-point to a desired attitude. 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. More... | |
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. More... | |
Simple functions for vector manipulation that do not fit into matrix lib.
These functions are specific for controls.
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. |
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.
vehicle_attitude_setpoint_s ControlMath::thrustToAttitude | ( | const matrix::Vector3f & | thr_sp, |
const float | yaw_sp | ||
) |
Converts thrust vector and yaw set-point to a desired attitude.
thr_sp | a 3D vector |
yaw_sp | the desired yaw |