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

It's not well, documented, but the roslaunch.core.Node class supports all the same parameters that the rosrun and 'roslaunch' commands support.

So, if you were to launch a node with:

rosrun mypackage mynode.py _param1:=123 _param2:=abc

you could do the same thing from Python with:

import roslaunch

node = roslaunch.core.Node(
    package='mypackage',
    node_type='mynode.py',
    name='mynode',
    args='_param1:=123 _param2:=abc',
    output='screen')
launch = roslaunch.scriptapi.ROSLaunch()
launch.start()
process = launch.launch(node)
# do stuff
process.stop()