After building the project, we may can run the node from Eclipse or from a terminal. For running the node inside Eclipse, right-click on the project and go to Run as | Run Configurations.
Create a New Launch Configuration under C/C++ Application. In the Main tab, browse the executable path in C/C++ Application. While we build the nodes in Eclipse, we can see the executable generating path. Browse the path of the executables here.
Here we are creating a launcher for the talker node, as shown in the following screenshot:
After the preceding settings, click on the Environment tab and insert two variables:
ROS_MASTER_URI : http://localhost:11311 ROS_ROOT : /opt/ros/indigo/share/ros
After doing these setting, we can run the talker node by performing the following steps:
- Start roscore in one terminal.
- Start the talker node by pressing the Run key on the Eclipse, as shown in the following screenshot:
We can see the output in the Eclipse console, as shown in the following screenshot:
In the next section, we will look at some of the best practices that should be followed when working with ROS.