Skip to content

Commit f3ed30e

Browse files
committed
Odometry sources: use CObservationRobotPose::sensorLabel as 'tf' frame name
1 parent b4178a4 commit f3ed30e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

mola_state_estimation_smoother/src/StateEstimationSmoother.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ void StateEstimationSmoother::onNewObservation(const CObservation::ConstPtr& o)
741741
o->sensorLabel.c_str());
742742
}
743743
}
744-
// Robot pose wrt "map":
744+
// Robot pose wrt a reference frame (odometry or map):
745745
else if (auto obsPose = std::dynamic_pointer_cast<const mrpt::obs::CObservationRobotPose>(o);
746746
obsPose)
747747
{
@@ -752,7 +752,14 @@ void StateEstimationSmoother::onNewObservation(const CObservation::ConstPtr& o)
752752
sensedSensorPose + mrpt::poses::CPose3DPDFGaussian(-obsPose->sensorPose);
753753
}
754754

755-
this->fuse_pose(obsPose->timestamp, sensedSensorPose, params_.reference_frame_name);
755+
// Use sensorLabel as frame_id if available (e.g. "wheel_odom", "visual_odom"),
756+
// so each source gets its own odometry frame in the factor graph.
757+
// Falls back to reference_frame_name for backward compatibility
758+
// (e.g. ground truth robot pose observations without a label).
759+
const std::string& frameId =
760+
obsPose->sensorLabel.empty() ? params_.reference_frame_name : obsPose->sensorLabel;
761+
762+
this->fuse_pose(obsPose->timestamp, sensedSensorPose, frameId);
756763
}
757764
// GNSS source:
758765
else if (auto obsGPS = std::dynamic_pointer_cast<const mrpt::obs::CObservationGPS>(o); obsGPS)

0 commit comments

Comments
 (0)