Skip to content

AIT-Assistive-Autonomous-Systems/launch_tf2_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS2 launch extensions to react to transform availability.

This is particularly useful for launching rviz together with nodes publishing dynamic /tf after long startup times.

example

This launch snippet runs rviz2 as soon as a transform between map and base_link is available.

from launch import LaunchDescription
from launch.actions import RegisterEventHandler
from launch.event_handlers import event_named
from launch.event_handler import EventHandler
from launch_ros.actions import Node
from launch_tf2_ros.actions import TransformListener
from launch_tf2_ros.events import TimeOut, OnTransformAvailable

def generate_launch_description():
    return LaunchDescription([
        ...
        TransformListener(target_frame='base_link',
                          source_frame='map',
                          timeout=10.0),
        RegisterEventHandler(
            EventHandler(matcher=event_named(OnTransformAvailable.name),
                         entities=[Node(package='rviz2', executable='rviz2')])),
        RegisterEventHandler(
            EventHandler(matcher=event_named(TimeOut.name),
                         entities=[Shutdown(reason='transforms timeout')])),
    ])

About

Launch extensions to react to tf2 events

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages