Skip to content

Commit

Permalink
[robotStateUpdater] making this more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
sunava committed Dec 8, 2024
1 parent 4045d9e commit de328e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pycram/ros_utils/object_state_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(self, tf_topic: str, joint_state_topic: str):
:param joint_state_topic: Name of the joint state topic, needs to publish sensor_msgs/JointState
"""
self.tf_listener = tf.TransformListener()
self.tf_listener.clear()

time.sleep(1)
self.tf_topic = tf_topic
self.joint_state_topic = joint_state_topic
Expand All @@ -46,7 +48,8 @@ def _subscribe_tf(self, msg: TransformStamped) -> None:
:param msg: TransformStamped message published to the topic
"""
trans, rot = self.tf_listener.lookupTransform("/map", RobotDescription.current_robot_description.base_link, Time(0))
self.tf_listener.waitForTransform("map", RobotDescription.current_robot_description.base_link, Time(0.0), Duration(5))
trans, rot = self.tf_listener.lookupTransform("map", RobotDescription.current_robot_description.base_link, Time(0.0))
World.robot.set_pose(Pose(trans, rot))

def _subscribe_joint_state(self, msg: JointState) -> None:
Expand Down

0 comments on commit de328e9

Please sign in to comment.