Robotics StackExchange | Archived questions

Seeking clarity regarding the 'node' tag in launch files

I have added the following lines in the CMakeLists.txt file -

add_executable(abcd src/main.cpp)

target_link_libraries( abcd ${catkin_LIBRARIES} )

The node tag inside my launch file looks like this -

    <node pkg="my_explore_lite" type="explore_node" respawn="false" name="abcd_1" output="screen">       
...   
 </node>

As per my understanding, the value of type should be equal to abcd because that's what I have defined in the CMakeLists.txt. However, my launch file gets executed when I set the value of type to either abcd or explore_node.

What am I missing?

Asked by skpro19 on 2021-06-07 12:49:34 UTC

Comments

Did you previously build the node with the explore_node name (ie add_executable(explore_node src/main.cpp))? If so it still exists in your built executables even if you change the name in the CMakeLists.txt. Try deleting your build and devel folders, rebuild, and see if you can still launch with the explore_node name.

Asked by djchopp on 2021-06-07 14:20:33 UTC

Yes. I did previously use add_executable(explore_node src/main.cpp). Do you want me to delete the build folder inside my package (~/catkin_ws/src/my_explore_lite/build) or you do want me to delete the build and devel folders at the catkin workspace root(~/catkin_ws/build and ~/catkin_ws/devel)?

Asked by skpro19 on 2021-06-07 14:34:52 UTC

You should only have build and devel from catkin_make or catkin build in your workspace root. If the build folder in your package came from catkin, then you may have ran it in the wrong directory. If you are sure the build folder in your package came from catkin then delete it. Otherwise it may be part of a locally installed dependency and it should stay.

Asked by djchopp on 2021-06-07 14:40:46 UTC

Okay. Thanks!

Asked by skpro19 on 2021-06-07 14:44:06 UTC

Answers