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

Why do we need to Install a node Executable

asked 2018-11-02 09:59:28 -0500

tonyParker gravatar image

Hello,

I am newbie in ROS and CMake (catkin) thing. I have a cmake, in which a node is added as executable:

add_executable(${PROJECT_NAME}_node src/implementation.cpp src/NodeName2_node.cpp)

So, I can run this node from launch file of other projects.

Later in Cmake, he also installed that executable by following statements:

install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

I did not understand why he needed to install those executable. Can someone please explain this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-11-02 12:40:26 -0500

The first line you mentioned tells the build system that a c++ executable needs to be compiled and linked. If this binary is built okay it will exists in the development part of the package. This is all you need if you're making your own nodes and sharing your source code with others.

However if you want to share your compiled work with others you'll need to create an install folder with everything they will need to run your code but not your source code. This is what is being defined by the second set of lines. You only need this section if you're going to share your package but keep the source code private or produce your own debian packages for apt-get etc.

Hope this helps clear this up.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-02 09:59:28 -0500

Seen: 188 times

Last updated: Nov 02 '18