1. Install related software packages
install uvc camera
sudo apt-get install ros-kinetic-uvc-camera
Install image-related feature packages
sudo apt-get install ros-kinetic-image-*
sudo apt-get install ros-kinetic-rqt-image-view
Remember to replace kinetic with your own ros version.
2. Start ros and call the camera
- Start ros in terminal 1
roscore
- Run the uvc_camera node in terminal 2, and the computer camera starts working
rosrun uvc_camera uvc_camera_node
- View topic messages in Terminal 3
rostopic list
- View the image's info in Terminal 3
rostopic echo /camera_info
- Open rviz to complete the relevant configuration
rosrun rviz rviz
Click "Add" in the lower left corner --> click "By display type" --> click "image" --> click "ok"
Change the parameter of "Image Topic " under "Image" in the left column to " /image_raw "
After configuration, you will find that the image captured by the camera appears in the lower left corner of rviz interface