mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 16:23:36 +08:00
feat(fw_att_control): use Axis angles instead of Euler Angles
This commit is contained in:
@@ -105,7 +105,10 @@ FixedwingAttitudeControl::vehicle_manual_poll(const float yaw_body)
|
|||||||
pitch_body = constrain(pitch_body,
|
pitch_body = constrain(pitch_body,
|
||||||
-radians(_param_fw_man_p_max.get()), radians(_param_fw_man_p_max.get()));
|
-radians(_param_fw_man_p_max.get()), radians(_param_fw_man_p_max.get()));
|
||||||
|
|
||||||
const Quatf q(Eulerf(roll_body, pitch_body, yaw_body));
|
const Quatf q_sp_rp = AxisAnglef(roll_body, pitch_body, 0.f);
|
||||||
|
const Quatf q_sp_yaw(cosf(yaw_body / 2.f), 0.f, 0.f, sinf(yaw_body / 2.f));
|
||||||
|
Quatf q = q_sp_yaw * q_sp_rp;
|
||||||
|
|
||||||
q.copyTo(_att_sp.q_d);
|
q.copyTo(_att_sp.q_d);
|
||||||
|
|
||||||
_att_sp.thrust_body[0] = (_manual_control_setpoint.throttle + 1.f) * .5f;
|
_att_sp.thrust_body[0] = (_manual_control_setpoint.throttle + 1.f) * .5f;
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
#include <uORB/topics/vehicle_rates_setpoint.h>
|
#include <uORB/topics/vehicle_rates_setpoint.h>
|
||||||
#include <uORB/topics/vehicle_status.h>
|
#include <uORB/topics/vehicle_status.h>
|
||||||
|
|
||||||
|
using matrix::AxisAnglef;
|
||||||
using matrix::Eulerf;
|
using matrix::Eulerf;
|
||||||
using matrix::Quatf;
|
using matrix::Quatf;
|
||||||
using matrix::Vector3f;
|
using matrix::Vector3f;
|
||||||
|
|||||||
Reference in New Issue
Block a user