Skip to content

Commit c263ef6

Browse files
Add orientation to Odom with covariance.
Also added test to avoid regression. Signed-off-by: Benjamin Perseghetti <[email protected]> Co-authored-by: James Goppert <[email protected]>
1 parent af73ebe commit c263ef6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/systems/odometry_publisher/OdometryPublisher.cc

+4
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ void OdometryPublisherPrivate::UpdateOdometry(
467467
msgCovariance.mutable_pose_with_covariance()->
468468
mutable_pose()->mutable_position()->set_z(msg.pose().position().z());
469469

470+
// Copy orientation from odometry msg.
471+
msgs::Set(msgCovariance.mutable_pose_with_covariance()->mutable_pose()->
472+
mutable_orientation(), pose.Rot());
473+
470474
// Copy twist from odometry msg.
471475
msgCovariance.mutable_twist_with_covariance()->
472476
mutable_twist()->mutable_angular()->set_x(msg.twist().angular().x());

test/integration/odometry_publisher.cc

+4
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,14 @@ class OdometryPublisherTest
495495

496496
std::vector<math::Vector3d> odomLinVels;
497497
std::vector<math::Vector3d> odomAngVels;
498+
std::vector<math::Quaterniond> odomAngs;
498499
google::protobuf::RepeatedField<float> odomTwistCovariance;
499500
// Create function to store data from odometry messages
500501
std::function<void(const msgs::OdometryWithCovariance &)> odomCb =
501502
[&](const msgs::OdometryWithCovariance &_msg)
502503
{
504+
odomAngs.push_back(msgs::Convert(_msg.pose_with_covariance().
505+
pose().orientation()));
503506
odomLinVels.push_back(msgs::Convert(_msg.twist_with_covariance().
504507
twist().linear()));
505508
odomAngVels.push_back(msgs::Convert(_msg.twist_with_covariance().
@@ -521,6 +524,7 @@ class OdometryPublisherTest
521524

522525
// Verify the Gaussian noise.
523526
ASSERT_FALSE(odomLinVels.empty());
527+
ASSERT_FALSE(odomAngs.empty());
524528
ASSERT_FALSE(odomAngVels.empty());
525529
int n = odomLinVels.size();
526530

0 commit comments

Comments
 (0)