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

Roslaunch and <node> type

asked 2013-01-17 08:45:38 -0500

MartinW gravatar image

updated 2013-01-17 10:48:41 -0500

damjan gravatar image

Hello all,

I am trying to augment a roslaunch code from my robot's manufacturer. They have sent me this launch file:

<launch> <group ns="drrobot_player1">
<rosparam file="$(find drrobot_jaguar4x4_player)/drrobotplayer_I90_Motion.yaml" command="load"/>
<node pkg="drrobot_jaguar4x4_player" name="drrobot_player" type="drrobot_player" output="screen"/>
<node pkg="drrobot_jaguar4x4_player" name="drrobotMsgTester" type="drrobotMsgTester" output="screen"/>   </group> </launch>

Essentially one of the nodes publishes the motor info (drrobot_player) and the other node subscribes and output the info (drrobotMsgTester)

I would like to make my own node where I can publish other information, so I made a new .cpp file, added it to my CMakeLists.txt and successfully made with rosmake. Now when I change the launch file to use my node instead:

<launch> <group ns="drrobot_player1">
<rosparam file="$(find drrobot_jaguar4x4_player)/drrobotplayer_I90_Motion.yaml" command="load"/>
<node pkg="drrobot_jaguar4x4_player" name="H20_player" type="H20_player" output="screen"/>
<node pkg="drrobot_jaguar4x4_player" name="drrobotMsgTester" type="drrobotMsgTester" output="screen"/>   </group> </launch>

I get an error:

ERROR: cannot launch node of type [drrobot_jaguar4x4_player/H20_player]: can't locate node [H20_player] in package [drrobot_jaguar4x4_player]

Does anyone know what I am doing wrong? The manufacturers code also has a folder called drrobot_player so I think it has something to do with this. Here is a picture of the folder structure in the src folder of the ros package.

Many thanks in advance to anyone who can help me figure this out :)

Kind Regards, Martin

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-01-17 23:40:02 -0500

damjan gravatar image

I am guessing that your parameters file is expecting the node to be called "drrobot_player". You can check this by doing a search for "drrobot_player" in your .yaml file.

edit flag offensive delete link more
1

answered 2013-01-17 10:52:22 -0500

damjan gravatar image

Have you tried:

$ roscd drrobot_jaguar4x4_player
$ make

You should see the executable of your node (which should be called H20_player) in the bin folder.

edit flag offensive delete link more

Comments

Yes I do see the executable but when I try to launch my file it runs but defaults all settings and doesn't even load my parameters from my .yaml file. Should the name=" " and type=" " be the same thing in the launch file? It looks like most of the time this is the case but sometimes it's not

MartinW gravatar image MartinW  ( 2013-01-17 11:18:36 -0500 )edit

The console output right before it shows all the parameters is:Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored

MartinW gravatar image MartinW  ( 2013-01-17 11:19:31 -0500 )edit

The console output right before it shows all the parameters is:Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored

MartinW gravatar image MartinW  ( 2013-01-17 11:19:35 -0500 )edit

For some reason, the launch file requires me to have the name="drrobot_player" but type="H20_player" will run my parameters and H20_player.cpp file. I guess it works now, but I am unsure why exactly. Do you have any ideas why this is the case?

MartinW gravatar image MartinW  ( 2013-01-17 11:25:29 -0500 )edit
1

The "Exception AttributeError" is an internal Python bug that can be safely ignored.

In your .launch file, the node "type" must correspond to the executable name, the "name" attribute can in principle be anything. For details, see here.

damjan gravatar image damjan  ( 2013-01-17 23:36:14 -0500 )edit
1

Ahh! That makes sense, so the .yaml file can load parameters for more than one node. I checked the .yaml file and it has drrobot_player: { stuff } right at the top. Thank you, this clears things up for me

MartinW gravatar image MartinW  ( 2013-01-18 06:47:37 -0500 )edit

Question Tools

Stats

Asked: 2013-01-17 08:45:38 -0500

Seen: 2,697 times

Last updated: Jan 17 '13