Skip to content

Commit

Permalink
hubero_ros - NavigationRos: odometry twist component expressed in bas…
Browse files Browse the repository at this point in the history
…e frame (instead of global reference frame) [#31]
  • Loading branch information
rayvburn committed Feb 18, 2022
1 parent 4183e7c commit 3cbf03b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions hubero_ros/src/navigation_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,17 @@ void NavigationRos::update(const Pose3& pose, const Vector3& vel_lin, const Vect
Pose3 odom_pose = pose - pose_initial_;
odometry.pose.pose = ignPoseToMsgPose(odom_pose);
setIdealCovariance(odometry.pose.covariance);
// twist
odometry.twist.twist = ignVectorsToMsgTwist(vel_lin, vel_ang);
// twist - velocities expressed in the base frame
// pseudoinversion of matrix in NavigationBase::convertCommandToGlobalCs
ignition::math::Matrix3d r(
cos(pose.Rot().Yaw()), sin(pose.Rot().Yaw()), 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 1.0
);
Vector3 vel_lin_base = r * vel_lin;
// assume that Z axis direction matches simulator frame and 'base' frame (typically valid)
Vector3 vel_ang_base(0.0, 0.0, vel_ang.Z());
odometry.twist.twist = ignVectorsToMsgTwist(vel_lin_base, vel_ang_base);
setIdealCovariance(odometry.twist.covariance);
pub_odom_.publish(odometry);

Expand Down

0 comments on commit 3cbf03b

Please sign in to comment.