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

Writing your own USB camera driver with OpenCV


Although we have the preceding two options, this book comes with its own USB camera driver, implemented on top of OpenCV, using the cv::VideoCapture class. It runs the camera and also allows changing some of its parameters as long as they are supported by the camera's firmware. It also allows us to set the calibration information in the same way as with the FireWire cameras. With usb_cam, this is not possible because the CameraInfo message is not available. With respect to gscam, we will have more control; we can change the camera configuration and also see how to publish the camera's images and information in ROS. In order to implement a camera driver using OpenCV, we have two options about how we read images from the camera. First, we can poll with a target Frames Per Second (FPS); secondly, we can set a timer for the period of such FPS and, in the timer callback, we perform the actual reading. Depending on the FPS, one solution may be better...