ROS compile script for Eclipse IDE

Compiling ROS nodes needs the ROS environment. We have to source /opt/ros/indigo/setup.bash to access the ROS environment in the current terminal. We can work from the system terminal because we already added this line to the .bashrc file, but when we work using Eclipse, we have to make a script to do this.

Create a file called eclipsemake in /usr/local/bin using the following command:

    $ sudo nano /usr/local/bin/eclipsemake
  

Enter the following commands in this file:

    #!/bin/bash
    
    source /opt/ros/indigo/setup.bash
    
    make "$@" VERBOSE=1 -j8
  
Figure 4: Script to source the ROS environment

Create another file called eclipsemake-tests for testing the purpose on the same path. Create a file using the following command:

    $ sudo nano /usr/local/bin/eclipsemake-tests
  

Enter the following content into the file:

    #!/bin/bash
    
    source /opt/ros/indigo/setup.bash
    
    make "$@" VERBOSE=1 -j8 run_tests
  
Figure 5: Script to source the ROS environment and running test

If you are using Eclipse in Virtual Box, use -j1 instead of -j8.

After creating these two files, change the permission of these two using the following command:

    $ sudo chmod +x /usr/local/bin/eclipsemake*
  
..................Content has been hidden....................

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