Create simple ROS package

There is two ways to create and maintain packages in ROS – catkin and rosbuild. This article is based on “rosbuild” variant of the tutorial Creating a ROS Package.

Create a folder for own ROS-packages in the home-folder

Open the Terminal window (hit Ctrl+Alt+T). Change the current folder to the home-folder

cd ~/

hint How to find out how to use specific commands

Run the command “man” (from “manual”) with a name of the command as a parameter to get a manual

man cd

Hit the key “Q” to exit from the manual

Create a folder “ros-sandbox” for own ROS-packages – name can be different

mkdir ros-sandbox

hint How to see content of a folder

Command “ls” displays content of the current folder. Command “ls” with folder name or path as a parameter displays the content of specified folder

ls /opt/ros/hydro

UbuntuFolderContentROS

Option “-a” displays names started with . (“dot”) which are normally hidden from the command “ls”

ls -a /opt/ros/hydro

UbuntuFolderContentROSWithHiddenNames

Change the current folder to the created folder

cd ros-sandbox

hint How to easy operate with folder and file names in command-line

When the typing command need a name of the folder or a file – start typing the beginning of the name than hit the Tab key – if there is only one folder or file with name starting with these letters – this name will be completed in the command-line. For the command above type

cd ros

and hit the Tab key – this command will be completed withros-sandbox” folder name.

Create ROS package

Create a ROS-package “example1” with dependencies to common ROS packages: std_msgs (messaging),  rospy (support of Python language) and roscpp (support of C++ language)

roscreate-pkg example1 std_msgs rospy roscpp

ROSCreatePkgExample1

A new folder is created in the current folder – check this with a command “ls” and then its content with a command “ls example1/”

ROSDisplayContentPkgExample1

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail