ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three are required and the last one is optional. Therefore, your lookup_transform() call should actually look like:

now = rclpy.time.Time() trans = self.tf_buffer.lookup_transform( to_frame_rel, from_frame_rel, now)

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three are required and the last one is optional. Therefore, your lookup_transform() call should actually look like:

now like: timeToLook = rclpy.time.Time() rclpy.time.Time() # to acquire the last transform trans = self.tf_buffer.lookup_transform( to_frame_rel, from_frame_rel, now)self._tf_buffer.lookup_transform('odom', 'base_link', timeToLook, timeout=Duration(0))

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following:following pararmeters:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three (target frame, source frame, time at which to get the transform) are required and the last one is optional. optional (timeout). In your code, you probably confused a timeout and time parameters. You have to pass a Time() to the time parameter and Duration() to the timeout parameter. Therefore, your lookup_transform() call should actually look like: timeToLook = rclpy.time.Time() # to acquire the last transform trans = self._tf_buffer.lookup_transform('odom', 'base_link', timeToLook, timeout=Duration(0))

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following pararmeters:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three (target frame, source frame, time at which to get the transform) are required and the last one is optional (timeout). In your code, you probably confused a timeout and time parameters. You have to pass a Time() to the time parameter and Duration() to the timeout parameter. Therefore, your lookup_transform() call should actually look like: timeToLook like:

                timeToLookUp = rclpy.time.Time() # to acquire the last transform
                 trans = self._tf_buffer.lookup_transform('odom', 'base_link', timeToLook, timeout=Duration(0))

timeToLookUp, timeout=Duration(0))

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following pararmeters:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three (target frame, source frame, time at which to get the transform) are required and the last one is optional (timeout). In your code, you probably confused a timeout and time parameters. You have to pass a Time() to the time parameter and Duration() to the timeout parameter. Therefore, your lookup_transform() call should actually look like:

  timeToLookUp = rclpy.time.Time() # to acquire the last transform
  trans = self._tf_buffer.lookup_transform('odom', 'base_link', timeToLookUp, timeout=Duration(0))

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following pararmeters:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three (target frame, source frame, time at which to get the transform) are required and the last one is optional (timeout). In your code, you probably confused a timeout and time parameters. You have to pass a Time() to the time parameter and Duration() to the timeout parameter. Therefore, your lookup_transform() call should actually look like:

 timeToLookUp = rclpy.time.Time() # to acquire the last transform
 trans = self._tf_buffer.lookup_transform('odom', 'base_link', timeToLookUp, timeout=Duration(0))

btw, if you are interested in some code examples or advanced concept on tf2, you can look here https://docs.ros.org/en/rolling/Tutorials/Tf2/Tf2-Main.html ;)

The problem is that your are not passing parameters correctly here. As you have added in your question, lookup_transform() takes following pararmeters:

    :param target_frame: Name of the frame to transform into.
    :param source_frame: Name of the input frame.
    :param time: The time at which to get the transform. (0 will get the latest) 
    :param timeout: (Optional) Time to wait for the ...

Here the first three (target frame, source frame, time at which to get the transform) are required and the last one is optional (timeout). In your code, you probably confused a timeout and time parameters. You have to pass a Time() to the time parameter and Duration() to the timeout parameter. Therefore, your lookup_transform() call should actually look like:

 timeToLookUp = rclpy.time.Time() # to acquire the last transform
 trans = self._tf_buffer.lookup_transform('odom', 'base_link', timeToLookUp, timeout=Duration(0))
timeout=Duration(seconds=0.0))

btw, if you are interested in some code examples or advanced concept on tf2, you can look here https://docs.ros.org/en/rolling/Tutorials/Tf2/Tf2-Main.html ;)