|
|
# General
|
|
|
|
|
|
## Installation of Raspberry Pi Camera V2
|
|
|
|
|
|
This is a brief overview about what must be done before using the Easpberry Pi Camera V2 with a Raspberry Pi 4 and Ubuntu 20.04.
|
|
|
|
|
|
1. Navigate to the file boot/firmware/config.txt and add OR edit at the end of the file `start_x=1`. This says ubuntu to include the Camara via the specific Hardware Port.
|
|
|
|
|
|
2. Test the camera with installing and then using e.g.
|
|
|
|
|
|
`sudo raspistill -o Desktop/image3.jpg`
|
|
|
|
|
|
Referring to https://larrylisky.com/2016/11/24/enabling-raspberry-pi-camera-v2-under-ubuntu-mate/ . Unfortunately, RasPi Config can't be installed on 20.04 (?)
|
|
|
|
|
|
3. Read module at https://gitlab.com/boldhearts/ros2_v4l2_camera, run nodes with (**the raw image and compressed image should work**!)
|
|
|
|
|
|
`ros2 run v4l2_camera v4l2_camera_node`
|
|
|
|
|
|
4. To view the image data simply check topics
|
|
|
|
|
|
`ros2 topic list`
|
|
|
|
|
|
and run
|
|
|
|
|
|
`ros2 topic echo /image_raw`
|
|
|
|
|
|
or use the ros2 viewer
|
|
|
|
|
|
`ros2 run rqt_image_view rqt_image_view`
|
|
|
|
|
|
5. If something does not work, add https://github.com/ros-perception/image_common/tree/ros2 and https://github.com/ros-perception/image_transport_plugins/tree/ros2 to your ros workspace with adding to source and build.
|
|
|
|
|
|
Instruction in src folder:
|
|
|
|
|
|
`git clone -b ros2 <Git_Link>`
|
|
|
|
|
|
Don't forget as always in workspace after doing changes:
|
|
|
|
|
|
`colcon build`
|
|
|
|
|
|
`. install/setup.bash`
|
|
|
|
|
|
|
|
|
## Further Notes
|
|
|
|
|
|
This is the message type, which could be seen with `ros2 topic info /image_raw`
|
|
|
http://docs.ros.org/en/api/sensor_msgs/html/msg/Image.html
|
|
|
|
|
|
This page is useful for seeing available formats and some specs of the camera: https://electrodrome.net/2496
|
|
|
|
|
|
## Changing Parameters
|
|
|
|
|
|
One must be careful changing parameters for the camera, this is basically try and error. To see parameters as soon as v4l2_camera_node is running, enter `ros2 param list`. To set an array of pixel value output e.g. use `ros2 param set /v4l2_camera image_size "[1024, 768]"`
|
|
|
|
|
|
For workaround, one could also navigate into the src folder of v4l2_camera package and change the default values in v4l2_camera.cpp
|
|
|
|
|
|
# Camera Calibration
|
|
|
|
|
|
This must be done, when some camera parameters are changed or in general a new calibration file should be created.
|
|
|
|
|
|
Run through the following example (with one exception below):
|
|
|
https://navigation.ros.org/tutorials/docs/camera_calibration.html
|
|
|
|
|
|
With a 10x7 chessboard which is attached (don't get confused, need to state inner corners in argument) run instead for the calibration **with your square size** (mine were 25 mm, dependent on printer and file):
|
|
|
|
|
|
[camera-calibration-checker-board_9x7.pdf](uploads/f8fdffcc5d22a7d4e18c8148922288c0/camera-calibration-checker-board_9x7.pdf)
|
|
|
|
|
|
```bash
|
|
|
ros2 run camera_calibration cameracalibrator --size 6x9 --square 0.025 --no-service-check --ros-args --remap image:=/image_raw
|
|
|
```
|
|
|
|
|
|
Then a window should pop out, and the calibration starts, as soon as the chessboard is detected. **Please note, good light conditions are needed**.
|
|
|
|
|
|
This calibration procedure lead to the calibration file example_calibration.yaml which is currently under use.
|
|
|
|
|
|
**Careful**: If you want to use another resolution, make sure to redo the calibration and create a calibration file with the corresponding resolution! The first two parameters in the calibration file must fit to the chosen resolution size in the v4l2_camera package.
|
|
|
|
|
|
https://github.com/UbiquityRobotics/raspicam_node/blob/kinetic/camera_info/camerav2_1280x960.yaml --> Corresponds to example_calibration2.yml (If someone want to try out).
|
|
|
|
|
|
Rename the default camera calibration file path if wanted in camera_info_manager.cpp of the image_common package. |
|
|
\ No newline at end of file |