ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Sounds like you're looking for the ExecuteProcess
Launch action:
from launch import LaunchDescription
from launch.action import ExecuteProcess
def generate_launch_description():
return LaunchDescription([
ExecuteProcess(cmd=['ros2', 'topic', 'pub', '--once', /S0',
'std_msgs/msg/Float64, '{data: 1.5}']),
ExecuteProcess(cmd=['ros2', 'topic', 'pub', '--once', /S1',
'std_msgs/msg/Float64, '{data: 1.5}']),
])
Another example can be found in the launch examples: https://github.com/ros2/launch/blob/master/launch/examples/launch_counters.py#L112
2 | No.2 Revision |
Sounds like you're looking for the ExecuteProcess
Launch action:
from launch import LaunchDescription
from launch.action import ExecuteProcess
def generate_launch_description():
return LaunchDescription([
ExecuteProcess(cmd=['ros2', 'topic', 'pub', '--once', /S0',
'/S0',
'std_msgs/msg/Float64, 'std_msgs/msg/Float64', '{data: 1.5}']),
ExecuteProcess(cmd=['ros2', 'topic', 'pub', '--once', /S1',
'/S1',
'std_msgs/msg/Float64, 'std_msgs/msg/Float64', '{data: 1.5}']),
])
Another example can be found in the launch examples: https://github.com/ros2/launch/blob/master/launch/examples/launch_counters.py#L112