Adding run configurations to run ROS nodes in Eclipse

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:

Figure 12: Creating the launcher for the talker node

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 
Figure 13: Setting the ROS environment variable inside the launcher configuration

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:
Figure 14: Launching the talker node

We can see the output in the Eclipse console, as shown in the following screenshot:

Figure 15: Talker node running on the Eclipse terminal

In the next section, we will look at some of the best practices that should be followed when working with ROS.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.180.81