mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 21:49:32 +00:00
* builder: Use 64-bit Raspberry Pi OS * travis: Use 64-bit builder * builder: Don't try to install Melodic packages on Noetic * clover: Use package version 3, update dependencies * travis: Enable Noetic build * standalone_install: Auto-select Python, ROS distro * builder: Use variable substitution for ROS_DISTRO * builder: Add Noetic package definitions * builder: Use variable substitution for validation * aruco_pose, clover: Allow compiling against OpenCV 3 and 4 * builder: Add proper Noetic repository * builder: Don't force Tornado version Assume rosbridge_suite depends on the right one. * builder: Install packages for Python 3 * builder/test: Use Python3 interpreter for ROS tests TODO (?): add tests for Python2? * builder: Use Python 3 syntax for Python 3 tests * builder: Install rpi_ws281x for Python3 * standalone_install: Use proper Python for pytest * builder: Install espeak for python3 * builder: Use proper path for roscore * builder: Install rosdep, etc. for python3 * builder: Run Clever/Clover test with Python3 * builder: Use Python3 for Clever compat layer * builder: Enable OpenCV 4.2 repository * builder: Force versions for ROS packages that use OpenCV Also, hold their versions so that they don't get updated for no reason. * aruco_pose/draw: Replace OpenCV projection code with a rewrite * builder: Don't try to install compressed_transport twice * clover: Fix importing urllib for Python3 * aruco_pose, clover: Expose Python scripts through CMake * clover/selfcheck: Be more python3-compatible This is basically commita01d199890from buster-python3, not sure if it aged well. * roswww_static: Add python script installation * clover_blocks: Use Python3 syntax for exec * aruco_pose: Remove unused code * Melodic => Noetic in some docs * docs: add 0.22 migration article * docs: remove unneeded comment * docs: python 3 updates * docs: python 3 update in auto_setup article * docs: add ROS Noetic transition note * aruco.launch: add placement, length and map arguments * genmap.py: add -o argument for output file name * docs: use -o argument of genmap.py * simple_offboard: correctly check manual control timeout, separate it from kill switch check * blocks: force led_leds index to int * docs: update and fix 0.22 migration articles * blocks: fix set_leds with color-typed argument * aruco_gen: Open file in binary mode for Python3 compatibility * clover: Use proper variable in aruco.launch * led: change default number of leds to 72 * aruco_pose: Make sure there are no undefined symbols Also, compile in apriltag_quad_thresh.cpp - it contains some of the functions referenced in aruco.cpp, which would otherwise be undefined. * aruco_pose: Make vendored library compatible with older OpenCVs * aruco_pose, clover: Reduce the amount of OpenCV libs requested * aruco_pose, clover: Move subscriptions to the end of init * aruco_pose: Don't expose vendored library symbols * aruco_pose: Simplify dynamic parameter callback setting * builder: Build with debug symbols * clover: Attempt to respawn dying nodelets * Change Raspberry Pi OS to latest armhf, use packages.coex.tech as a source * Add CRYPTOGRAPHY_DONT_BUILD_RUST=1 * Fix Node.js installation * image: use older CMake (3.13.4-1) Fixing https://travis-ci.org/github/CopterExpress/clover/jobs/764367665#L6984 * image: update Raspberry Pi OS to 2021-03-04 * image: bring back moving ld.so.preload out of the way while building * Fix pthreads ld error * Try to fix pthreads ld error * Another attempt to fix pthreads ld error * Yet another attempt to fix pthreads ld error * Try to fix * Be verbose * Temporarily disable rc and camera_markers building * Fix standalone-install * Revert "Temporarily disable rc and camera_markers building" This reverts commite119220e91. * Try to fix * Try to fix * Revert "image: use older CMake (3.13.4-1)" This reverts commitdf28da0060. * Revert "Revert "image: use older CMake (3.13.4-1)"" This reverts commita28c774e8f. * Verbosity * Debugging * More debugging * Display all CMake variables * Try to fix * Another try to fix * Revert "Another try to fix" This reverts commit5a4c3a0da7. * Another try to fix * And another * And yet another * Continue... * Cleanup * Sources lists cleanup * More cleanup * Restore .git directory in clover repo * Fix building documentation * Fix documentation building in image * Trigger build to update ws281x package * Test * Disable unneeded hack * Disable hack * image: add cmake-modules package * www: add viewing clover.err file from web interface * Remove hacks * Show nodelet version * docs: add packages article * image: add image-view package for recording video from topics * Minor fix * CI: add Docker authentication on image build * CI: fix Bash syntax * CI: fix authentication in Docker * CI: move Melodic build and editorconfig-lint to GitHub Actions (#331) * Create main.yml * Update main.yml * Disable native Melodic build in Travis * Run editorconfig-lint in Actions * Let wget be less verbose * Test * Test ok * Disable editorconfig-lint in Travis * docs: add links to hardware sources * CI: move image building to GitHub actions (#335) * Start working on building image in GitHub actions * Trigger GitHub on push to any branch * Fix TRAVIS_TAG * Add compress image step * Disable image build in Travis * Add upload image step * Fix compress image * Fix * Fix * Minor fix * Trigger build on tag * Show images sizes not in human format * Upload only built image * Make prerelease * Upload assets on release not on tags * readme: change build badge to GitHub Actions * readme: add support chat badge * CI: move documentation building to GitHub Actions (#337) * CI: change docs target branch to actions * CI: change docs target branch to master * CI: use gh-pages target branch for docs * CI: split up to several workflows * CI: remove .travis.yml * CI: change apt to apt-get * CI: push documentation site to the main repo * builder: less verbosity * CI: add new key for apt Fixing https://github.com/CopterExpress/clover/runs/2700356960#step:3:74 * Add Noetic building to CI * Add test for QR recognition * Fix * Move QR recognition test to a separate file * Fix QR recognition code for Python 3 * Import SetLEDs, LEDStateArray, LEDState in tests * Add more imports to tests (from documentation) * Fix permissions * Fix standalone-install for Python 2 * Fix QR recognition test * Don’t use ROS for QR recognition test * docs: remove non-working example * Make v4l2 device file an argument in main_camera.launch * Wait for v4l2 device before launching the camera driver * Use exec in waitfile * Transfer main camera nodelet manager to main_camera.launch * Update cv_camera version to 0.5.1 * docs: minor fix * Revert cv_camera to 0.5.0 * Update Raspberry Pi OS to 2021-05-07 * docs: add link to the last ROS Melodic version. Co-authored-by: Alexey Rogachevskiy <sfalexrog@gmail.com>
132 lines
6.6 KiB
Markdown
132 lines
6.6 KiB
Markdown
# Распознавание ArUco-маркеров
|
||
|
||
> **Note** Документация для версий [образа](image.md), начиная с версии **0.22**. Для более ранних версий см. [документацию для версии **0.20**](https://github.com/CopterExpress/clover/blob/v0.20/docs/ru/aruco_marker.md).
|
||
|
||
<!-- -->
|
||
|
||
> **Info** Для распознавания маркеров модуль камеры должен быть корректно подключен и [сконфигурирован](camera_setup.md).
|
||
|
||
Модуль `aruco_detect` распознает ArUco-маркеры и публикует их позиции в ROS-топики и в [TF](frames.md).
|
||
|
||
Эта функция полезна для применения совместно с какой-либо системой позиционирования для дрона, такой как [GPS](gps.md), [Optical Flow](optical_flow.md), PX4Flow, визуальная одометрия, ультразвуковое ([Marvelmind](https://marvelmind.com)) или UWB-позиционирование ([Pozyx](https://www.pozyx.io)).
|
||
|
||
Также возможно применение совместно с [навигацией по карте маркеров](aruco_map.md).
|
||
|
||
## Настройка
|
||
|
||
Аргумент `aruco` в файле `~/catkin_ws/src/clover/clover/launch/clover.launch` должен быть в значении `true`:
|
||
|
||
```xml
|
||
<arg name="aruco" default="true"/>
|
||
```
|
||
|
||
Для включения распознавания маркеров аргумент `aruco_detect` в файле `~/catkin_ws/src/clover/clover/launch/aruco.launch` должен быть в значении `true`:
|
||
|
||
```xml
|
||
<arg name="aruco_detect" default="true"/>
|
||
```
|
||
|
||
Для правильной работы в этом же файле также должны быть выставлены аргументы:
|
||
|
||
```xml
|
||
<arg name="placement" default="floor"/> <!-- расположение маркеров, см. далее -->
|
||
<arg name="length" default="0.33"/> <!-- размер маркеров в метрах (не включая белую рамку) -->
|
||
```
|
||
|
||
Значение аргумента `placement` следует выставлять следующим образом:
|
||
|
||
* если *все* маркеры наклеены на полу (земле), выставить значение `floor`;
|
||
* если *все* маркеры наклеены на потолке, выставить значение `ceiling`;
|
||
* в противном случае удалить строку с параметром.
|
||
|
||
Если некоторые маркеры имеют размер, отличный значения `length`, их размер может быть переопределен с помощью параметра `length_override` ноды `aruco_detect`:
|
||
|
||
```xml
|
||
<param name="length_override/3" value="0.1"/> <!-- маркер c id 3 имеет размер 10 см -->
|
||
<param name="length_override/17" value="0.25"/> <!-- маркер c id 17 имеет размер 25 см -->
|
||
```
|
||
|
||
## Система координат
|
||
|
||
С маркером связана следующая система координат:
|
||
|
||
* ось **<font color=red>x</font>** указывает на правую сторону маркера;
|
||
* ось **<font color=green>y</font>** указывает кверху маркера;
|
||
* ось **<font color=blue>z</font>** указывает от плоскости маркера.
|
||
|
||
<img src="../assets/aruco-axis.png" width="300">
|
||
|
||
## Работа с распознанными маркерами
|
||
|
||
Наглядно распознанные маркеры можно видеть в топике `aruco_detect/debug`. Просмотреть его можно с помощью [`rqt_image_view`](rviz.md) или через [web_video_server](web_video_server.md) по ссылке http://192.168.11.1:8080/snapshot?topic=/aruco_pose/debug:
|
||
|
||
<img src="../assets/aruco-detect-debug.png" width=600>
|
||
|
||
Распознанные маркеры и их позиции публикуются в топик `aruco_detect/markers`. Чтение топика из Bash:
|
||
|
||
```bash
|
||
rostopic echo /aruco_detect/markers
|
||
```
|
||
|
||
## Навигация по маркерам
|
||
|
||
С использованием модуля [`simple_offboard`](simple_offboard.md) можно осуществлять навигацию по маркерам используя соответствующие TF-фреймы.
|
||
|
||
Полет в точку над маркером 5 на высоту 1 метр:
|
||
|
||
```python
|
||
navigate(frame_id='aruco_5', x=0, y=0, z=1)
|
||
```
|
||
|
||
Полет в точку на метр левее маркера 7 на высоте 2 метра:
|
||
|
||
```python
|
||
navigate(frame_id='aruco_7', x=-1, y=0, z=2)
|
||
```
|
||
|
||
Вращаться против часовой стрелки на высоте 1.5 метра над маркером 10:
|
||
|
||
```python
|
||
navigate(frame_id='aruco_10', x=0, y=0, z=1.5, yaw_rate=0.5)
|
||
```
|
||
|
||
Если необходимый маркер не появится в поле зрения в течение полусекунды, дрон продолжит выполнять предыдущую команду.
|
||
|
||
Подобные значения `frame_id` можно использовать и в других сервисах, например `get_telemetry`. Получение расположения дрона относительно маркера 3:
|
||
|
||
```python
|
||
telem = get_telemetry(frame_id='aruco_3')
|
||
```
|
||
|
||
Если необходимый маркер не появится в поле зрения в течение полусекунды, в полях `telem.x`, `telem.y`, `telem.z`, `telem.yaw` будет значение `NaN`.
|
||
|
||
## Работа с результатом распознавания из Python
|
||
|
||
Чтение топика `aruco_detect/markers` из Python:
|
||
|
||
```python
|
||
import rospy
|
||
from aruco_pose.msg import MarkerArray
|
||
rospy.init_node('my_node')
|
||
|
||
# ...
|
||
|
||
def markers_callback(msg):
|
||
print('Detected markers:'):
|
||
for marker in msg.markers:
|
||
print('Marker: %s' % marker)
|
||
|
||
# Подписываемся. При получении сообщения в топик aruco_detect/markers будет вызвана функция markers_callback.
|
||
rospy.Subscriber('aruco_detect/markers', MarkerArray, markers_callback)
|
||
|
||
# ...
|
||
|
||
rospy.spin()
|
||
```
|
||
|
||
Сообщения будут содержать ID маркера, его угловые точки на изображении и его позицию (относительно камеры).
|
||
|
||
---
|
||
|
||
См. далее: [навигация по картам маркеров](aruco_map.md).
|