Skip to content

Commit 1ad884c

Browse files
authored
Fix map display for moving TF frame (ros2#483) (ros2#582)
Instead of the current time, use Time(0) to get the latest available transform as a fallback. This is the same logic that is applied in RViz from ROS 1. Resolves ros2#332 Signed-off-by: Jacob Perron <[email protected]>
1 parent fc97a88 commit 1ad884c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rviz_default_plugins/src/rviz_default_plugins/displays/map/map_display.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,11 @@ void MapDisplay::transformMap()
547547

548548
Ogre::Vector3 position;
549549
Ogre::Quaternion orientation;
550-
if (!context_->getFrameManager()->transform(frame_, transform_time, current_map_.info.origin,
551-
position, orientation) &&
552-
!context_->getFrameManager()->transform(frame_, context_->getClock()->now(),
553-
current_map_.info.origin, position, orientation))
550+
if (!context_->getFrameManager()->transform(
551+
frame_, transform_time, current_map_.info.origin, position, orientation) &&
552+
!context_->getFrameManager()->transform(
553+
frame_, rclcpp::Time(0, 0, context_->getClock()->get_clock_type()),
554+
current_map_.info.origin, position, orientation))
554555
{
555556
setMissingTransformToFixedFrame(frame_);
556557
scene_node_->setVisible(false);

0 commit comments

Comments
 (0)