ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

serial numbers in a launch file.

asked 2013-03-19 13:59:45 -0500

packrat gravatar image

updated 2013-03-20 11:54:40 -0500

I am new to ros and I am trying to create a launch file to start two motor controllers, roscore, and some other nodes. I have two motor controllers that are identical except for their serial number. When using the terminal I would type (each in its own terminal),

rosrun pololu_smc_driver smc_driver_node __name:=r_controller _smc_serial:="3800-6F06-3055-3932-7560-0343"

rosrun pololu_smc_driver smc_driver_node __name:=l_controller _smc_serial:="3800-6B06-3055-3932-4160-0343"

Doing that would make two nodes, one named "r_controller" using the device with the serial number of" 3800-6F06-3055-3932-7560-0343" and the other node being "l_controller" with its serial number. How do I do that same thing in the launch file? What would that translate to?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-19 14:54:16 -0500

ahendrix gravatar image

updated 2013-03-20 13:45:55 -0500

In general, take a look at the XML spec for roslaunch files:

For your specific case, you'll want <node> tags that specify a name, and parameter tags for the serial numbers. Something like:

    <node pkg="pololu_smc_driver" type="smc_driver_node" name="r_controller">
        <param name="smc_serial" value="3800-6F06-3055-3932-7560-0343"/>

Along with a similar <node> tag for your left motor controller.

edit flag offensive delete link more


I tried " <launch> <node name="r_controller" pkg="pololu_smc_driver" type="smc_driver_node"/> <param name="smc_serial" value="3800-6F06-3055-3932-7560-0343"/> </node> </launch but when I tried to run it, it returns "Invalid roslaunch XML syntax: mismatched tag: line 5, column 3""

packrat gravatar image packrat  ( 2013-03-20 11:20:23 -0500 )edit

You're closing your <node> tag prematurely; don't do that. In particular, /> at the end of the tag specifies a self-closing tag, which is not what you want.

ahendrix gravatar image ahendrix  ( 2013-03-20 12:01:48 -0500 )edit

<launch> <node name="r_controller" pkg="pololu_smc_driver" type="smc_driver_node" <param name="smc_serial" value="3800-6F06-3055-3932-7560-0343" </node>
</launch> Invalid roslaunch XML syntax: not well-formed (invalid token): line 4, column 2

packrat gravatar image packrat  ( 2013-03-20 12:24:04 -0500 )edit

as you can tell, I have no clue what I am dong. I looked at "" but it did not help much. I am trying to start two nodes, one that uses a specific device with a serial number of"XX-XX"

packrat gravatar image packrat  ( 2013-03-20 12:31:46 -0500 )edit

Updated my example. I suggest you go read an XML tutorial to get a better grasp of how XML tags and nesting work:

ahendrix gravatar image ahendrix  ( 2013-03-20 13:52:00 -0500 )edit

Thank you so much. That works perfect. thanks for the link as well.

packrat gravatar image packrat  ( 2013-03-20 14:19:44 -0500 )edit

Question Tools


Asked: 2013-03-19 13:59:45 -0500

Seen: 1,274 times

Last updated: Mar 20 '13