Ask Your Question
3

How launch a python script with roslaunch

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

mohsen1989m gravatar image

Hello there,

I am trying to launch a script called mtnode.py 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="mtnode.py" type="mtnode.py" output="screen">
        <param name="frame_id" value="base_link" />
  </node>

and this is the warning and error form the roslaunch:

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

and the error:

ERROR: cannot launch node of type [xsens_drive/mtnode.py]: 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

1 Answer

Sort by ยป oldest newest most voted
5

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

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

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

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

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

Comments

2

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

mohsen1989m gravatar imagemohsen1989m ( 2016-04-07 08:08:20 -0500 )edit
2

This was useful, Thankyou !

Haresh Karnan gravatar imageHaresh Karnan ( 2018-02-26 00:09:27 -0500 )edit
1

I did the same mistake, thank you!

meterix gravatar imagemeterix ( 2018-06-11 16:53:07 -0500 )edit

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

Avio gravatar imageAvio ( 2018-06-29 11:05:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 20,067 times

Last updated: Mar 22 '16