Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Beginner Tutorial Procedure

Putting together the initial bit:

1. Install ROS

follow instructions on wiki ROS tutorial.

2. Create WorkSpace

mkdir -p ~/catkin_ws/src creates src folder inside workspace folder

cd ~/catkin_ws/src change directory to src folder

catkin_init_workspace creates symlink (not sure what this is). creates SMakeLists in src folder

cd ~/catkin_ws/ change directory to workspace folder

source opt/ros/indigo/setup.bash black magic

catkin_make always exectue command in the workspace folder. creates build folder and devel folder with files inside

source devel/setup.bash black magic

echo "source ~/catkin_ws/devel/setup.bash" >> ¬/.bashrc black magic

3. Create Package

cd ~/catkin_ws/src change directory to src folder, where package folder must be created

catkin_create_pkg my_pkg roscpp name the package and specify dependency. this creates the package folder. inside it, include folder, src folder, CMakeLists file and package file are created

4. Add the code

add code inside the src folder inside the package folder. save as hello.cpp

#include <ros/ros.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "hello_ros");
  ros::NodeHandle nh;
  ROS_INFO_STREAM("Hello, ROS!");
}

5. Fix the CMakeLists inside the package folder

cmake_minimum_required(VERSION 2.8.3) 
project(book_pkg)

find_package(catkin REQUIRED COMPONENTS   roscpp  )    

catkin_package( )

include_directories( include  ${catkin_INCLUDE_DIRS})

add_executable(hello src/hello.cpp) 
target_link_libraries(hello ${catkin_LIBRARIES})

6. Build and run (run the package that is)

cd ~/catkin_ws back to workspace folder

catkin_make catkin specific command to build and make package

once build is successful, open new terminal, type: roscore open another terminal, type: rosrun my_pkg hello

Beginner Tutorial Procedure

Putting together the initial bit:

1. Install ROS

follow instructions on wiki ROS tutorial.

2. Create WorkSpace

mkdir -p ~/catkin_ws/src creates src folder inside workspace folder

cd ~/catkin_ws/src change directory to src folder

catkin_init_workspace creates symlink (not sure what this is). creates SMakeLists in src folder

cd ~/catkin_ws/ change directory to workspace folder

source opt/ros/indigo/setup.bash black magic

catkin_make always exectue command in the workspace folder. creates build folder and devel folder with files inside

source devel/setup.bash black magic

echo "source ~/catkin_ws/devel/setup.bash" >> ¬/.bashrc~/.bashrc black magic

3. Create Package

cd ~/catkin_ws/src change directory to src folder, where package folder must be created

catkin_create_pkg my_pkg roscpp name the package and specify dependency. this creates the package folder. inside it, include folder, src folder, CMakeLists file and package file are created

4. Add the code

add code inside the src folder inside the package folder. save as hello.cpp

#include <ros/ros.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "hello_ros");
  ros::NodeHandle nh;
  ROS_INFO_STREAM("Hello, ROS!");
}

5. Fix the CMakeLists inside the package folder

cmake_minimum_required(VERSION 2.8.3) 
project(book_pkg)

find_package(catkin REQUIRED COMPONENTS   roscpp  )    

catkin_package( )

include_directories( include  ${catkin_INCLUDE_DIRS})

add_executable(hello src/hello.cpp) 
target_link_libraries(hello ${catkin_LIBRARIES})

6. Build and run (run the package that is)

cd ~/catkin_ws back to workspace folder

catkin_make catkin specific command to build and make package

once build is successful, open new terminal, type: roscore open another terminal, type: rosrun my_pkg hello

click to hide/show revision 3
None

Beginner Tutorial Procedure

If possible I'd like for experienced users to post their suggestions whether this is the correct way, and explain the commands commented as 'black magic' please.

Putting together the initial bit:

1. Install ROS

follow instructions on wiki ROS tutorial.

2. Create WorkSpace

mkdir -p ~/catkin_ws/src creates src folder inside workspace folder

cd ~/catkin_ws/src change directory to src folder

catkin_init_workspace creates symlink (not sure what this is). creates SMakeLists in src folder

cd ~/catkin_ws/ change directory to workspace folder

source opt/ros/indigo/setup.bash black magic

catkin_make always exectue command in the workspace folder. creates build folder and devel folder with files inside

source devel/setup.bash black magic

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc black magic

3. Create Package

cd ~/catkin_ws/src change directory to src folder, where package folder must be created

catkin_create_pkg my_pkg roscpp name the package and specify dependency. this creates the package folder. inside it, include folder, src folder, CMakeLists file and package file are created

4. Add the code

add code inside the src folder inside the package folder. save as hello.cpp

#include <ros/ros.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "hello_ros");
  ros::NodeHandle nh;
  ROS_INFO_STREAM("Hello, ROS!");
}

5. Fix the CMakeLists inside the package folder

cmake_minimum_required(VERSION 2.8.3) 
project(book_pkg)

find_package(catkin REQUIRED COMPONENTS   roscpp  )    

catkin_package( )

include_directories( include  ${catkin_INCLUDE_DIRS})

add_executable(hello src/hello.cpp) 
target_link_libraries(hello ${catkin_LIBRARIES})

6. Build and run (run the package that is)

cd ~/catkin_ws back to workspace folder

catkin_make catkin specific command to build and make package

once build is successful, open new terminal, type: roscore open another terminal, type: rosrun my_pkg hello