diff --git a/asv_setup/launch/tf.launch.py b/asv_setup/launch/tf.launch.py new file mode 100644 index 00000000..452a59f2 --- /dev/null +++ b/asv_setup/launch/tf.launch.py @@ -0,0 +1,65 @@ +import math + +from launch import LaunchDescription +from launch_ros.actions import Node +from rclpy.qos import QoSProfile, QoSReliabilityPolicy, QoSDurabilityPolicy, QoSHistoryPolicy +from launch.actions import ExecuteProcess + + +def generate_launch_description(): + # command line arguments to get desired QoS settings + echo_tf_static = ExecuteProcess( + cmd=['ros2', 'topic', 'echo', '--qos-durability', 'transient_local', '--qos-reliability', 'reliable', '/tf_static'], + output='screen' + ) + + # base_link (NED) to base_link (SEU) tf. + tf_base_link_ned_to_base_link_seu = Node( + package='tf2_ros', + name='base_link_ned_to_base_link_seu', + executable='static_transform_publisher', + arguments=['--x' , '0', + '--y' , '0', + '--z' , '0', + '--roll' , '0', + '--pitch' , str(math.pi), + '--yaw' , '0', + '--frame-id' , 'base_link', + '--child-frame-id' , 'base_link_SEU'], + ) + + tf_base_link_to_lidar = Node( + package='tf2_ros', + name='base_link_to_lidar', + executable='static_transform_publisher', + arguments=['--x' , '-0.0145', + '--y' , '0', + '--z' , '-0.392425', + '--roll' , str(math.pi), + '--pitch' , '0', + '--yaw' , '0', + '--frame-id' , 'base_link', + '--child-frame-id' , 'os_lidar'], + ) + + # base_link to zed2i_camera_center tf. + tf_base_link_to_zed2_camera_center = Node( + package='tf2_ros', + name='base_link_to_zed2_camera_center', + executable='static_transform_publisher', + arguments=['--x' , '0.3005', + '--y' , '0', + '--z' , '-0.22036', + '--roll' , str(math.pi), + '--pitch' , '0', + '--yaw' , '0', + '--frame-id' , 'base_link', + '--child-frame-id' , 'zed2i_camera_center'], + ) + + return LaunchDescription([ + tf_base_link_ned_to_base_link_seu, + tf_base_link_to_lidar, + tf_base_link_to_zed2_camera_center, + echo_tf_static + ]) diff --git a/asv_setup/launch/tf.launch.yaml b/asv_setup/launch/tf.launch.yaml deleted file mode 100644 index 2da7b95f..00000000 --- a/asv_setup/launch/tf.launch.yaml +++ /dev/null @@ -1,12 +0,0 @@ -launch: - - node: - pkg: tf2_ros - exec: static_transform_publisher - name: base_link_to_lidar - args: --frame-id base_link --child-frame-id os_lidar --x -0.0145 --y 0 --z -0.392425 --roll 0 --pitch 0 --yaw 0 - - - node: - pkg: tf2_ros - exec: static_transform_publisher - name: base_link_to_zed2_camera_center - args: --frame-id base_link --child-frame-id zed2i_camera_center --x 0.3005 --y 0 --z -0.22036 --roll 0 --pitch 0 --yaw 0 \ No newline at end of file