skiros2
skiros2 copied to clipboard
World model element member last_tf_timestamp in ROS 2
Let's start from the beginning:
In ROS 1 noetic we received a lot of warnings if the AauSpatialReasoner
published TF information with the same timestamp.
To tackle that we introduced a _last_tf_timestamp
member:
https://github.com/RVMI/skiros2/blob/ed5bc907f8509f8223bf5c75ff2b7bcf9ff056e7/skiros2_common/skiros2_common/core/world_element.py#L68
Which is used by the reasoner:
now = self._node.get_clock().now()
# Prohibits publishing with the same timestamp - triggers warning in noetic
if e._last_tf_timestamp == now:
return
tf = e.getData(":TransformMsg")
tf.header.stamp = now.to_msg()
e._last_tf_timestamp = now
In ROS 2 we obviously use the rclpy.Time
object and there were pickle errors when deep-copying it. Deep-copying is for example used when doing spatial transformations with the reasoner since that directly changes the element.
I tried to reproduce this pickle error, but it worked then to do the deep-copy.
If nobody else can reproduce this, one can at least check if we need to save the last tf timestamp in ROS 2. If not, we can just remove it.