mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 02:53:34 +08:00
attitude estimator: fix readin of pose
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
AttitudeEstimator::AttitudeEstimator() :
|
AttitudeEstimator::AttitudeEstimator() :
|
||||||
_n(),
|
_n(),
|
||||||
_sub_modelstates(_n.subscribe("gazebo/model_states", 10, &AttitudeEstimator::ModelStatesCallback, this)),
|
_sub_modelstates(_n.subscribe("/gazebo/model_states", 10, &AttitudeEstimator::ModelStatesCallback, this)),
|
||||||
_vehicle_attitude_pub(_n.advertise<px4::vehicle_attitude>("vehicle_attitude", 10))
|
_vehicle_attitude_pub(_n.advertise<px4::vehicle_attitude>("vehicle_attitude", 10))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -59,10 +59,11 @@ void AttitudeEstimator::ModelStatesCallback(const gazebo_msgs::ModelStatesConstP
|
|||||||
|
|
||||||
/* Convert quaternion to rotation matrix */
|
/* Convert quaternion to rotation matrix */
|
||||||
math::Quaternion quat;
|
math::Quaternion quat;
|
||||||
quat(0) = (float)msg->pose[0].orientation.w;
|
//XXX: search for vtol or other (other than 'plane') vehicle here
|
||||||
quat(1) = (float)msg->pose[0].orientation.x;
|
quat(0) = (float)msg->pose[1].orientation.w;
|
||||||
quat(2) = (float)msg->pose[0].orientation.y;
|
quat(1) = (float)msg->pose[1].orientation.x;
|
||||||
quat(3) = (float)msg->pose[0].orientation.z;
|
quat(2) = (float)msg->pose[1].orientation.y;
|
||||||
|
quat(3) = (float)msg->pose[1].orientation.z;
|
||||||
|
|
||||||
msg_v_att.q[0] = quat(0);
|
msg_v_att.q[0] = quat(0);
|
||||||
msg_v_att.q[1] = quat(1);
|
msg_v_att.q[1] = quat(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user