Book Image

Learning ROS for Robotics Programming Second Edition

Book Image

Learning ROS for Robotics Programming Second Edition

Overview of this book

Table of Contents (27 chapters)
Learning ROS for Robotics Programming Second Edition
Credits
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Reviewer
About the Reviewer
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

My first PCL program


In this section, you will learn how to integrate PCL and ROS. Knowledge and understanding of how ROS packages are laid out and how to compile are required although the steps will be repeated for simplicity. The example used in this first PCL program has no use whatsoever other than serving as a valid ROS node, which will successfully compile.

The first step is to create the ROS package for this entire chapter in your workspace. This package will depend on the pcl_conversions, pcl_ros, pcl_msgs, and sensor_msgs packages:

$ catkin_create_pkg chapter6_tutorials pcl_conversions pcl_ros pcl_msgs sensor_msgs

The next step is to create the source directory in the package using the following commands:

$ rospack profile
$ roscd  chapter6_tutorials
$ mkdir src

In this new source directory, you should create a file called pcl_sample.cpp with the following code, which creates a ROS node and publishes a point cloud with 100 elements. Again, what the code does should not really be...