This sample program is a ROS (Robot Operating System) package. It creates a ROS Node which fetches the point cloud data coming from the camera sensor and stores it into the vector of Point Clouds, using ROS Kinetic and Point Cloud Library (PCL).
Note: In this project, catkin_make
build system has been used which under the hood uses cmake
& make
http://wiki.ros.org/catkin/commands/catkin_make
- Ubuntu 16.04 LTS - Xenial Xerus
1. Install Ubuntu 16.04 in your computer/laptop: https://ubuntu.com/tutorials/tutorial-install-ubuntu-desktop-1604#1-overview
2. Install ROS Kinetic ( this would take time!! ): [visit http://wiki.ros.org/kinetic/Installation/Ubuntu for more details]
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
$ sudo apt-get update
$ sudo apt-get install ros-kinetic-desktop-full
3. Environment Setup: [visit http://wiki.ros.org/kinetic/Installation/Ubuntu for more details ]
$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
$ sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
$ sudo apt install python-rosdep
$ sudo rosdep init
$ rosdep update
$ source /opt/ros/kinetic/setup.bash
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
$ cd ~/catkin_ws/src
$ git clone https://github.com/milan-r-shah/point_cloud_processing.git
$ cd ~/catkin_ws
$ catkin_make
$ source devel/setup.bash
$ roslaunch point_cloud_processing point_cloud_processing_node
.~/catkin_ws/src/point_cloud_processing
|
├── config
│ └── point_cloud_processing.yaml # config file
├── data # Directory for storing data
│ └── usage.txt
├── include
│ └── point_cloud_processing
│ └── point_cloud_processing.hpp # header file - class declaration
├── launch
│ └── point_cloud_processing.launch # launch file
├── src
│ ├── point_cloud_processing.cpp # source file - class definition
│ └── point_cloud_processing_node.cpp # contains main()
├── CMakeLists.txt # compiler instructions
├── package.xml # ROS Package Info
└── README.md # README
-
./package.xml
:
Contains the information of this ROS package -
./CMakeList.txt
:
Contains the compiler instructions for compiling this ROS package -
./launch/point_cloud_processing.launch
:
Kind of XML file which contains instruction for launching this ROS node -
./include/point_cloud_processing/point_cloud_processing.hpp
:
Contains the declaration ofPointCloudProcessing
class, member variables, & methods -
./src/point_cloud_processing.cpp
:
Contains the definition ofPointCloudProcessing
class, member variables, & methods -
./src/point_cloud_processing_node.cpp
:
Contains main() where the ROS node, namednode
, i.e. an Object ofPointCloudProcessing
class is instantiated, frequency at which the data would be processed is mentioned
-
PointCloudProcessing
class haspublic
constructor, destructor, & class methodrunOnce()
which have been declared in./include/point_cloud_processing/point_cloud_processing.hpp
-
PointCloudProcessing
class has differentprivate
methods as well as data members -
In
./src/point_cloud_processing_node.cpp
, first of all, name of the ROS node is initialized (Line No. 5); ROS NodeHandles are defined; and then an instance of classPointCloudProcessing
is created: namednode
-
In
./src/point_cloud_processing_node.cpp
, there isnode.runOnce()
in thewhile
loop which just displays "from runOnce()". The main magic happens byros::spinOnce()
which executes callbacks and releases the data from the camera sensor.rate.sleep()
generates delay. -
In
./src/point_cloud_processing.cpp
, in the constructor, ROS Subscriber is initialized & so does some flag variables. -
In
./src/point_cloud_processing.cpp
, callback function for the ROS Subscriber is also defined.
-
Loops, Fnction, I/O: The project demonstrates an understanding of C++ functions and control structures.
Line No. 13 in./src/point_cloud_processing_node.cpp
:while
loop -
Loops, Fnction, I/O: The project reads data from a file and process the data, or the program writes data to a file.
Line No. 10 in./src/point_cloud_processing.cpp
: reading data from external ROS Topic -
Loops, Functions, I/O: The project accepts user input and processes the input. Line No. 3 & 4 in
./launch/point_cloud_processing.launch
-
OOP: The project uses Object Oriented Programming techniques.
Line No. 15 in./include/point_cloud_processing/point_cloud_processing.hpp
: classPointCloudProcessing
-
OOP: Classes use appropriate access specifiers for class members.
Line No. 17 & Line No. 22 in./include/point_cloud_processing/point_cloud_processing.hpp
-
OOP: Class constructors utilize member initialization lists.
Line No. 10 & Line No. 13 in./src/point_cloud_processing.cpp
-
OOP: Classes encapsulate behavior.
Line No. 10 & Line No. 27 in./src/point_cloud_processing.cpp