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

How launch a python script with roslaunch

asked 2016-03-22 04:45:14 -0600

mohsen1989m gravatar image

Hello there,

I am trying to launch a script called from a package called xsens_drive. When I use rosrun it works perfectly, however i have difficulty to launch it with roslaunch. This is the syntax that I use:

  <node pkg="xsens_drive" name="" type="" output="screen">
        <param name="frame_id" value="base_link" />

and this is the warning and error form the roslaunch:

WARNING: WARN: illegal <node> name ''.
This will likely cause problems with other ROS tools.
Node xml is <node name="" output="screen" pkg="xsens_drive" type="">
        <param name="frame_id" value="base_link"/>

and the error:

ERROR: cannot launch node of type [xsens_drive/]: xsens_drive
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/sherpa/catkin_ws/src
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks

I tried different combination of name and type without .py with no luck, I am using ros indigo

Thanks in advance

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2016-03-22 04:54:20 -0600

gvdhoorn gravatar image
<node pkg="xsens_drive" name="" type="" output="screen">

I think the package is actually called xsens_driver, so the following should work:

<node pkg="xsens_driver" name="mtnode" type="" output="screen"> 

The type for a Python script is always just the script itself. The name can be anything, but must follow the ROS naming conventions.

edit flag offensive delete link more



Thanks, yep that was a stupid mistake of mine...

mohsen1989m gravatar image mohsen1989m  ( 2016-04-07 08:08:20 -0600 )edit

This was useful, Thankyou !

Haresh Karnan gravatar image Haresh Karnan  ( 2018-02-26 00:09:27 -0600 )edit

I did the same mistake, thank you!

meterix gravatar image meterix  ( 2018-06-11 16:53:07 -0600 )edit

In my case (Kinetic), the node name was not sufficient, I had to specify

Avio gravatar image Avio  ( 2018-06-29 11:05:58 -0600 )edit

answered 2020-08-09 02:22:24 -0600

Sanjuna Mariam Mathews gravatar image

Make the python script executable chmod +x

So give pkg= "name of package where script lies" name ="name of python script without extension" type="name of python scrupt with extension"

Example : <node pkg="v1robot_description" name="fake_encoder_count" type="" output="screen"/>

Name of python script in my case: Name of my ROS package : v1robot_description

edit flag offensive delete link more

answered 2020-01-09 02:01:11 -0600

Rufus gravatar image

updated 2020-01-09 02:01:25 -0600

Additionally, make sure that the python script is executable (has execute bit set to 1), i.e. can be run with ./

edit flag offensive delete link more

answered 2021-08-07 04:54:42 -0600

Yash Sahu gravatar image

As, @Rufus mentioned above make sure the file is executable. You can to do that with below command: $ chmod +x

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-03-22 04:45:14 -0600

Seen: 55,460 times

Last updated: Aug 07 '21