mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 13:30:34 +08:00
attitude setpoint topic: cleanup of matrix class usage
Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -687,10 +687,9 @@ int do_level_calibration(orb_advert_t *mavlink_log_pub) {
|
||||
}
|
||||
|
||||
orb_copy(ORB_ID(vehicle_attitude), att_sub, &att);
|
||||
matrix::Quaternion<float> q(&att.q[0]);
|
||||
matrix::Euler<float> euler(q);
|
||||
roll_mean += euler(0);
|
||||
pitch_mean += euler(1);
|
||||
matrix::Eulerf euler = matrix::Quatf(att.q);
|
||||
roll_mean += euler.phi();
|
||||
pitch_mean += euler.theta();
|
||||
counter++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1168,9 +1168,8 @@ static void commander_set_home_position(orb_advert_t &homePub, home_position_s &
|
||||
home.y = localPosition.y;
|
||||
home.z = localPosition.z;
|
||||
|
||||
matrix::Quaternion<float> q(&attitude.q[0]);
|
||||
matrix::Euler<float> euler(q);
|
||||
home.yaw = euler(2);
|
||||
matrix::Eulerf euler = matrix::Quatf(attitude.q);
|
||||
home.yaw = euler.psi();
|
||||
|
||||
PX4_INFO("home: %.7f, %.7f, %.2f", home.lat, home.lon, (double)home.alt);
|
||||
|
||||
|
||||
@@ -64,10 +64,9 @@ int BlockLocalPositionEstimator::flowMeasure(Vector<float, n_y_flow> &y)
|
||||
return -1;
|
||||
}
|
||||
|
||||
matrix::Quaternion<float> q(&_sub_att.get().q[0]);
|
||||
matrix::Euler<float> euler(q);
|
||||
matrix::Eulerf euler = matrix::Quatf(_sub_att.get().q);
|
||||
|
||||
float d = agl() * cosf(euler(0)) * cosf(euler(1));
|
||||
float d = agl() * cosf(euler.phi()) * cosf(euler.theta());
|
||||
|
||||
// optical flow in x, y axis
|
||||
// TODO consider making flow scale a states of the kalman filter
|
||||
|
||||
@@ -500,8 +500,7 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
/* sensor combined */
|
||||
orb_check(sensor_combined_sub, &updated);
|
||||
|
||||
matrix::Quaternion<float> q(&att.q[0]);
|
||||
matrix::Dcm<float> R(q);
|
||||
matrix::Dcmf R = matrix::Quatf(att.q);
|
||||
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(sensor_combined), sensor_combined_sub, &sensor);
|
||||
@@ -944,8 +943,7 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
matrix::Quaternion<float> q(&att.q[0]);
|
||||
matrix::Dcm<float> R(q);
|
||||
matrix::Dcm<float> R = matrix::Quatf(att.q);
|
||||
|
||||
/* check for timeout on FLOW topic */
|
||||
if ((flow_valid || lidar_valid) && t > (flow_time + flow_topic_timeout)) {
|
||||
|
||||
Reference in New Issue
Block a user