Merge remote-tracking branch 'origin' into buster

This commit is contained in:
Alexey Rogachevskiy
2019-10-10 23:32:37 +03:00
4 changed files with 69 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
# Working with the camera
To work with the main camera, make sure it is enabled in file `~/catkin_ws/src/clever/clever/launch/clever.launch`:
Make sure the camera is enabled in the `~/catkin_ws/src/clever/clever/launch/clever.launch` file:
```xml
<arg name="main_camera" default="true"/>
```
Also make sure that [correct position and orientation are indicated] for the camera (camera_frame.md).
Also make sure that [position and orientation of the camera](camera_frame.md) is correct.
The `clever` package must be restarted after the launch-file has been edited:
@@ -14,11 +14,41 @@ The `clever` package must be restarted after the launch-file has been edited:
sudo systemctl restart clever
```
For monitoring images from the camera, you may use rqt or [web_video_server](web_video_server.md).
You may use rqt or [web_video_server](web_video_server.md) to view the camera stream.
## Troubleshooting
If the camera stream is missing, try using the [`raspistill`](https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md) utility to check whether the camera works.
First, stop the Clever service:
```bash
sudo systemctl stop clever
```
Then use `raspistill` to capture an image from the camera:
```bash
raspistill -o test-image.jpeg
```
If it doesn't work, check the camera cable connections and the cable itself. Replace the cable if it is damaged. Also, make sure the camera screws don't touch any components on the camera board.
## Camera parameters
Some camera parameters, such as image size, FPS cap, and exposure, may be configured in the `main_camera.launch` file. The list of supported parameters can be found [in the cv_camera repository](https://github.com/OTL/cv_camera#parameters).
Additionally you can specify an arbitrary capture parameter using its [OpenCV code](https://docs.opencv.org/3.3.1/d4/d15/group__videoio__flags__base.html). For example, add the following parameters to the camera node to set exposition manually:
```xml
<param name="property_0_code" value="21"/> <!-- property code 21 is CAP_PROP_AUTO_EXPOSURE -->
<param name="property_0_value" value="0.25"/> <!-- property values are normalized as per OpenCV specs, even for "menu" controls; 0.25 means "use manual exposure" -->
<param name="cv_cap_prop_exposure" value="0.3"> <!-- set exposure to 30% of maximum value -->
```
## Computer vision
For implementation of the computer vision algorithms, it is recommended to use the [OpenCV] library that is pre-installed in [the SD card image] (image.md) (https://opencv.org).
The [SD card image](image.md) comes with a preinstalled [OpenCV](https://opencv.org) library, which is commonly used for various comupter vision-related tasks. Additional libraries for converting from ROS messages to OpenCV images and back are preinstalled as well.
### Python
@@ -66,11 +96,11 @@ The obtained images can be viewed using [web_video_server](web_video_server.md).
To program actions of the copter upon detection of [QR codes](https://en.wikipedia.org/wiki/QR_code) you can use the [ZBar] library (http://zbar.sourceforge.net). It should be installed using pip:
```(bash)
```bash
sudo pip install zbar
```
Recognizing QR codes in Python:
QR codes recognition in Python:
```python
import cv2
@@ -100,7 +130,7 @@ def image_callback(data):
image_sub = rospy.Subscriber('main_camera/image_raw', Image, image_callback, queue_size=1)
```
The script will take up to 100% CPU capacity. To slow down the script artificially, you can run [throttling](http://wiki.ros.org/topic_tools/throttle) of frames from the camera, for example, at 5 Hz (`main_camera.launch`):
The script will take up to 100% CPU capacity. To slow down the script artificially, you can use [throttling](http://wiki.ros.org/topic_tools/throttle) of frames from the camera, for example, at 5 Hz (`main_camera.launch`):
```xml
<node pkg="topic_tools" name="cam_throttle" type="throttle"

View File

@@ -74,6 +74,7 @@
* [Светодиодная лента (legacy)](leds_old.md)
* [Вклад в Клевер](contributing.md)
* Мероприятия
* [CopterHack-2019](copterhack2019.md)
* [Олимпиада НТИ 2019](nti2019.md)
* [CopterHack-2018](copterhack2018.md)
* [CopterHack-2017](copterhack2017.md)

View File

@@ -36,6 +36,18 @@ raspistill -o test-image.jpg
Если команда завершается с ошибкой, проверьте качество подключения шлейфа камеры к Raspberry Pi или замените его.
## Настройки камеры
Ряд параметров камеры - размер изображения, максимальную частоту кадров, экспозицию - можно настроить в файле `main_camera.launch`. Список настраиваемых параметров можно [посмотреть в репозитории cv_camera](https://github.com/OTL/cv_camera#parameters).
Параметры, не указанные в этом списке, можно указывать через [код параметра OpenCV](https://docs.opencv.org/3.3.1/d4/d15/group__videoio__flags__base.html). Например, для установки фиксированной экспозиции добавьте следующие параметры в ноду камеры:
```xml
<param name="property_0_code" value="21"/> <!-- property code 21 is CAP_PROP_AUTO_EXPOSURE -->
<param name="property_0_value" value="0.25"/> <!-- property values are normalized as per OpenCV specs, even for "menu" controls; 0.25 means "use manual exposure" -->
<param name="cv_cap_prop_exposure" value="0.3"> <!-- set exposure to 30% of maximum value -->
```
## Компьютерное зрение
Для реализации алгоритмов компьютерного зрения рекомендуется использовать предустановленную на [образ SD-карты](image.md) библиотеку [OpenCV](https://opencv.org).

19
docs/ru/copterhack2019.md Normal file
View File

@@ -0,0 +1,19 @@
# Copter Hack 2019
Хакатон [Copter Hack 2018](https://copterexpress.timepad.ru/event/768108/) проходит 1113 октября в Технополисе "Москва".
Официальный сайт: https://ru.coex.tech/copterhack.
Чат хакатона: https://t.me/CopterHack.
Timepad: https://copterexpress.timepad.ru/event/1017592/.
## Информация для участников
## Лекции
Лекция 1: введение  https://www.youtube.com/watch?v=cjtmZNuq7z0.
Лекция 2: настройка полетного контроллера  https://www.youtube.com/watch?v=PJNDYFPZQms.
Лекция 3: архитектура полетного контроллера PX4  https://www.youtube.com/watch?v=_jl7FImq3jk.