Use immediately invoked lambda for tracking_to_local. (#848)
Restores const-correctness that we dropped when introducing the `publish_frame_projected_to_2d` param without using a ternary operator.master
parent
d18365500d
commit
4b60d9cdfe
|
@ -217,11 +217,13 @@ void Node::PublishTrajectoryStates(const ::ros::WallTimerEvent& timer_event) {
|
||||||
FromRos(ros::Time::now()), extrapolator.GetLastExtrapolatedTime());
|
FromRos(ros::Time::now()), extrapolator.GetLastExtrapolatedTime());
|
||||||
stamped_transform.header.stamp = ToRos(now);
|
stamped_transform.header.stamp = ToRos(now);
|
||||||
|
|
||||||
Rigid3d tracking_to_local = extrapolator.ExtrapolatePose(now);
|
const Rigid3d tracking_to_local = [&] {
|
||||||
if (trajectory_state.trajectory_options.publish_frame_projected_to_2d) {
|
if (trajectory_state.trajectory_options.publish_frame_projected_to_2d) {
|
||||||
tracking_to_local = carto::transform::Embed3D(
|
return carto::transform::Embed3D(
|
||||||
carto::transform::Project2D(tracking_to_local));
|
carto::transform::Project2D(extrapolator.ExtrapolatePose(now)));
|
||||||
}
|
}
|
||||||
|
return extrapolator.ExtrapolatePose(now);
|
||||||
|
}();
|
||||||
|
|
||||||
const Rigid3d tracking_to_map =
|
const Rigid3d tracking_to_map =
|
||||||
trajectory_state.local_to_map * tracking_to_local;
|
trajectory_state.local_to_map * tracking_to_local;
|
||||||
|
|
Loading…
Reference in New Issue