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

You can achieve what you want with passing points as string of arrays to the launch file.

For roslaunch args, see reference

My approach would be something like this:

$ roslaunch render_points array.launch points:="[11, 12, 13], [21, 22, 23], [31, 32, 33], [41, 42, 43]"

list_points.py

#!/usr/bin/env python

import rospy

if __name__=="__main__":
    rospy.init_node("list_points")
    points = rospy.get_param("~points", None)
    points = [[int(x.strip(' ')) for x in ss.lstrip(' [,').split(', ')] for ss in points.rstrip(']').split(']')]
    print(points[0])

rospy.spin()

array.launch

<?xml version="1.0"?>
<launch>
    <arg name="points" doc="description for this arg"/>
    <node pkg="render_points" type="list_points.py" name="list_points" output="screen">
        <param name="points" value="$(arg points)"/>
    </node>
</launch>

You can achieve what you want with passing points as string of arrays to the launch file.

For roslaunch args, see reference

My approach would be something like this:

$ roslaunch render_points array.launch points:="[11, 12, 13], [21, 22, 23], [31, 32, 33], [41, 42, 43]"

list_points.py

#!/usr/bin/env python

import rospy

if __name__=="__main__":
    rospy.init_node("list_points")
    points = rospy.get_param("~points", None)
    points = [[int(x.strip(' ')) for x in ss.lstrip(' [,').split(', ')] for ss in points.rstrip(']').split(']')]
    print(points[0])

rospy.spin()

array.launchrenderer.launch

<?xml version="1.0"?>
<launch>
    <arg name="points" doc="description for this arg"/>
    <node pkg="render_points" type="list_points.py" name="list_points" output="screen">
        <param name="points" value="$(arg points)"/>
    </node>
</launch>

You can achieve what you want with passing points as string of arrays to the launch file.

For roslaunch args, see reference

My approach would be something like this:

$ roslaunch render_points array.launch points:="[11, 12, 13], [21, 22, 23], [31, 32, 33], [41, 42, 43]"

list_points.py

#!/usr/bin/env python

import rospy

if __name__=="__main__":
    rospy.init_node("list_points")
    points = rospy.get_param("~points", None)
    points = [[int(x.strip(' ')) for x in ss.lstrip(' [,').split(', ')] for ss in points.rstrip(']').split(']')]
    print(points[0])

rospy.spin()

renderer.launch

<?xml version="1.0"?>
<launch>
    <arg name="points" doc="description for this arg"/>
    <node pkg="render_points" type="list_points.py" name="list_points" output="screen">
        <param name="points" value="$(arg points)"/>
    </node>
</launch>