mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-29 14:29:33 +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>
171 lines
7.6 KiB
Markdown
171 lines
7.6 KiB
Markdown
# Map-based navigation with ArUco markers
|
||
|
||
> **Note** The following applies to [image versions](image.md) **0.22** and up. Older documentation is still available for [for version **0.20**](https://github.com/CopterExpress/clover/blob/v0.20/docs/en/aruco_map.md).
|
||
|
||
<!-- -->
|
||
|
||
> **Info** Marker detection requires the camera module to be correctly plugged in and [configured](camera_setup.md).
|
||
|
||
<!-- -->
|
||
|
||
> **Hint** We recommend using our [custom PX4 firmware](firmware.md).
|
||
|
||
`aruco_map` module detects whole ArUco-based maps. Map-based navigation is possible using vision position estimate (VPE).
|
||
|
||
## Configuration
|
||
|
||
Set the `aruco` argument in `~/catkin_ws/src/clover/clover/launch/clover.launch` to `true`:
|
||
|
||
```xml
|
||
<arg name="aruco" default="true"/>
|
||
```
|
||
|
||
In order to enable map detection set `aruco_map` and `aruco_detect` arguments to `true` in `~/catkin_ws/src/clover/clover/launch/aruco.launch`:
|
||
|
||
```xml
|
||
<arg name="aruco_detect" default="true"/>
|
||
<arg name="aruco_map" default="true"/>
|
||
```
|
||
|
||
Set `aruco_vpe` to `true` to publish detected camera position to the flight controller as VPE data:
|
||
|
||
```xml
|
||
<arg name="aruco_vpe" default="true"/>
|
||
```
|
||
|
||
## Marker map definition
|
||
|
||
Map is defined in a text file; each line has the following format:
|
||
|
||
```
|
||
marker_id marker_size x y z z_angle y_angle x_angle
|
||
```
|
||
|
||
`N_angle` is the angle of rotation along the `N` axis in radians.
|
||
|
||
Файлы карт располагаются в каталоге `~/catkin_ws/src/clover/aruco_pose/map`. Название файла с картой задается в аргументе `map`:
|
||
Map files are located at the `~/catkin_ws/src/clover/aruco_pose/map` directory. Map file name is defined in the `map` argument:
|
||
|
||
```xml
|
||
<arg name="map" default="map.txt"/>
|
||
```
|
||
|
||
Some map examples are provided in [the directory](https://github.com/CopterExpress/clover/tree/master/aruco_pose/map).
|
||
|
||
Grid maps may be generated using the `genmap.py` script:
|
||
|
||
```bash
|
||
rosrun aruco_pose genmap.py length x y dist_x dist_y first -o test_map.txt
|
||
```
|
||
|
||
`length` is the size of each marker, `x` is the marker count along the *x* axis, `y` is the marker count along the *y* axis, `dist_x` is the distance between the centers of adjacent markers along the *x* axis, `dist_y` is the distance between the centers of the *y* axis, `first` is the ID of the first marker (top left marker, unless `--bottom-left` is specified), `test_map.txt` is the name of the generated map file. The optional `--bottom-left` parameter changes the numbering of markers, making the bottom left marker the first one.
|
||
|
||
Usage example:
|
||
|
||
```bash
|
||
rosrun aruco_pose genmap.py 0.33 2 4 1 1 0 -o test_map.txt
|
||
```
|
||
|
||
Additional information on the utility can be obtained using `-h` key: `rosrun aruco_pose genmap.py -h`.
|
||
|
||
<!-- You can also use the [online map editor](arucogenmap.md) to create ArUco maps. -->
|
||
|
||
### Checking the map
|
||
|
||
The currently active map is posted in the `/aruco_map/image` ROS topic. It can be viewed using [web_video_server](web_video_server.md) by opening the following link: http://192.168.11.1:8080/snapshot?topic=/aruco_map/image
|
||
|
||
<img src="../assets/aruco-map.png" width=600>
|
||
|
||
Current estimated pose (relative to the detected map) is published in the `aruco_map/pose` ROS topic. If the VPE is disabled, the `aruco_map` [TF frame](frames.md) is created; otherwise, the `aruco_map_detected` frame is created instead. Visualization for the current map is also posted in the `aruco_map/visualization` ROS topic; it may be visualized in [rviz](rviz.md).
|
||
|
||
An easy to understand detected map visualization is posted in the `aruco_map/debug` ROS topic (live view is available on http://192.168.11.1:8080/stream_viewer?topic=/aruco_map/debug):
|
||
|
||
<img src="../assets/aruco-map-debug.png" width=600>
|
||
|
||
## Coordinate system
|
||
|
||
The marker map adheres to the [ROS coordinate system convention](http://www.ros.org/reps/rep-0103.html), using the <abbr title="East-North-Up">ENU</abbr> coordinate system:
|
||
|
||
* the **<font color=red>x</font>** axis points to the right side of the map;
|
||
* the **<font color=green>y</font>** axis points to the top side of the map;
|
||
* the **<font color=blue>z</font>** axis points outwards from the plane of the marker
|
||
|
||
<img src="../assets/aruco-map-axis.png" width="600">
|
||
|
||
## VPE setup
|
||
|
||
In order to enable vision position estimation you should use the following [PX4 parameters](px4_parameters.md).
|
||
|
||
If you're using **LPE** (`SYS_MC_EST_GROUP` parameter is set to `local_position_estimator,attitude_estimator_q`):
|
||
|
||
* `LPE_FUSION` should have `vision position` and `land detector` flags set. We suggest unsetting the `baro` flag for indoor flights.
|
||
* External heading (yaw) weight: `ATT_W_EXT_HDG` = 0.5.
|
||
* External heading (yaw) mode: `ATT_EXT_HDG_M` = 1 (`Vision`).
|
||
* Vision position standard deviations: `LPE_VIS_XY` = 0.1 m, `LPE_VIS_Z` = 0.1 m.
|
||
* `LPE_VIS_DELAY` = 0 sec.
|
||
|
||
<!-- * Compass should not be fused: `ATT_W_MAG` = 0 -->
|
||
|
||
If you're using **EKF2** estimator (`SYS_MC_EST_GROUP` parameter is set to `ekf2`), make sure the following is set:
|
||
|
||
* `EKF2_AID_MASK` should have `vision position fusion` and `vision yaw fusion` flags set.
|
||
* Vision angle observations noise: `EKF2_EVA_NOISE` = 0.1 rad.
|
||
* Vision position observations noise: `EKF2_EVP_NOISE` = 0.1 m.
|
||
* `EKF2_EV_DELAY` = 0.
|
||
|
||
> **Hint** We recommend using **LPE** for marker-based navigation.
|
||
|
||
You may use [the `selfcheck.py` utility](selfcheck.md) to check your settings.
|
||
|
||
> **Hint** In order to use LPE with the Pixhawk v1 hardware you should download the [`px4fmu-v2_lpe.px4` firmware](firmware.md)
|
||
|
||
## Flight
|
||
|
||
If the setup is done correctly, the drone will hold its position in `POSCTL` and `OFFBOARD` [flight modes](modes.md) automatically.
|
||
|
||
You will also be able to use `navigate`, `set_position` and `set_velocity` ROS services for [autonomous flights](simple_offboard.md). In order to fly to a specific coordinate within the ArUco map you should use the `aruco_map` frame:
|
||
|
||
```python
|
||
# Takeoff should be performed in the "body" frame; "aruco_map" frame will appear as soon as the drone detects the marker field
|
||
navigate(x=0, y=0, z=2, frame_id='body', speed=0.5, auto_arm=True) # Takeoff and hover 2 metres above the ground
|
||
|
||
time.sleep(5)
|
||
|
||
# Fly to the (2, 2) point on the marker field while being 2 metres above it
|
||
navigate(x=2, y=2, z=2, speed=1, frame_id='aruco_map')
|
||
```
|
||
|
||
### Using a specific marker frame
|
||
|
||
Starting with the [image](image.md) version 0.18, the drone also can fly relative to a marker in the map, even if it is not currently visible. Like with [single-marker navigation](aruco_marker.md#working-with-detected-markers), this works by setting the frame_id parameter to aruco_ID, where ID is the desired marker number.
|
||
|
||
The following code will move the drone to the point 1 meter above the center of marker 5:
|
||
|
||
```python
|
||
navigate(frame_id='aruco_5', x=0, y=0, z=1)
|
||
```
|
||
|
||
## Additional settings
|
||
|
||
If the drone's position is not stable when VPE is used, try increasing the *P* term in the velocity PID regulator: increase the `MPC_XY_VEL_P` and `MPC_Z_VEL_P` parameters.
|
||
|
||
If the drone's altitude is not stable, try increasing the `MPC_Z_VEL_P` parameter and adjusting hover thrust via `MPC_THR_HOVER`.
|
||
|
||
## Placing markers on the ceiling
|
||
|
||

|
||
|
||
In order to navigate using markers on the ceiling, mount the onboard camera so that it points up and [adjust the camera frame accordingly](camera_setup.md).
|
||
|
||
You should also set the `placement` parameter to `ceilin` in `~/catkin_ws/src/clover/clover/launch/aruco.launch`:
|
||
|
||
```xml
|
||
<arg name="placement" default="ceiling"/>
|
||
```
|
||
|
||
This will flip the `aruco_map` frame (making its **<font color=blue>z</font>** axis point downward). Thus, in order to fly 2 metres below ceiling, the `z` argument for the `navigate` service should be set to 2:
|
||
|
||
```python
|
||
navigate(x=1, y=1.1, z=2, speed=0.5, frame_id='aruco_map')
|
||
```
|