4. Launch file for the tf_listener
```python
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time', default='true')
package_name='your_name'
your_node = Node(
package= package_name,
namespace= 'your_namespace',
executable= 'your_executable',
name= package_name,
parameters=[
{'use_sim_time': use_sim_time},
{'image_topic': '/camera/image'},
{'camera_info': '/camera/camera_info'},
{'lidar_topic': '/sensor_scan'},
{'camera_frame':'camera'},
{'lidar_frame': 'sensor_at_scan'},
],
emulate_tty=True
)
return LaunchDescription([your_node])
On ROS2 docker terminal: ros2 run tf2_ros tf2_echo <reference_frame> <target_frame>
You will see it cannot find the frame first, and then it finds the frame with a completely different timestamp.
In the meantime, the tf_listener is showing:
which means even though I use self.get_clock.now() (it is the sim_time) in the lookup_transform() function, it still cannot find the frame.
Expected behavior
Find the frame and get the TF correctly
Actual behavior
As described in the "Steps to reproduce issue" part
Bug report
Required Info:
Steps to reproduce issue
use_sim_time
to be "true" in that simulatorroslaunch vehicle_simulator system_campus.launch
Set up tf_listener in ROS2
ros2 run tf2_ros tf2_echo <reference_frame> <target_frame>
You will see it cannot find the frame first, and then it finds the frame with a completely different timestamp.self.get_clock.now()
(it is the sim_time) in thelookup_transform()
function, it still cannot find the frame.Expected behavior
Find the frame and get the TF correctly
Actual behavior
As described in the "Steps to reproduce issue" part
Additional information
NAN