Closed flabrosse closed 1 month ago
It turns out that I was wrong, on many accounts.
(1) the master branch is not a ROS2 branch but a ROS1 so using ros::Time::now()
is correct there.
(2) In the ros2 branch, now()
is in fact a static function of rclcpp::Time
.
The issue was that gazebo was not initialising ROS properly and therefore not publishing anything on the /clock topic. I solved the problem by following this post.
Closing this issue.
It seems that most, or at least many, of the rtabmap nodes that do publish TF messages publish the wrong time: a constant time. I think this is because of lines like this:
ros::Time tfExpiration = ros::Time::now() + ros::Duration(tfTolerance);
(this one being from
rtabmap_slam/src/CoreWrapper.cpp
, the specific issue I'm having that lead me to exploring this).My understanding is that
ros::Time::now()
in ROS2 does not exist (or does not do what would be expected). It should now be replaced withthis->get_clock()->now()
, as described here and here.PS. I am guessing that the
now()
I see everywhere in the ros2 branch resolves toros::Time::now()
. The default and most up to date master branch explicitly usesros::Time::now()
.PPS. I also reported this in the old issue #960.