User Tools

Site Tools


Netbeans and ROS

After fighting with both ROS and NetBeans to make them work together seamlessly, I've decided that creating a custom Makefile to help them work together is the best approach. Note that the root folder used for development is termed differently in the ROS and Netbeans world. In ROS they call this the “workspace” directory and in NetBeans they call this the “Project” directory. I use these terms interchangeably below due to this terminological redundancy.

Here's the contents of the Makefile. Note: I'm still working on it right now so there are several aspects of it that could use work and some comments included that reflect work-in-progress. You may need to modify the Makefile. In particular, make sure the ROS_ROOT folder is correct and that the development folders are appropriate for your workspace. The folder are specified as paths relative to the ROS/NetBeans Project root folder. The source, development, and install folders and are called SOURCE_DIRECTORY , CATKIN_DEVEL_PREFIX , and CMAKE_INSTALL_PREFIX respectively.

You can also turn on verbose building by un-commenting the line #CMAKE_VERBOSE_MAKEFILE=ON by removing the starting comment or # character.

# Contents of Makefile
# This Makefile is intended to allow one to develop ROS workspace C++ applications
# from the NetBeans Integrated Development Environment (IDE).
# Andrew Willis
# Senior NRC Research Associate
# July 1, 2015
# Some work to try and satisfy NetBeans LD_PRELOAD needs for ''
# "ERROR: object '' from LD_PRELOAD cannot 
# be preloaded (cannot open shared object file): ignored."
# LD_LIBRARY_PATH += ~/bin/netbeans-8.0.2/cnd/bin/Linux-x86_64/:~/bin/netbeans-8.0.2/cnd/bin/Linux-x86/
# The IDE use "interception" technology to configure code assistance. 
# You can turn off it in Project Properties->Code Assistance->Use Build 
# Analyzer (but it turns off a lot of "configuring code assistance" 
# functionality). 
# Another way to turn off interceptor (right unset) is unset 
# and DYLD_INSERT_LIBRARIES on Mac in your script (compare with half unset 
# in your script). 

# path to the ROOT folder of the ROS install

# catkin_make/cmake ENVIRONMENT VARIABLE PARAMETERS (prefix command line with -D${ENVVAR})



# catkin_make command line options
# to detect newly added packages in previously compiled workspace
#CATKIN_MAKE_FLAGS +=--force-cmake


# setup the ROS environment variables -- equivalent to running 'source ${ROS_ROOT}/'
IGNORE := $(shell bash -c "source ${ROS_ROOT}/; env | sed 's/=/:=/' | sed 's/^/export /' > Makefile.ros_env")
include Makefile.ros_env

#.PHONY : ros_setup ws_setup ws_overlay build devel install all clean

all : build devel
#all: build install
.PHONY : all
build :
	/opt/ros/indigo/bin/catkin_make ${CATKIN_MAKE_FLAGS}
	$(MAKE) -C build
.PHONY : build

devel : build
	cd build; \

install : build 
	$(MAKE) -C build install    # equivalent to catkin_make install from workspace directory
clean :
	rm -rf build ${CATKIN_DEVEL_PREFIX} ${CMAKE_INSTALL_PREFIX} Makefile.ros_env Makefile.build_env
	/opt/ros/indigo/bin/catkin_make clean

#ros_setup :
#	echo "Running target ros_setup"
#	IGNORE := $(shell bash -c "source ${ROS_ROOT}/; env | sed 's/=/:=/' | sed 's/^/export /' > Makefile.ros_env")
#        include Makefile.ros_env

# if src directory does not exist -> mkdir -p src
# if .catkin_workspace does not exist -> cd src; wstool init AND/OR catkin_init_workspace; cd ..
# invoke this to overlay the ROS packages of your workspace onto those from ROS_ROOT
#ws_overlay :
#	echo "Running target ws_overlay"
#	IGNORE := $(shell bash -c "source build/; env | sed 's/=/:=/' | sed 's/^/export /' > Makefile.build_env")
#        include Makefile.build_env

#	cd src; wstool set drivers/softkinetic --git
#	cd src; wstool set ${PACKAGE_REL_PATH} --git ${GIT_REPOSITORY_CLONE_URL}
#	cd src; wstool update

Once you've customized your Makefile to your wishes, create a project/workspace folder. For now you need to create the source folder and initialize the workspace as well. These are accomplished via the commands below:

mkdir proj1;
mkdir -p proj1/src # my Makefile contains the line SOURCE_DIRECTORY=src
cd proj1/src
wstool init # creates .rosinstall in the src folder
catkin_init_workspace # OPTIONAL -- creates .catkin_workspace in root folder --
cd ..

IMPORTANT Copy the contents of the Makefile above and paste them into a text file having the name Makefile and place it in the ROS workspace root folder.

Let's now import the existing Makefile to NetBeans and create an empty NetBeans project from the initialized ROS workspace.

  1. Start NetBeans
  2. Select File→New Project
  3. Select “C/C++” from “Categories” and “C/C++ Project with Existing Sources” from “Projects” and click “Next”.
  4. Use the “Browse” button to navigate to and select the folder of your overlaid ROS workspace directory and select this folder under the field “Specify the folder that contains your existing sources”.
  5. Select “Automatic” from the “Select Configuration Mode” radio button options.
  6. The Makefile in the directory should be automatically detected and allow you to select the “Finish” button to complete the creation of the NetBeans/ROS project. When you click “Finish” NetBeans will build the empty project which will result in output from the ROS build tools catkin_make and cmake that will be shown in the output window.

Let's now grab source code from a git repository and add it to the source folder.

cd src
wstool set drivers/softkinetic --git
wstool update
cd ..

The source will also be available in NetBeans within the “proj1” folder in the “Projects” window (typically in the upper left corner of the NetBeans interface window).

Importing and Using NetBeans support for the ROS coding style

We can follow the ROS code style guidelines in netbeans as discussed in the ROS IDE Wiki. Download the ROS code style formatting from

This enables auto formatting of C++ code in NetBeans as defined in CppStyleGuide. In order to use it, you should import it to Netbeans (Tools → Options → Import).

Once a ROS project is created in NetBeans enable the formatting by selecting the project in the project window then File→Project Properties→Formatting→Use project specific formatting style. Then select “ROS” from the “C++ Formatting Style” dropdown menu.

Viewing a BAG file

bash$ rqt_bag <filename.bag>

Setup a workspace

This sets up a ROS workspace in the ros_exp folder.

bash$ mkdir ros_exp
bash$ cd ros_exp
bash$ mkdir src
bash$ cd src
bash$ catkin_init_workspace
Creating symlink "/home.old/arwillis/NRC/git/ros_exp/src/CMakeLists.txt" pointing to "/opt/ros/indigo/share/catkin/cmake/toplevel.cmake"
bash$ cd ..
bash$ catkin_make
Base path: /home.old/arwillis/NRC/git/ros_integrate
Source space: /home.old/arwillis/NRC/git/ros_integrate/src
Build space: /home.old/arwillis/NRC/git/ros_integrate/build
Devel space: /home.old/arwillis/NRC/git/ros_integrate/devel
Install space: /home.old/arwillis/NRC/git/ros_integrate/install
Creating symlink "/home.old/arwillis/NRC/git/ros_integrate/src/CMakeLists.txt" pointing to "/opt/ros/indigo/share/catkin/cmake/toplevel.cmake"
#### Running command: "cmake /home.old/arwillis/NRC/git/ros_integrate/src -DCATKIN_DEVEL_PREFIX=/home.old/arwillis/NRC/git/ros_integrate/devel -DCMAKE_INSTALL_PREFIX=/home.old/arwillis/NRC/git/ros_integrate/install -G Unix Makefiles" in "/home.old/arwillis/NRC/git/ros_integrate/build"
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /home.old/arwillis/NRC/git/ros_integrate/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home.old/arwillis/NRC/git/ros_integrate/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.14
WARNING: Package "libg2o" does not follow the version conventions. It should not contain leading zeros (unless the number is 0).
-- Configuring done
-- Generating done
-- Build files have been written to: /home.old/arwillis/NRC/git/ros_integrate/build
#### Running command: "make -j4 -l4" in "/home.old/arwillis/NRC/git/ros_integrate/build"

Setting up a workspace to include/overlay multiple ROS packages

arwillis@visionlab16-pc:~/NRC/git$ mkdir ros_integrate
arwillis@visionlab16-pc:~/NRC/git$ cd ros_integrate/
arwillis@visionlab16-pc:~/NRC/git/ros_integrate$ mkdir src
arwillis@visionlab16-pc:~/NRC/git/ros_integrate$ cd src/
arwillis@visionlab16-pc:~/NRC/git/ros_integrate/src$ wstool init
Writing /home.old/arwillis/NRC/git/ros_integrate/src/.rosinstall

update complete.

This creates an initial “.rosinstall” file in your src folder, which will store the urls and versions of sources you download.

Now you can add a ros package from source to your src folder:

arwillis@visionlab16-pc:~/NRC/git/ros_integrate/src$ wstool set drivers/openni2_launch --git

     Add new elements:
  drivers/openni2_launch   	git   

Continue: (y)es, (n)o: y
Overwriting /home.old/arwillis/NRC/git/ros_integrate/src/.rosinstall
Config changed, remember to run 'wstool update drivers/openni2_launch' to update the folder from git
arwillis@visionlab16-pc:~/NRC/git/ros_integrate/src$ wstool update drivers/openni2_launch
[drivers/openni2_launch] Fetching (version None) to /home.old/arwillis/NRC/git/ros_integrate/src/drivers/openni2_launch
Cloning into '/home.old/arwillis/NRC/git/ros_integrate/src/drivers/openni2_launch'...
remote: Counting objects: 166, done.
remote: Total 166 (delta 0), reused 0 (delta 0), pack-reused 166
Receiving objects: 100% (166/166), 28.16 KiB | 0 bytes/s, done.
Resolving deltas: 100% (74/74), done.
Checking connectivity... done.
[drivers/openni2_launch] Done.

Netbeans for ROS on the Arm7

Everything worked well using the standard netbeans. Yet, I had to re-compile the terminal native programs to work on the Odroid which require arm “hard float” binaries. The re-compiled binaries which I am using for Netbeans 8.0.2 on Odroid are in the compressed file below.

The issue is mentioned here:

Compiling Native Terminal Support for Netbeans on the Arm7

My compile process required getting the netbeans source, copying the dlight.nativeexecution sub-folder to a jump drive. Copying the files onto my arm-based Odroid system and then running make in several folders under the “dlight.nativeexecution/tools” folder. The resulting binaries were then placed where netbeans requires them to be as described below.

The re-compiled binaries which I am using for Netbeans 8.0.2 on Odroid are in the compressed file below.

I've also included my terminal session to compile these binaries as a text file. To use these files one must place the binaries in the following folders/directories under the netbeans home directory:



The compiled files are here:


netbeans_ros_integration.txt · Last modified: 2015/09/03 10:11 by arwillis