mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 05:29:32 +00:00
Merge branch 'proof_reading'
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
* Assembly
|
||||
* [Clever 2 assembly](assemble_2.md)
|
||||
* [Clever 3 assembly](assemble_3.md)
|
||||
* [Installation of FPV](fpv.md)
|
||||
* [Safety instruction](safety.md)
|
||||
* [FPV Setup](fpv.md)
|
||||
* [Safety tips](safety.md)
|
||||
* [Connecting 4 in 1 ESCs](4in1.md)
|
||||
* [Types of power connectors](connectortypes.md)
|
||||
* [Blanching](zap.md)
|
||||
* [Soldering safety](tb.md)
|
||||
* [Using multimeter](test_connection.md)
|
||||
* [Possible radio failures](radioerrors.md)
|
||||
* [Multimeter usage](test_connection.md)
|
||||
* [RC Troubleshooting](radioerrors.md)
|
||||
* [Connecting GPS](gps.md)
|
||||
* Configuration
|
||||
* [Initial setup](setup.md)
|
||||
@@ -19,31 +19,34 @@
|
||||
* [Pixhawk / Pixracer Firmware](firmware.md)
|
||||
* [PX4 Parameters](px4_parameters.md)
|
||||
* [PID Setup](calibratePID.md)
|
||||
* Work with Raspberry Pi
|
||||
* Working with Raspberry Pi
|
||||
* [Raspberry Pi](raspberry.md)
|
||||
* [RPi Image](microsd_images.md)
|
||||
* [RPi Connection to the Pixhawk](connection.md)
|
||||
* [Wi-Fi connection](wifi.md)
|
||||
* [SSH access to Raspberry Pi](ssh.md)
|
||||
* [Configuring Wi-Fi](network.md)
|
||||
* [Using QGroundControl via Wi-Fi](gcs_bridge.md)
|
||||
* [Controlling Clever from a smartphone](rc.md)
|
||||
* [Remote shell](ssh.md)
|
||||
* [Wi-Fi Configuration](network.md)
|
||||
* [Using QGroundControl over Wi-Fi](gcs_bridge.md)
|
||||
* [Remote control app](rc.md)
|
||||
* [UART settings](uart.md)
|
||||
* [Viewing images from cameras](web_video_server.md)
|
||||
* [Coordinate systems (frames)](frames.md)
|
||||
* Coding
|
||||
* Programming
|
||||
* [ROS](ros.md)
|
||||
* [MAVROS](mavros.md)
|
||||
* [Simple OFFBOARD](simple_offboard.md)
|
||||
* [Navigation using ArUco markers](aruco.md)
|
||||
* [Automatic check](selfcheck.md)
|
||||
* [Code examples](snippets.md)
|
||||
* Fiducial markers (ArUco)
|
||||
* [Overview](aruco.md)
|
||||
* [Marker detection](aruco_marker.md)
|
||||
* [Map-based navigation](aruco_map.md)
|
||||
* [Automated self-checks](selfcheck.md)
|
||||
* [Code snippets](snippets.md)
|
||||
* [Adjusting the position of the main camera](camera_frame.md)
|
||||
* [Working with the camera](camera.md)
|
||||
* [Working with a LED strip on Raspberry 3](leds.md)
|
||||
* [Computer vision basics](camera.md)
|
||||
* [LED strip](leds.md)
|
||||
* [Using rviz and rqt](rviz.md)
|
||||
* [Working with the ultrasonic distance gage](sonar.md)
|
||||
* [Working with a laser rangefinder](laser.md)
|
||||
* [Interfacing with a sonar](sonar.md)
|
||||
* [Interfacing with a laser rangefinder](laser.md)
|
||||
* [PX4 Simulation](sitl.md)
|
||||
* [Software autorun](autolaunch.md)
|
||||
* [Controlling the copter from Arduino](arduino.md)
|
||||
@@ -51,11 +54,11 @@
|
||||
* Clever-based projects
|
||||
* [Copter spheric guard](shield.md)
|
||||
* [Face recognition system](face_recognition.md)
|
||||
* [An Android transmitter](android.md)
|
||||
* [Android RC app](android.md)
|
||||
* [Copter Hack 2018](copterhack2018.md)
|
||||
* [Copter Hack 2017](copterhack2017.md)
|
||||
* Supplementary materials
|
||||
* [Contribution to Clever](contributing.md)
|
||||
* [Contribution Guidelines](contributing.md)
|
||||
* [Flashing ESCs using BLHeliSuite](esc_firmware.md)
|
||||
* [MAVLink](mavlink.md)
|
||||
* [PX4 Logs and Topics](flight_logs.md)
|
||||
|
||||
165
docs/en/aruco.md
165
docs/en/aruco.md
@@ -1,9 +1,8 @@
|
||||
# Navigation using ArUco markers
|
||||
# ArUco markers
|
||||
|
||||
> **Note** Documentation for the versions [of image](microsd_images.md), starting with **0.15**. For earlier versions, see [documentation for version **0.14**](https://github.com/CopterExpress/clever/blob/v0.14/docs/ru/aruco.md).
|
||||
> **Note** The following applies to [image versions](microsd_images.md) **0.16** and up. Older documentation is still available [for version **0.15.1**](https://github.com/CopterExpress/clever/blob/v0.15.1/docs/ru/aruco.md).
|
||||
|
||||
[ArUco-Markers](https://docs.opencv.org/3.2.0/d5/dae/tutorial_aruco_detection.html) is a popular technology for positioning
|
||||
robotic systems using computer vision.
|
||||
[ArUco markers](https://docs.opencv.org/3.2.0/d5/dae/tutorial_aruco_detection.html) are commonly used for vision-based position estimation.
|
||||
|
||||
Examples of ArUco markers:
|
||||
|
||||
@@ -13,159 +12,13 @@ Examples of ArUco markers:
|
||||
|
||||
For rapid generation of markers for printing, you may use an online tool: http://chev.me/arucogen/.
|
||||
|
||||
## aruco\_pose
|
||||
[Clever Raspberry Pi image](microsd_images.md) contains a pre-installed `aruco_pose` ROS package, which can be used for marker detection.
|
||||
|
||||
The `aruco_pose` module allows restoring the position of the copter relative to the map of ArUco markers and communicating it to the flight controller using the [Vision Position Estimation](https://dev.px4.io/en/ros/external_position_estimation.html) mechanism.
|
||||
## Modes of operation
|
||||
|
||||
If the source of the copter position by the markers is available, the option appears for precise autonomous indoor navigation by the positions using the [simple_offboard](simple_offboard.md) module.
|
||||
There are several preconfigured modes of operation for ArUco markers on the Clever drone:
|
||||
|
||||
### Turning on
|
||||
* [single marker detection and navigation](aruco_marker.md);
|
||||
* [map-based navigation](aruco_map.md).
|
||||
|
||||
Make sure that in the clever launch file \(`~/catkin_ws/src/clever/clever/launch/clever.launch`\), the start of aruco\_pose and [computer vision cameras](camera.md) is turned on:
|
||||
|
||||
```xml
|
||||
<arg name="main_camera" default="true"/>
|
||||
```
|
||||
|
||||
```xml
|
||||
<arg name="aruco" default="true"/>
|
||||
```
|
||||
|
||||
After the launch-file is edited, restart package `clever`:
|
||||
|
||||
```(bash)
|
||||
sudo systemctl restart clever
|
||||
```
|
||||
|
||||
### Calibrating the ArUco marker map
|
||||
|
||||
An automatically generated [ArUco-board](https://docs.opencv.org/trunk/db/da9/tutorial_aruco_board_detection.html) may be used as a map of marks.
|
||||
|
||||
The map of marks is adjusted using file `~/catkin_ws/src/clever/clever/launch/aruco.launch`. To use ArUco-board, enter its parameters:
|
||||
|
||||
```xml
|
||||
<node pkg="nodelet" type="nodelet" name="aruco_pose" args="load aruco_pose/aruco_pose nodelet_manager">
|
||||
<param name="frame_id" value="aruco_map_raw"/>
|
||||
<!-- the type of the marker field -->
|
||||
<param name="type" value="gridboard"/>
|
||||
|
||||
<!-- the number of markets along x -->
|
||||
<param name="markers_x" value="1"/>
|
||||
|
||||
<!-- the number of markers along y -->
|
||||
<param name="markers_y" value="6"/>
|
||||
|
||||
<!-- ID of the first marker (left top) -->
|
||||
<param name="first_marker" value="240"/>
|
||||
|
||||
<!-- the length of the marker side in meters -->
|
||||
<param name="markers_side" value="0.3362"/>
|
||||
|
||||
<!-- distance between the murders -->
|
||||
<param name="markers_sep" value="0.46"/>
|
||||
</node>
|
||||
```
|
||||
|
||||
The vertical and horizontal distance between the markers may be set separately:
|
||||
|
||||
```xml
|
||||
<!-- the horizontal distance between the markers -->
|
||||
<param name="markers_sep_x" value="0.97"/>
|
||||
|
||||
<!-- the vertical distance between the marker -->
|
||||
<param name="markers_sep_y" value="1.435"/>
|
||||
```
|
||||
|
||||
If a map with a custom order of marker IDs is used, parameter `marker_ids` may be used:
|
||||
|
||||
```xml
|
||||
<rosparam param="marker_ids">[5, 7, 9, 11, 13, 15]</rosparam>
|
||||
```
|
||||
|
||||
The markers are numbered from the top left corner of the field.
|
||||
|
||||
For monitoring the map that is currently used by the copter for navigation, one can watch the content of topic `aruco_pose/map_image`. In a browser, it may be viewed with [web\_video\_server](web_video_server.md) by following the link [http://192.168.11.1:8080/snapshot?topic=/aruco\_pose/map\_image](http://192.168.11.1:8080/snapshot?topic=/aruco_pose/map_image):
|
||||
|
||||

|
||||
|
||||
When flying, make sure that the markers glued to the floor correspond to the map.
|
||||
|
||||
In topic `aruco_pose/debug` \([http://192.168.11.1:8080/snapshot?topic=/aruco\_pose/debug](http://192.168.11.1:8080/snapshot?topic=/aruco_pose/debug)\) the current result of markers recognitions is available:
|
||||
|
||||
TODO
|
||||
|
||||
### The system of coordinates
|
||||
|
||||
According to [agreement](http://www.ros.org/reps/rep-0103.html), the standard ENU system of coordinates is used in the marker field:
|
||||
|
||||
* x — rightward \(conditional East\);
|
||||
* y — forward \(conditional North\);
|
||||
* z — upward.
|
||||
|
||||
_Note_: the definition above is provided for a situation when the marker field is on the floor.
|
||||
|
||||
First, the zero is the bottom left point of the marker field. The yaw angle is considered zero when the copter is faced rightward\(along the x-axis\).
|
||||
|
||||

|
||||
|
||||
### Configuring the flight controller
|
||||
|
||||
Correct Vision Position Estimation requires making sure \(via [QGroundControl](gcs_bridge.md)\) that:
|
||||
|
||||
* **For Pixhawk**: Firmware with LPE \(local position estimator\) is installed. For Pixhawk [download firmware `px4fmu-v2_lpe.px4`](https://github.com/PX4/Firmware/releases).
|
||||
|
||||
**For Pixracer**: parameter `SYS_MC_EST_GROUP` should be set to`local_position_estimator, attitude_estimator_q`.
|
||||
|
||||
> **Note** After changing the value of parameter `SYS_MC_EST_GROUP` restart the flight controller.
|
||||
* In parameter `LPE_FUSION` **only** flags `vision position`, `land detector` are enabled. The final value _20_.
|
||||
* Compass disabled: `ATT_W_MAG` = 0
|
||||
* Complimentary filter external heading weight: `ATT_W_EXT_HDG` = 0.5
|
||||
* Orientation by yaw by vision enabled: `ATT_EXT_HDG_M` = 2 `MOCAP`.
|
||||
* VPE settings: `LPE_VIS_DELAY` = 0 sec, `LPE_VIS_XY` = 0.1 m, `LPE_VIS_Z` = 0.15 m.
|
||||
* Recommended settings for land detector:
|
||||
* `COM_DISARM_LAND` = 1 s
|
||||
* `LNDMC_ROT_MAX` = 45 deg
|
||||
* `LNDMC_THR_RANGE` = 0.5
|
||||
* `LNDMC_Z_VEL_MAX` = 1 m/s
|
||||
|
||||
<!--
|
||||
For the ease of configuring, you may use a ready settings file for [Clever 2](https://github.com/CopterExpress/clever/blob/master/docs/assets/Clever2LPE_160118.params) or for [Clever 3](https://github.com/CopterExpress/clever/blob/master/docs/assets/Clever3_LPE_020218.params) and upload it to the controller using menu Tools - Load from file in tab Parameters in QGroundControl.
|
||||
|
||||

|
||||
-->
|
||||
|
||||
### Flight
|
||||
|
||||
A properly configured copter starts holding position by VPE \(in [modes](modes.md) `POSCTL` or `OFFBOARD`\) automatically.
|
||||
|
||||
For [autonomous flights](simple_offboard.md) do you will be able to use functions `navigate`, `set_position`, `set_velocity`. For flying to specific coordinates of the marker field, use frame `aruco_map`:
|
||||
|
||||
```python
|
||||
# First, the copter has to take off to see the map of marks
|
||||
# and for frame aruco_map to appear:
|
||||
navigate(0, 0, 2, frame_id='body', speed=0.5, auto_arm=True) # take off to the altitude of 2 meters
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
# Flying to coordinate 2:2 of the marker field at the altitude of 2 meters
|
||||
navigate(2, 2, 2, speed=1, frame_id='aruco_map') # flying to coordinate 2:2 at the altitude of 3 meters
|
||||
```
|
||||
|
||||
See [other functions](simple_offboard.md) simple_offboard.
|
||||
|
||||
### Location of markers on the ceiling
|
||||
|
||||

|
||||
|
||||
To navigate by the markers placed on the ceiling, you need to set the main camera facing up and [set the corresponding frame of the camera](camera_frame.md).
|
||||
|
||||
To set the map of markers in a "turned over" system of coordinates, change parameter `aruco_orientation` in file `~/catkin_ws/src/clever/clever/aruco.launch`:
|
||||
|
||||
```xml
|
||||
<param name="aruco_orientation" value="map_upside_down"/>
|
||||
```
|
||||
|
||||
When this parameter is set, frame aruco\_map will also be "turned over". Thus, to fly at the altitude of 2 meters below the ceiling, argument `z` should be set to 2:
|
||||
|
||||
```python
|
||||
navigate(x=1, y=2, z=1.1, speed=0.5, frame_id='aruco_map')
|
||||
> **Info** Additional documentation for the `aruco_pose` ROS package is available [on GitHub](https://github.com/CopterExpress/clever/blob/master/aruco_pose/README.md).
|
||||
|
||||
139
docs/en/aruco_map.md
Normal file
139
docs/en/aruco_map.md
Normal file
@@ -0,0 +1,139 @@
|
||||
# Map-based navigation with ArUco markers
|
||||
|
||||
> **Info** Marker detection requires the camera module to be correctly plugged in and [configured](camera.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
|
||||
|
||||
In order to enable map detection set `aruco_map` and `aruco_detect` arguments to `true` in `~/catkin_ws/src/clever/clever/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.
|
||||
|
||||
Map path is defined in the `map` parameter:
|
||||
|
||||
```xml
|
||||
<param name="map" value="$(find aruco_pose)/map/map.txt"/>
|
||||
```
|
||||
|
||||
Some map examples are provided in [`~/catkin_ws/src/clever/aruco_pose/map`](https://github.com/CopterExpress/clever/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 > ~/catkin_ws/src/clever/aruco_pose/map/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 (bottom left marker, unless `--top-left` is specified), `test_map.txt` is the name of the generated map file. The optional `--top-left` parameter changes the numbering of markers, making the top left marker the first one.
|
||||
|
||||
Usage example:
|
||||
|
||||
```bash
|
||||
rosrun aruco_pose genmap.py 0.33 2 4 1 1 0 > ~/catkin_ws/src/clever/aruco_pose/map/test_map.txt
|
||||
```
|
||||
|
||||
### 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 **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.
|
||||
|
||||
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.
|
||||
|
||||
> **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(0, 0, 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(2, 2, 2, speed=1, frame_id='aruco_map')
|
||||
```
|
||||
|
||||
## 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_frame.md).
|
||||
|
||||
You should also set the `known_tilt` parameter to `map_flipped` in both `aruco_detect` and `aruco_map` sections of `~/catkin_ws/src/clever/clever/launch/aruco.launch`:
|
||||
|
||||
```xml
|
||||
<param name="known_tilt" value="map_flipped"/>
|
||||
```
|
||||
|
||||
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')
|
||||
```
|
||||
111
docs/en/aruco_marker.md
Normal file
111
docs/en/aruco_marker.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# ArUco marker detection
|
||||
|
||||
> **Info** Marker detection requires the camera module to be correctly plugged in and [configured](camera.md).
|
||||
|
||||
`aruco_detect` module detects ArUco markers and publishes their positions in ROS topics and as [TF frames](frames.md).
|
||||
|
||||
This is useful in conjunction with other positioning systems, such as [GPS](gps.md), [Optical Flow](optical_flow.md), PX4Flow, visual odometry, ultrasonic ([Marvelmind](https://marvelmind.com)) or UWB-based ([Pozyx](https://www.pozyx.io)) localization.
|
||||
|
||||
Using this module along with [map-based navigation](aruco_map.md) is also possible.
|
||||
|
||||
## Setup
|
||||
|
||||
Set the `aruco_detect` argument in `~/catkin_ws/src/clever/clever/launch/aruco.launch` to `true` to automatically launch the module:
|
||||
|
||||
```xml
|
||||
<arg name="aruco_detect" default="true"/>
|
||||
```
|
||||
|
||||
For the module to work correctly the following parameters should be set:
|
||||
|
||||
```xml
|
||||
<param name="length" value="0.32"/> <!-- length of a single marker, in meters (excluding the white border) -->
|
||||
<param name="estimate_poses" value="true"/> <!-- position estimation for single markers -->
|
||||
<param name="send_tf" value="true"/> <!-- TF frame creation for markers -->
|
||||
<param name="known_tilt" value="map"/> <!-- Marker tilt, explained below -->
|
||||
```
|
||||
|
||||
`known_tilt` should be set to:
|
||||
|
||||
* `map` if *all* markers are on the ground;
|
||||
* `map_flipped` if *all* markers are on the ceiling;
|
||||
* an empty string otherwise.
|
||||
|
||||
You may specify length for each marker individually by using the `length_override` parameter:
|
||||
|
||||
```xml
|
||||
<param name="length_override/3" value="0.1"/> <!-- marker with id=3 has a side of 0.1m -->
|
||||
<param name="length_override/17" value="0.25"/> <!-- marker with id=17 has a side of 0.25m -->
|
||||
```
|
||||
|
||||
## Coordinate system
|
||||
|
||||
Each marker has its own coordinate systems. It is aligned as follows:
|
||||
|
||||
* the **<font color=red>x</font>** axis points to the right side of the marker;
|
||||
* the **<font color=green>y</font>** axis points to the top side of the marker;
|
||||
* the **<font color=blue>z</font>** axis points outwards from the plane of the marker
|
||||
|
||||
<img src="../assets/aruco-axis.png" width="300">
|
||||
|
||||
## Working with detected markers
|
||||
|
||||
Navigation within the marker-based TF frames is possible with `simple_offboard` node.
|
||||
|
||||
Sample code to fly to a point 1 metre above marker with id 5:
|
||||
|
||||
```python
|
||||
navigate(frame_id='aruco_5', x=0, y=0, z=1)
|
||||
```
|
||||
|
||||
Sample code to fly to a point 1 metre to the left and 2 metres above marker with id 7:
|
||||
|
||||
```python
|
||||
navigate(frame_id='aruco_7', x=-1, y=0, z=2)
|
||||
```
|
||||
|
||||
Sample code to rotate counterclockwise while hovering 1.5 metres above marker id 10:
|
||||
|
||||
```python
|
||||
navigate(frame_id='aruco_10', x=0, y=0, z=1.5, yaw_rate=0.5)
|
||||
```
|
||||
|
||||
Note that if the required marker isn't detected for 0.5 seconds after the `navigate` command, the command will be ignored.
|
||||
|
||||
These frames may also be used in other services that accept TF frames (like `get_telemetry`). The following code will get the drone's position relative to the marker with id 3:
|
||||
|
||||
```python
|
||||
telem = get_telemetry(frame_id='aruco_3')
|
||||
```
|
||||
|
||||
Note that if the required marker isn't detected for 0.5 seconds, the `telem.x`, `telem.y`, `telem.z`, `telem.yaw` fields will contain `NaN`.
|
||||
|
||||
## Handling marker detection in Python
|
||||
|
||||
The following snippet shows how to read the `aruco_detect/markers` topic in 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
|
||||
|
||||
# Create a Subscription object. Each time a message is posted in aruco_detect/markers, the markers_callback function is called with this message as its argument.
|
||||
rospy.Subscriber('aruco_detect/markers', MarkerArray, markers_callback)
|
||||
|
||||
# ...
|
||||
|
||||
rospy.spin()
|
||||
```
|
||||
|
||||
Each message contains the marker ID, its corner points on the image and its position relative to the camera.
|
||||
|
||||
---
|
||||
|
||||
Suggested reading: [map-based navigation](aruco_map.md)
|
||||
@@ -9,30 +9,30 @@ Clever 2 construction kit assembly instruction
|
||||
|
||||
* Central frame ×2.
|
||||
* Additional frame ×4.
|
||||
* Beam ×8.
|
||||
* Motor mount ×8.
|
||||
* Legs x8.
|
||||
* Beam guard ×8.
|
||||
* Motor mount guard ×8.
|
||||
* Propeller guard ×16.
|
||||
* Side guard ×16.
|
||||
* Dalprop 5045 plastic propeller ×4.
|
||||
* Racerstar BR2205 2300kV brushless motor ×4.
|
||||
* Speed adjusters ESC, DYS XSD20А ×4.
|
||||
* Speed controllers ESC, DYS XSD20А ×4.
|
||||
* Power controller XT60 pin ×1.
|
||||
* Power connector XT60 socket ×1.
|
||||
* Three-wire female-female flat cable ×2.
|
||||
* Wire copper multicore silicone insulated cable 14AWG (red, black), 50 cm long
|
||||
* Multicore silicone insulated copper wire 14AWG (red, black), 50 cm long
|
||||
* Power distribution board PDB BeeRotor Power Distribution Board V2.0 ×1.
|
||||
* Li-ion rechargeable battery (battery) 18650 ×8.
|
||||
* EFEST Luc V4 Li-lon Charger ×1.
|
||||
* Regulators protective case ×4.
|
||||
* Protective case for regulators ×4.
|
||||
* Legs attachment ×8.
|
||||
* Pixhawk flight controller ×1.
|
||||
* FlySky i6 radio receiver×1.
|
||||
* FlySky i6 radio receiver ×1.
|
||||
* FlySky i6 radio transmitter ×1.
|
||||
* EFEST LUC V4 Charger ×1.
|
||||
* Micro USB to USB Cable ×1
|
||||
* Battery compartment 18650 li-Ion ×1
|
||||
* Wire copper multicore silicone insulated cable 18AWG (red, black), 100 cm long
|
||||
* Multicore silicone insulated copper wire 18AWG (red, black), 100 cm long
|
||||
* AA battery ×4
|
||||
* Jumper, Bind-plug
|
||||
|
||||
@@ -45,16 +45,16 @@ Clever 2 construction kit assembly instruction
|
||||
* М3х16 screws ×40.
|
||||
* Plastic nuts ×8.
|
||||
* Metal nuts ×48.
|
||||
* Stickers for the compartment battery ×8.
|
||||
* Stickers for the battery compartment ×8.
|
||||
* Thermal contraction tube ⌀15, .50 cm
|
||||
* Thermal contraction tube ⌀5, 100 cm
|
||||
* Double-sided 3M adhesive tape ×16.
|
||||
* Screwdriver ×1 (visualization needed)
|
||||
* Insulation tape ×1
|
||||
* Stationery scissors ×1
|
||||
* Scissors ×1
|
||||
* Strap for the battery 250 mm ×1
|
||||
|
||||
## Functionality of the Flysky i6 transmitter
|
||||
## Flysky i6 transmitter
|
||||
|
||||
1. Switch A (SwA).
|
||||
2. Switch B (SwB).
|
||||
@@ -97,7 +97,7 @@ Clever 2 construction kit assembly instruction
|
||||
|
||||
### Installation of motors
|
||||
|
||||
* Unpack the motors. Using pliers, shorten the wires on the motors by cutting half the length (leaving about 25 mm).
|
||||
* Unpack the motors. Using pliers, shorten the wires on the motors by cutting half their length (leaving about 25 mm).
|
||||
|
||||

|
||||
|
||||
@@ -107,44 +107,44 @@ Strip
|
||||
|
||||
Twist the wires.
|
||||
|
||||
Blanch
|
||||
Tin wires
|
||||
|
||||
* Apply flux to the exposed part of the wire.
|
||||
* Cover the solder using tweezers.
|
||||
|
||||

|
||||

|
||||
|
||||
#### Fix the motor on the beam
|
||||
#### Fix the motor on the mount
|
||||
|
||||
* Install the motor on the engraved side of the beam.
|
||||
* Attach the motors to the beams with М3х8 screws using a screwdriver.
|
||||
* Install the motor on the engraved side of the mount.
|
||||
* Attach the motors to the mounts with М3х8 screws using a screwdriver.
|
||||
|
||||

|
||||

|
||||
|
||||
* Beams with motors should be arranged according to the diagram. The arrows indicate the direction of motors rotation.
|
||||
* Mounts with motors should be arranged according to the diagram. The arrows indicate the direction of motor rotation direction.
|
||||
|
||||

|
||||
|
||||
### Blanch three contact pads of the adjuster
|
||||
### Tin three contact pads of the speed controller
|
||||
|
||||
* Apply flux
|
||||
* Apply solder
|
||||
|
||||
To make solder neatly fill the entire pad, warm up the contact pad of the adjuster. For this purpose, hold the tip of the soldering gun to the contact pad for 2 seconds (or more if needed)
|
||||
By warming up the contact pads of the controller, the tin will evenly fill the entire pad. To do so, apply heat by holding the soldering iron on the contact pads for 2 sencods (or more if needed).
|
||||
|
||||

|
||||

|
||||
|
||||
* Repeat this operation for the remaining three ESC
|
||||
|
||||
### Solder the wires of the motors to the ESC
|
||||
|
||||
Solder the prepared wires of the motors to the pads of ESC.
|
||||
Solder the prepared wires of the motors to the pads of the controllers.
|
||||
|
||||

|
||||

|
||||
|
||||
* Repeat this operation for the remaining three ESC
|
||||
|
||||
### Installation of power connectors
|
||||
### Power connectors installation
|
||||
|
||||
#### Preparing wires for XT60 power connectors
|
||||
|
||||
@@ -162,21 +162,21 @@ Solder the prepared wires of the motors to the pads of ESC.
|
||||
|
||||

|
||||
|
||||
1. Blanch two red and black 14AWG power wires 7 cm long for the XT60 pin connector .
|
||||
2. Blanch contact pads of the XT60 pin connector.
|
||||
1. Tin two red and black 14AWG 7 cm long power wires for the XT60 pin connector.
|
||||
2. Tin contact pads of the XT60 pin connector.
|
||||
3. Solder the black wire to the “-” contact of the connector.
|
||||
4. Solder the red wire to the “+” contact of the connector .
|
||||
5. Cut ⌀5 thermal contraction tube (2 sections × 10 mm).
|
||||
6. Put the ⌀5 thermal contraction tube on the wires so that it covers the contact pads of the wires from XT60.
|
||||
7. Shrink the thermal contraction tube with a hot air gun. 
|
||||
4. Solder the red wire to the “+” contact of the connector.
|
||||
5. Cut ⌀5 heat-shrink tubing (2 sections × 10 mm).
|
||||
6. Slip the ⌀5 heat-shrink tubing tube on the wires so that they cover the contact pads of the wires from XT60.
|
||||
7. Shrink the heat-shrink tubing with a hot air gun. 
|
||||
8. Repeat the procedure for XT60 socket connector.
|
||||
|
||||
#### Preparation of the power connector for the 5V control circuit
|
||||
#### Preparation of the 5V power connectors for the control circuit
|
||||
|
||||
1. Trim/pull all pins from one of the connectors. Disconnect it.
|
||||
2. Using a utility knife, pry the retainer off on the remaining connector to release the 3rd wire.
|
||||
1. Trim/pull out all pins from one of the connectors. Disconnect it.
|
||||
2. Using an utility knife, pry the retainer off on the remaining connector to release the 3rd wire.
|
||||
3. Remove the 3rd (orange) wire from the connector, since it is not needed.
|
||||
4. The length of the remaining black and red wires should be 10 – 12 cm.
|
||||
4. The length of the remaining black and red wires should be of 10 – 12 cm.
|
||||
|
||||

|
||||
|
||||
@@ -188,29 +188,29 @@ Solder the prepared wires of the motors to the pads of ESC.
|
||||
|
||||

|
||||
|
||||
Check OPEN CONDITION of the following circuits (absence of the multimeter sound signal):
|
||||
Check OPEN CONDITION of the following circuits (the multimeter does not beep):
|
||||
|
||||
* “BAT+” and “BAT-”
|
||||
* “12V” and “GND”
|
||||
* “5V” and “GND”
|
||||
|
||||
Check CLOSED CONDITION of the following circuits (presence of the multimeter sound signal):
|
||||
Check CLOSED CONDITION of the following circuits (the multimeter beeps):
|
||||
|
||||
* “BAT-” with every contact marked “-” and “GND”
|
||||
* “BAT+”, with every contact marked “+”
|
||||
|
||||
### Blanch the contact pads of the power board
|
||||
### Tin the contact pads of the power board
|
||||
|
||||
1. [Blanch*] (zap.md) the contact pads of the power board
|
||||
2. Using a multimeter, check absence of contact closure on the PCB (check continuity)
|
||||
1. [Tin*] (zap.md) the contact pads of the power board.
|
||||
2. Using a multimeter, check absence of short-circuits on the PCB (check continuity).
|
||||
|
||||

|
||||
|
||||
To make solder neatly fill the entire pad, it should be warmed up. For this purpose, hold the tip of the soldering gun to the contact pad for 2 seconds (or more if needed)
|
||||
By warming up the contact pads of the controller, the tin will evenly fill the entire pad. To do so, apply heat by holding the soldering iron on the contact pads for 2 sencods (or more if needed).
|
||||
|
||||
#### Soldering the XT60 high power connector
|
||||
|
||||
Solder the connector for battery, observing polarity on the contact pads.
|
||||
Solder the connector for battery, taking into account the polarity on the contact pads.
|
||||
|
||||

|
||||
|
||||
@@ -221,7 +221,7 @@ IMPORTANT NOTE about polarity
|
||||
|
||||
#### Soldering of the power connector for the 5V control circuit
|
||||
|
||||
Solder the 5V connector, observing polarity on the contact pads.
|
||||
Solder the 5V connector, taking into account the polarity on the contact pads.
|
||||
(in the picture: the red wire is “+”)
|
||||
|
||||

|
||||
@@ -232,32 +232,32 @@ Solder the 5V connector, observing polarity on the contact pads.
|
||||
|
||||

|
||||
|
||||
* Cut off 2 cm length of the high-power wire
|
||||
* Cut off 2 cm of high-power wire.
|
||||
* Strip on both ends.
|
||||
* Blanch
|
||||
* Make 3 jumpers
|
||||
* Tin.
|
||||
* Make 3 jumpers.
|
||||
* Solder the jumpers according to the diagram.
|
||||
* Check continuity with a multimeter. If necessary, clean with sand paper.
|
||||
* Check for continuity with a multimeter. If necessary, clean with sand paper.
|
||||
|
||||
#### Preparation of the battery compartment
|
||||
|
||||

|
||||
|
||||
* Glue a sticker with marking to the inside of the battery compartment in accordance with the polarity.
|
||||
* Conforming to the polarity, glue the sticker with markings inside the battery compartment.
|
||||
* Stick a strip of adhesive tape to the bottom of the compartment.
|
||||
|
||||
### Installation of the power distribution board
|
||||
|
||||
* Fix the power board to the frame with М3х8 screws and plastic nuts. 
|
||||
> **IMPORTANT** An arrow on the board points to the fore cutout
|
||||
> **IMPORTANT** The white arrow on the BeeRotor board points towards the fore cutout.
|
||||

|
||||
|
||||
#### Installation of elements
|
||||
|
||||
1. Install the nuts into plastic holders. 
|
||||
2. Fix the beams to the frame with М3х16 screws
|
||||
* The beams are installed on top of the frame
|
||||
* Plastic holders are installed on the bottom of the frame. 
|
||||
2. Fix the motor mounts to the frame with М3х16 screws.
|
||||
* The mounts are installed above the frame.
|
||||
* Plastic holders are installed beneath the frame. 
|
||||
3. Arrangement of motors. Check arrangement of the motors (the motors with black nuts should be in the top left and lower right corners). 
|
||||
4. Put the power wires of the ESC through the holes. 
|
||||
|
||||
@@ -274,7 +274,7 @@ IMPORTANT NOTE about polarity
|
||||
|
||||
### Pairing the receiver and transmitter
|
||||
|
||||
1. Connect the radio receiver to the 5V connector. In any connector, GND in the bottom. In the diagram, the power is labeled 5V 
|
||||
1. Connect the radio receiver to the 5V connector. In any connector the GND is in the bottom. In the diagram, the power is labeled 5V 
|
||||
2. Connect the battery. The LED on the radio receiver should be flashing. ![Connecting the battery]
|
||||
|
||||
#### SAFETY when working with the battery
|
||||
@@ -283,10 +283,10 @@ IMPORTANT NOTE about polarity
|
||||
|
||||
#### Enabling the transmitter
|
||||
|
||||
1. Insert the jumper into B/VCC of the radio receiver (short-circuit "ground" and "signal")
|
||||
1. Insert the jumper into B/VCC of the radio receiver (short "ground" and "signal")
|
||||
2. On the transmitter, hold down the BIND KEY button.
|
||||
3. Power up the transmitter (flip the POWER switch, do not release BIND KEY).
|
||||
4. Connect the battery to the copter.
|
||||
4. Connect the battery to the drone.
|
||||
5. Wait for synchronization.
|
||||
6. Disconnect the jumper.
|
||||
7. The LED will remain ON continuously.
|
||||
@@ -295,25 +295,25 @@ IMPORTANT NOTE about polarity
|
||||
|
||||
[Radio equipment troubleshooting manual](radioerrors.md)
|
||||
|
||||
### Checking the motors rotation direction
|
||||
### Checking the motors direction of rotation
|
||||
|
||||
1. Apply stickers to the 18650 battery.
|
||||
2. Install the 18650 battery into the compartment observing polarity. 
|
||||
1. Apply stickers to the 18650 batteries.
|
||||
2. Install the 18650 batteries into the compartment observing polarity. 
|
||||
3. Check that the 5V power plug is connected to the receiver according to the circuit diagram.
|
||||
4. Connect the motor ESC to channel 3 of the CH3 receiver according to the circuit diagram. 
|
||||
4. Connect the motor ESC to channel 3, marked as CH3 on the receiver as on the circuit diagram. 
|
||||
5. Connect external power (battery).
|
||||
6. Turn the transmitter ON
|
||||
6. Turn the transmitter ON.
|
||||
7. Using the left stick, set throttle to 10 %.
|
||||
8. Check the motor rotation direction according to the scheme. 
|
||||
9. If you have to change the rotation direction, toggle any two phase wires of the motor (needs resoldering). 
|
||||
8. Check the motor direction of rotation according to the scheme. 
|
||||
9. If you have to change the rotation direction, swap any two phase wires of the motor (needs resoldering). 
|
||||
|
||||
### Installation of the radio receiver
|
||||
|
||||
1. Install the 30 mm plastic legs on the frame with М3х8 screws.
|
||||
2. Pass the 5V power connector through the slot. 
|
||||
3. Attach the receiver to the bottom of the additional frame using double-sided adhesive tape and noting the engraving. The antennas are to be pointing forward. 
|
||||
2. Pass the 5V power connector through the slit. 
|
||||
3. Attach the receiver to the bottom of the additional frame using double-sided adhesive tape and following the orientation of the engraved arrow. The antennas are to be pointing forward. 
|
||||
4. Install the 3-wire flat cable into the PPM / CH1 channel. 
|
||||
5. Pass through the slot to the 5 V connector.
|
||||
5. Pass them through the slit to the 5 V connector.
|
||||
6. Screw the bottom an additional frame to the legs on the central frame with М3х8 screws. 
|
||||
> **IMPORTANT** The directions of the arrows on the power supply board and the additional frame should coincide
|
||||
|
||||
@@ -341,12 +341,12 @@ should be increased up to 4 – 5.
|
||||
|
||||
### ESC assembly
|
||||
|
||||
1. Stick the double-sided adhesive tape to the base of ESC protective case 
|
||||
2. Put the ESCs into protective cases. Fasten the assembly to the beams of the frame. 
|
||||
1. Stick the double-sided adhesive tape to the base of the ESC protective case 
|
||||
2. Put the ESCs into protective cases. Fasten the assembly to the motor mounts of the frame. 
|
||||
|
||||
### Installation of guard
|
||||
|
||||
1. Attach the lower guard with М3х16 screw to the beams of the frame. 
|
||||
1. Attach the lower guard with М3х16 screw to the motor mounts of the frame. 
|
||||
2. Attach the feet to the plastic holders with М3х16 screws. 
|
||||
3. Attach the 30 mm long legs to the holes of the lower guard with М3х12 screw. 
|
||||
4. Attach the top guard with М3х12 screws. 
|
||||
@@ -360,7 +360,7 @@ Requires the following components:
|
||||
* Additional frame (1 pc)
|
||||
* Battery compartment (1 pc)
|
||||
|
||||
1. Attach the battery compartment on the top additional frame with М3х12 screws and nuts. 
|
||||
1. Attach the battery compartment on top of the additional frame with М3х12 screws and nuts. 
|
||||
2. Attach the top additional frame to the legs with М3х8 screws. 
|
||||
3. Install the battery into the battery compartment.
|
||||
|
||||
@@ -370,13 +370,13 @@ Requires the following components:
|
||||
|
||||

|
||||
|
||||
The copter is ready for configuration!
|
||||
The drone is ready for configuration!
|
||||
|
||||
## Safety notes for assembly ans configuration
|
||||
## Safety notes for assembly and configuration
|
||||
|
||||
1. Remove the propellers.“All ground operations are to be performed with propellers removed. Propellers are to be installed on the motors before the flight only.”
|
||||
2. Disconnect the battery. Keep the power off. “Assembly, configuration, and maintenance should be performed with power disconnected. Connect power only for testing electronic components of the copter. After testing, power is to be disconnected before other works.”
|
||||
3. Call for help. “If you experience problem when completing the task, contact the instructor or the teacher, do not try to solve the problem yourself.”
|
||||
2. Disconnect the battery. Keep the power off. “Assembly, configuration, and maintenance should be performed with power disconnected. Connect power only for testing electronic components of the drone. After testing, power is to be disconnected before other works.”
|
||||
3. Call for help. “If you experience problem when working with the drone, contact the instructor or the teacher, do not try to solve the problem yourself.”
|
||||
|
||||

|
||||
|
||||
@@ -384,6 +384,6 @@ The copter is ready for configuration!
|
||||
|
||||
1. Handle batteries carefully. Avoid falls, bumps, and deformations.
|
||||
2. When connecting (disconnecting) batteries, hold only the connectors, never pull or tug the wires.
|
||||
3. If you see open connectors, violation of insulation or battery compartment integrity, do not touch it, and immediately inform the instructor.
|
||||
3. If you see open connectors, violation of insulation or battery compartment integrity, do not touch it, and immediately inform the instructor or teacher.
|
||||
|
||||
See article [safety precautions when soldering and during copter flight operation](safety.md)
|
||||
See article [safety precautions when soldering and during drone flight operation](safety.md)
|
||||
|
||||
@@ -20,25 +20,25 @@ TODO
|
||||
|
||||

|
||||
|
||||
## Installation of motors
|
||||
## Motor installation
|
||||
|
||||
1. Unpack the motors.
|
||||
2. Attach a motor to the beam with М3х6 hex screws (the shortest screws supplied with the motors).
|
||||
2. Attach a motor to the motor mount with М3х6 hex screws (the shortest screws supplied with the motors).
|
||||
|
||||
A hex wrench included.
|
||||
A hex wrench is included.
|
||||
|
||||
3. Insert M3 nuts (4 pcs) into the plastic holder.
|
||||
|
||||
For convenience, you can use a long screw or pliers
|
||||
The choice is yours to use a long screw or pliers.
|
||||
|
||||
4. Secure the beam, the lower beam guard and the holder with М3х12 screws, using a Phillips screwdriver.
|
||||
5. Using a clamp connect the beam and the bottom guard of the beam.
|
||||
4. Secure the motor mount, the lower motor mount guard and the holder with М3х12 screws, using a Phillips screwdriver.
|
||||
5. Using a clamp connect the motor mount and its bottom guard.
|
||||
|
||||
Cut the remaining part of the clamp (tie wrap) with scissors.
|
||||
Cut the remaining part of the clamp (cable tie) with scissors.
|
||||
|
||||

|
||||
|
||||
## Installation of frame elements
|
||||
## Frame elements installation
|
||||
|
||||
1. Insert the M3 plastic nuts (4 pcs) for mounting the PDB on the frame with М3х8 screws.
|
||||
2. Install 6 mm legs (4 pcs) for attaching the Raspberry Pi to the frame with М3х8 screws.
|
||||
@@ -47,29 +47,29 @@ TODO
|
||||
|
||||

|
||||
|
||||
## Installation of the BEC voltage converter (to be soldered and tested)
|
||||
## BEC voltage converter installation(to be soldered and tested)
|
||||
|
||||
1. Unpack the power board and install the power flat cable.
|
||||
1. Unpack the power board and install the power ribbon cable.
|
||||
2. Switch the multimeter in the DC voltage measurement mode (20V or 200V range).
|
||||
3. Check operation of the power board by connecting the battery
|
||||
3. Check the correct functionning of the power board by connecting the battery.
|
||||
* Voltage measurements are to be made between black and red wires.
|
||||
* Output voltage at the XT30 connector should be equal to the battery voltage (10 V to 12.6 V).
|
||||
* The output voltage at the power flat cable should be between 4.9 V to 5.3 V.
|
||||
* To be measured between the black and the red wires.
|
||||
* The output voltage at the power ribbon cable should be between 4.9 V to 5.3 V.
|
||||
4. Unpack the voltage converter and remove the transparent insulation.
|
||||
5. Solder two additional wires to the BEC
|
||||
* Take 3 male-female wires from the kit (red, black, and any color)
|
||||
* The red and black wires [are to be blanched](zap.md) on both ends using tweezers. The blue wire is to be blanched from the side of the MALE connector.
|
||||
* The red and black wires [are to be tinned](zap.md) on both ends using tweezers. The blue wire is to be tinned from the side of the MALE connector.
|
||||
|
||||
To blanch means:
|
||||
To tin means:
|
||||
* Apply flux to the exposed part of the wire.
|
||||
* Cover with solder.
|
||||
* Cover with tin.
|
||||
|
||||
* Solder the red and the black wires to BEC:
|
||||
|
||||
BLACK -> OUT-
|
||||
RED -> OUT+
|
||||
|
||||
6. Check BEC operation.
|
||||
6. Check BEC functionning.
|
||||
* Solder the BEC to the power board:
|
||||
|
||||
BLACK -> -
|
||||
@@ -77,17 +77,17 @@ TODO
|
||||
|
||||
* Connect the battery and check the voltage at the wires soldered to BEC (from step 5).
|
||||
|
||||
5 V - everything is okay!
|
||||
5 V - great, everything is working properly!
|
||||
|
||||
more than 10 V - disconnect the power and move the yellow jumper to the other tweezers.
|
||||
|
||||
0 V - poorly soldered.
|
||||
* If the BEC outputs 5 V, isolate the soldered connection with a black thermal contraction tube.
|
||||
7. Installation of the LED strip.
|
||||
0 V - not soldered properly.
|
||||
* If the BEC outputs 5 V, isolate the soldered connection with a black heat-shrink tubing.
|
||||
7. LED strip installation
|
||||
|
||||
* Solder the wires from BEC (from step 5) to the LED strip.
|
||||
* Remove the silicone layer on the strip (make an incision with a knife and tear).
|
||||
* [Blanch](zap.md) the contacts of the LED strip.
|
||||
* [Tin](zap.md) the contacts of the LED strip.
|
||||
|
||||
Red -> +5V
|
||||
Black -> GND
|
||||
@@ -95,7 +95,7 @@ TODO
|
||||
|
||||

|
||||
|
||||
## Installation of the 4 in 1 ESC board and the PDB power-board
|
||||
## 4 in 1 ESC board and the PDB power-board installation
|
||||
|
||||
1. Install the 4 in 1 ESC circuit-board as shown in the picture.
|
||||
|
||||
@@ -105,7 +105,7 @@ TODO
|
||||
|
||||
Screw M3 plastic nuts (4 PCs.) to the legs.
|
||||
|
||||
3. Install the PDB power distribution board as shown in the picture (the XT60 connector should point to the tail of the copter).
|
||||
3. Install the PDB power distribution board as shown in the picture (the XT60 connector should point to the tail of the drone).
|
||||
4. Connect the wires of the PCB power supply board and ESC XT30 board.
|
||||
|
||||

|
||||
@@ -130,7 +130,7 @@ TODO
|
||||
> **Hint** If the remote cannot be powered on, or is blocked, see
|
||||
article [remote faults](radioerrors.md).
|
||||
|
||||
## Checking the motors rotation direction
|
||||
## Checking the directions of motors rotation
|
||||
|
||||
1. Turn the transmitter ON
|
||||
|
||||
@@ -143,14 +143,14 @@ article [remote faults](radioerrors.md).
|
||||
2. Connect the S1 orange wire from the ESC board to CH3 on the receiver. Connect external power.
|
||||
3. Using the left stick, set throttle to 10 %.
|
||||
4. Check the motor rotation direction according to the scheme. Repeat for each motor. Thus, it will be clear which motor is controlled.
|
||||
5. If you have to change the rotation direction, toggle any two phase wires of the motor (needs re-connection).
|
||||
5. If you have to change the rotation direction, swap any two phase wires of the motor (needs re-connection).
|
||||
|
||||

|
||||
|
||||
## Installation and connection of the Pixracer flight controller
|
||||
|
||||
1. Install the Pixracer flight controller on double-sided 3M adhesive tape (2 – 3 layers).
|
||||
The flight controller may also be removed from the housing and rigidly mounted on the М3х6 leg.
|
||||
The flight controller may also be removed from the housing and firmly mounted on the М3х6 leg.
|
||||
|
||||
2. Install 40 mm legs using М3х87 screws.
|
||||
|
||||
@@ -160,23 +160,23 @@ article [remote faults](radioerrors.md).
|
||||
|
||||
More [about connecting 4 in 1 ESCs](4in1.md).
|
||||
|
||||
4. Connect the flat cable from the radio receiver to the RCIN connector in Pixracer.
|
||||
4. Connect the ribbon cable from the radio receiver to the RCIN connector in Pixracer.
|
||||
|
||||

|
||||
|
||||
## Installation of Raspberry
|
||||
## Raspberry installation
|
||||
|
||||
1. Turn the copter upside down.
|
||||
1. Turn the drone upside down.
|
||||
|
||||
Install Raspberry on the legs using Raspberry mounting holes.
|
||||
Install the Raspberry on the legs using Raspberry mounting holes.
|
||||
|
||||
USB connectors should point to the tail of the copter.
|
||||
USB connectors should point to the tail of the drone.
|
||||
|
||||
2. Installation of the flat cable for the camera:
|
||||
2. Installation of the ribbon cable for the camera:
|
||||
* lift the latch;
|
||||
* connect the flat cable;
|
||||
* connect the ribbon cable;
|
||||
* close the latch.
|
||||
3. Connecting Raspberry power:
|
||||
3. Connecting Raspberry to power supply:
|
||||
|
||||
5V -> pin 04 (DC power 5 V)
|
||||
GND -> pin 06 (Ground)
|
||||
@@ -188,24 +188,24 @@ article [remote faults](radioerrors.md).
|
||||
|
||||

|
||||
|
||||
## Installation of Arduino and the FlySky radio receiver
|
||||
## Arduino and FlySky radio receiver installation
|
||||
|
||||
1. Mount the pins of the Arduino Nano micro-controller using soldering.
|
||||
1. Solder Arduino Nano micro-controller pins to its board.
|
||||
2. Install the micro-controller into a special mount, and attach to the lower deck using М3х16 screws (4 pcs).
|
||||
3. Using double-sided tape, attach the receiver as shown in the picture.
|
||||
4. Connect the flat cable from the radio receiver to Pixracer as shown in the picture.
|
||||
4. Connect the ribbon cable from the radio receiver to Pixracer as shown in the picture.
|
||||
|
||||
white -> PPM
|
||||
red -> 5V
|
||||
black -> GND
|
||||
orange, green -> currently not used. They are set to the unused pins of the radio receiver
|
||||
orange, green -> currently not used. They are set to the unused pins of the radio receiver.
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation of the RPi camera
|
||||
## RPi camera installation
|
||||
|
||||
1. Attach the mount for the RPi camera assembly to the lower deck with М3х12 screws (2 pcs.)
|
||||
2. Connect the flat cable to the RPi camera.
|
||||
2. Connect the ribbon cable to the RPi camera.
|
||||
3. Install the camera into the mount, secure it with M2 self-tappers.
|
||||
4. Attach Raspberry with 30 mm legs (4 pcs.).
|
||||
|
||||
@@ -225,11 +225,11 @@ article [remote faults](radioerrors.md).
|
||||
|
||||

|
||||
|
||||
## Installation of USB connectors
|
||||
## USB connectors installation
|
||||
|
||||
1. Connect Pixracer to Raspberry using the micro USB - USB cable.
|
||||
2. Connect Arduino to Raspberry using the micro USB - USB cable.
|
||||
|
||||
.
|
||||
.
|
||||
|
||||
Read more about connection in [article](connection.md).
|
||||
|
||||
@@ -3,34 +3,76 @@ Pixhawk / Pixracer firmware flashing
|
||||
|
||||
Pixhawk or Pixracer firmware may be flashed using QGroundControl or command line utilities.
|
||||
|
||||
Various releases of stable PX4 firmwares are available from [Releases at GitHub] (https://github.com/PX4/Firmware/releases).
|
||||
Modified firmware for Clever
|
||||
---
|
||||
|
||||
The name of the firmware file contains encoded information about the target circuit-board and the release. Examples:
|
||||
It is advisable to use a specialized build of PX4 with the necessary fixes and better defaults for the Clever drone. Use the latest stable release in our [GitHub repository](https://github.com/CopterExpress/Firmware/releases) with the word `clever`, for example, `v1.8.2-clever.5`.
|
||||
|
||||
* `px4fmu-v2_default.px4` — firmware for Pixhawk with EKF2.
|
||||
* `px4fmu-v2_lpe.px4` — firmware for Pixhawk with LPE.
|
||||
* `px4fmu-v4_default.px4` — firmware for Pixhawk with EKF2 and LPE (*Clever 3*).
|
||||
* `px4fmu-v3_default.px4` — firmware for newer Pixhawk versions (rev. 3 chip, see Fig. + Bootloader v5) with EKF2 and LPE.
|
||||
<div id="release" style="display:none">
|
||||
<p>Latest stable release: <strong><a id="download-latest-release"></a></strong>.</p>
|
||||
|
||||

|
||||
<ul>
|
||||
<li>Firmware for Pixracer (<strong>Clever 4 / Clever 3</strong>) – <a id="firmware-pixracer" href=""><code>px4fmu-v4_default.px4</code></a>.</li>
|
||||
<li>Firmware for Pixhawk (<strong>Clever 2</strong>) – <a id="firmware-pixhawk" href=""><code>px4fmu-v2_lpe.px4</code></a>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
> **Note** To download the `px4fmu-v3_default.px4` file, you may need to use the `force_upload` command in the command prompt.
|
||||
<script type="text/javascript">
|
||||
// get latest release from GitHub
|
||||
fetch('https://api.github.com/repos/CopterExpress/Firmware/releases').then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(data) {
|
||||
// look for stable release
|
||||
let stable;
|
||||
for (let release of data) {
|
||||
let clever = release.name.indexOf('clever') != -1;
|
||||
if (clever && !release.prerelease && !release.draft) {
|
||||
stable = release;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let el = document.querySelector('#download-latest-release');
|
||||
el.innerHTML = stable.name;
|
||||
el.href = stable.html_url;
|
||||
document.querySelector('#release').style.display = 'block';
|
||||
for (let asset of stable.assets) {
|
||||
console.log(asset.name);
|
||||
if (asset.name == 'px4fmu-v4_default.px4') {
|
||||
document.querySelector('#firmware-pixracer').href = asset.browser_download_url;
|
||||
} else if (asset.name == 'px4fmu-v2_lpe.px4') {
|
||||
document.querySelector('#firmware-pixhawk').href = asset.browser_download_url;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
QGroundControl
|
||||
---
|
||||
|
||||
In QGroundControl, go to Firmware. **After** that, connect Pixhawk / Pixracer via USB.
|
||||
Open the Firmware section in QGroundControl. Then, connect your Pixhawk or Pixracer via USB.
|
||||
|
||||
Select PX4 Flight Stack. To download and upload the standard firmware (the version with EKF2 for Pixhawk), select the "Standard Version" menu item, to load your own firmware file, select "Custom firmware file...", then click OK.
|
||||
Choose PX4 Flight Stack. If you wish to install the official firmware (with EKF2 for Pixhawk), choose "Standard version". In order to flash custom firmware, choose "Custom firmware file..." and click OK.
|
||||
|
||||
> **Warning** Do not disconnect the USB cable until the flashing process is complete.
|
||||
> **Warning** Do not unplug your flight controller from USB during flashing!
|
||||
|
||||
TODO: Figure.
|
||||
Firmware variants
|
||||
---
|
||||
|
||||
The name of the firmware file contains information about the target flight controller and build variant. For example:
|
||||
|
||||
* `px4fmu-v4_default.px4` — firmware for Pixhawk with EKF2 and LPE (**Clever 3** / **Clever 4**).
|
||||
* `px4fmu-v2_lpe.px4` — firmware for Pixhawk with LPE (**Clever 2**).
|
||||
* `px4fmu-v2_default.px4` — firmware for Pixhawk with EKF2.
|
||||
* `px4fmu-v3_default.px4` — firmware for newer Pixhawk versions (rev. 3 chip, see Fig. + Bootloader v5) with EKF2 and LPE.
|
||||
|
||||

|
||||
|
||||
> **Note** In order to flash the `px4fmu-v3_default.px4` file, you may need to use the `force_upload` command in the command prompt.
|
||||
|
||||
Command prompt
|
||||
---
|
||||
|
||||
PX4 may be compiled from the source and automatically loaded to the circuit-board from the command prompt.
|
||||
PX4 may be compiled from the source and automatically flashed to the flight controller from the command prompt.
|
||||
|
||||
To do this, clone the PX4 repository:
|
||||
|
||||
@@ -44,9 +86,9 @@ Select the appropriate version (tag) using `git checkout`. Then compile and uplo
|
||||
make px4fmu-v4_default upload
|
||||
```
|
||||
|
||||
Where `px4fmu-v4_default` is the required firmware version.
|
||||
Where `px4fmu-v4_default` is the required firmware variant.
|
||||
|
||||
To upload the `v3` firmware to Pixhawk, you may need the `force_upload` command:
|
||||
In order to upload the `v3` firmware to Pixhawk, you may need to use the `force_upload` option:
|
||||
|
||||
```
|
||||
make px4fmu-v3_default force-upload
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Working with a laser rangefinder
|
||||
|
||||
## Rangefinder VL53L1X
|
||||
## VL53L1X Rangefinder
|
||||
|
||||
The rangefinder model recommended for Clever is STM VL53L1X. This rangefinder can measure distances from 0 to 4 m while ensuring high measurement accuracy.
|
||||
|
||||
@@ -8,7 +8,7 @@ The [image for Raspberry Pi](microsd_images.md) contains pre-installed correspon
|
||||
|
||||
### Connecting to Raspberry Pi
|
||||
|
||||
> **Note** For correct operation of a laser rangefinder with a flight countroller <a id="download-firmware" href="https://github.com/CopterExpress/Firmware/releases">custom PX4 firmware</a> is needed. See more about firmware in [corresponding article](firmware.md).
|
||||
> **Note** You need to flash a <a id="download-firmware" href="https://github.com/CopterExpress/Firmware/releases">custom PX4 firmware</a> on your flight controller for the rangefinder to work correctly. See more about firmware in the [corresponding article](firmware.md).
|
||||
|
||||
<script type="text/javascript">
|
||||
fetch('https://api.github.com/repos/CopterExpress/Firmware/releases').then(res => res.json()).then(function(data) {
|
||||
@@ -21,44 +21,44 @@ The [image for Raspberry Pi](microsd_images.md) contains pre-installed correspon
|
||||
});
|
||||
</script>
|
||||
|
||||
Connect the rangefinder to pins 3V, GND, SCL and SDA via the I²C interface:
|
||||
Connect the rangefinder to the 3V, GND, SCL and SDA pins via the I²C interface:
|
||||
|
||||
<img src="../assets/raspberry-vl53l1x.png" alt="Connecting VL53L1X" height=600>
|
||||
|
||||
If the pin marked GND is occupied, you can use another free one using the [pinout](https://pinout.xyz).
|
||||
If the pin marked GND is occupied, you can use any other ground pin (look at the [pinout](https://pinout.xyz) for reference).
|
||||
|
||||
> **Hint** Via the I²C interface, you can connect several peripheral devices simultaneously. For this purpose, use a parallel connection.
|
||||
> **Hint** You can connect several peripheral devices via the I²C interface simultaneously. Use a parallel connection for that.
|
||||
|
||||
### Enabling
|
||||
### Enabling the rangefinder
|
||||
|
||||
[Connect via SSH](ssh.md) and edit file `~/catkin_ws/src/clever/clever/launch/clever.launch` so that driver VL53L1X is enabled:
|
||||
[Connect via SSH](ssh.md) and edit file `~/catkin_ws/src/clever/clever/launch/clever.launch` so that the VL53L1X driver is enabled:
|
||||
|
||||
```xml
|
||||
<arg name="rangefinder_vl53l1x" default="true"/>
|
||||
```
|
||||
|
||||
By default, the rangefinder driver sends the data to Pixhawk (via topic `/mavros/distance_sensor/rangefinder_sub`). To view data from the topic, use command:
|
||||
By default, the rangefinder driver sends the data to Pixhawk via the `/mavros/distance_sensor/rangefinder_sub` topic. To view data from the topic, use the following command:
|
||||
|
||||
```(bash)
|
||||
```bash
|
||||
rostopic echo mavros/distance_sensor/rangefinder_sub
|
||||
```
|
||||
|
||||
### PX4 settings
|
||||
|
||||
To use the rangefinder data in [PX4 must be configured](px4_parameters.md).
|
||||
PX4 should be properly [configured](px4_parameters.md) to use the rangefinder data.
|
||||
|
||||
When using EKF2 (`SYS_MC_EST_GROUP` = `ekf2`):
|
||||
Set the following parameters when EKF2 is used (`SYS_MC_EST_GROUP` = `ekf2`):
|
||||
|
||||
* `EKF2_HGT_MODE` = `2` (Range sensor) – when flying over horizontal floor;
|
||||
* `EKF2_HGT_MODE` = `2` (Range sensor) – for flights over horizontal floor;
|
||||
* `EKF2_RNG_AID` = `1` (Range aid enabled) – in other cases.
|
||||
|
||||
When using LPE (`SYS_MC_EST_GROUP` = `local_position_estimator, attitude_estimator_q`):
|
||||
Set the following parameters when LPE is used (`SYS_MC_EST_GROUP` = `local_position_estimator, attitude_estimator_q`):
|
||||
|
||||
* The "pub agl as lpos down" flag is ticked in the `LPE_FUSION` parameter – when flying over horizontal floor.
|
||||
* The "pub agl as lpos down" flag should be set in the `LPE_FUSION` parameter – for flights over horizontal floor.
|
||||
|
||||
### Obtaining data from Python
|
||||
### Receiving data in Python
|
||||
|
||||
To obtain data from the topic, create a subscriber:
|
||||
In order to receive data from the topic, create a subscriber:
|
||||
|
||||
```python
|
||||
from sensor_msgs.msg import Range
|
||||
@@ -66,7 +66,7 @@ from sensor_msgs.msg import Range
|
||||
# ...
|
||||
|
||||
def range_callback(msg):
|
||||
# Processing new data from the rangefinder
|
||||
# Process data from the rangefinder
|
||||
print 'Rangefinder distance:', msg.range
|
||||
|
||||
rospy.Subscriber('mavros/distance_sensor/rangefinder_sub', Range, range_callback)
|
||||
@@ -74,13 +74,13 @@ rospy.Subscriber('mavros/distance_sensor/rangefinder_sub', Range, range_callback
|
||||
|
||||
### Data visualization
|
||||
|
||||
To build a chart using the data from the rangefinder, one can use rqt_multiplot.
|
||||
You may use rqt_multiplot tool to plot rangefinder data.
|
||||
|
||||
rviz may be used for data visualization. To do this, add a topic of the `sensor_msgs/Range` type to visualization:
|
||||
|
||||
<img src="../assets/rviz-range.png" alt="Range in rviz">
|
||||
|
||||
See [read more about rviz and rqt](rviz.md).
|
||||
Read more [about rviz and rqt](rviz.md).
|
||||
|
||||
<!--
|
||||
### Connecting to Pixhawk / Pixracer
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
# MAVROS
|
||||
|
||||
Main documentation: [http://wiki.ros.org/mavros](http://wiki.ros.org/mavros)
|
||||
Main article is available in the official documentations: [http://wiki.ros.org/mavros](http://wiki.ros.org/mavros)
|
||||
|
||||
MAVROS \(MAVLink + ROS\) is a package for ROS that provides the possibility of controlling drones via the [MAVLink](mavlink.md) protocol. MAVROS supports flight stacks PX4 and APM. Communication is established via UART, USB, TCP or UDP.
|
||||
MAVROS \(MAVLink + ROS\) is a ROS package that allows controlling drones via the [MAVLink](mavlink.md) protocol. MAVROS supports PX4 and APM flight stacks. Communication may be established via UART, USB, TCP or UDP.
|
||||
|
||||
MAVROS subscribes to certain ROS topics while waiting for commands, publishes telemetry to other topics, and provides services.
|
||||
MAVROS subscribes to certain ROS topics that can be used to send commands, publishes telemetry to other topics, and provides services.
|
||||
|
||||
The MAVROS node is automatically started in the launch-file of Clever. For [setting the type of connection] (connection.md), see the `fcu_conn` argument.
|
||||
The MAVROS node is automatically started in the Clever launch-file. In order to [set the type of connection](connection.md), change the `fcu_conn` argument.
|
||||
|
||||
> **Hint** Simplified interaction with the copter may be with the use of the [`simple_offboard`] package (simple_offboard.md).
|
||||
> **Hint** Simplified interaction with the drone is possible with the use of [`simple_offboard`] package (simple_offboard.md).
|
||||
|
||||
<!-- -->
|
||||
|
||||
> **Note** In the `clever` package, some MAVROS plugins are disabled (to save resources). For more information, see the `plugin_blacklist` parameter in file `/home/pi/catkin_ws/src/clever/clever/launch/mavros.launch`.
|
||||
> **Note** Some MAVROS plugins are disabled by default in the `clever` package in order to save resources. For more information, see the `plugin_blacklist` parameter in `/home/pi/catkin_ws/src/clever/clever/launch/mavros.launch`.
|
||||
|
||||
## Main services
|
||||
|
||||
`/mavros/set_mode` — set [flight mode](modes.md) of the controller. Usually, the OFFBOARD mode is set \(for control from Raspberry Pi\).
|
||||
`/mavros/set_mode` — set [flight mode](modes.md) of the controller. Most often used to set the OFFBOARD mode to accept commands from Raspberry Pi.
|
||||
|
||||
`/mavros/cmd/arming` — enable or disable drone motors \\ (change the armed status \\).
|
||||
`/mavros/cmd/arming` — arm or disarm drone motors \(change arming status\).
|
||||
|
||||
## Main published topics
|
||||
|
||||
`/mavros/state` — status of connection to the flight controller. The flight controller mode.
|
||||
`/mavros/state` — status of connection to the flight controller and flight controller mode.
|
||||
|
||||
`/mavros/local_position/pose` — local position of the copter in the ENU system of coordinates, and its orientation.
|
||||
`/mavros/local_position/pose` — local position and orientation of the copter in the ENU coordinate system.
|
||||
|
||||
`/mavros/local_position/velocity` — current speed in the local coordinates. Angular velocities.
|
||||
`/mavros/local_position/velocity` — current speed in local coordinates and angular velocities.
|
||||
|
||||
`/mavros/global_position/global` — the current global position \(latitude, longitude, altitude\).
|
||||
`/mavros/global_position/global` — current global position \(latitude, longitude, altitude\).
|
||||
|
||||
`/mavros/global_position/local` — the global position in the [UTM] system of coordinates (https://ru.wikipedia.org/wiki/Система_координат_UTM).
|
||||
`/mavros/global_position/local` — the global position in the [UTM](https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system) coordinate system.
|
||||
|
||||
`/mavros/global_position/rel_alt` — relative altitude \(relative to the engines ON altitude\).
|
||||
`/mavros/global_position/rel_alt` — relative altitude \(relative to the arming altitude\).
|
||||
|
||||
Messages published in the topics may be viewed by using the `rostopic` utility, e.g., `rostopic echo /mavros/state`. See more in [working with ROS](ros.md).
|
||||
Messages published in the topics may be viewed with the `rostopic` utility, e.g., `rostopic echo /mavros/state`. See more in [working with ROS](ros.md).
|
||||
|
||||
## Main topics for publication
|
||||
|
||||
`/mavros/setpoint_position/local` — set the target position and the yaw of the drone \(in the ENU system of coordinates\).
|
||||
`/mavros/setpoint_position/local` — set target position and yaw of the drone \(in the ENU coordinate system\).
|
||||
|
||||
`/mavros/setpoint_position/cmd_vel` — set the target linear velocity of the drone.
|
||||
`/mavros/setpoint_position/cmd_vel` — set target linear velocity of the drone.
|
||||
|
||||
`/mavros/setpoint_attitude/attitude` and `/mavros/setpoint_attitude/att_throttle` — set target attitude and throttle level.
|
||||
|
||||
@@ -48,8 +48,8 @@ Messages published in the topics may be viewed by using the `rostopic` utility,
|
||||
|
||||
### Topics for sending raw packets
|
||||
|
||||
`/mavros/setpoint_raw/local` — sending packet [SET\_POSITION\_TARGET\_LOCAL\_NED](https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_LOCAL_NED). Allows setting target position/target speed and target yaw/angular yaw velocity. The values to be set are selected using the `type_mask` field.
|
||||
`/mavros/setpoint_raw/local` — sends [SET\_POSITION\_TARGET\_LOCAL\_NED](https://mavlink.io/en/messages/common.html#SET_POSITION_TARGET_LOCAL_NED) message. Allows setting target position/target speed and target yaw/angular yaw velocity. The values to be set are selected using the `type_mask` field.
|
||||
|
||||
`/mavros/setpoint_raw/attitude` — sending packet [SET\_ATTITUDE\_TARGET](https://pixhawk.ethz.ch/mavlink/#SET_ATTITUDE_TARGET). Allows setting the target attitude /angular velocity and throttle level. The values to be set are selected using the `type_mask` field
|
||||
`/mavros/setpoint_raw/attitude` — sends [SET\_ATTITUDE\_TARGET](https://mavlink.io/en/messages/common.html#SET_ATTITUDE_TARGET) message. Allows setting the target attitude /angular velocity and throttle level. The values to be set are selected using the `type_mask` field
|
||||
|
||||
`/mavros/setpoint_raw/global` — sending packet [SET\_POSITION\_TARGET\_GLOBAL\_INT](https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT). Allows setting the target attitude in global coordinates \(latitude, longitude, altitude\) and flight speed. **Not supported in PX4** \([issue](https://github.com/PX4/Firmware/issues/7552)\).
|
||||
`/mavros/setpoint_raw/global` — sends [SET\_POSITION\_TARGET\_GLOBAL\_INT](https://mavlink.io/en/messages/common.html#SET_POSITION_TARGET_GLOBAL_INT). Allows setting the target attitude in global coordinates \(latitude, longitude, altitude\) and flight speed. **May not be supported in earlier releases of PX4** \([issue](https://github.com/PX4/Firmware/issues/7552)\).
|
||||
|
||||
101
docs/en/optical_flow.md
Normal file
101
docs/en/optical_flow.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Use of Optical Flow
|
||||
|
||||
Running the technology "Optical Flow" offers the possibility of POSCTL flight mode, and autonomous flight operating on a camera pointed downwards that detects changes of ground texture.
|
||||
|
||||
## Enabling
|
||||
|
||||
> **Hint** It is recommanded to use [special PX4 firmware for Clever](firmware.md#прошивка-для-клевера).
|
||||
|
||||
The use of a rangefinder is essential. [Connect and setup laser-ranging sensor VL53L1X](laser.md), according to the manual.
|
||||
|
||||
Enable Optical Flow in the file `~/catkin_ws/src/clever/clever/launch/clever.launch`:
|
||||
|
||||
```xml
|
||||
<arg name="optical_flow" default="true"/>
|
||||
```
|
||||
|
||||
Optical Flow publishes data in `mavros/px4flow/raw/send` topic. In the topic `optical_flow/debug` is also published a vizualization, that can be viewed with [web_video_server](web_video_server.md).
|
||||
|
||||
> **Info** Correct connexion and [setup](camera.md) of the camera module is needed for proper functioning.
|
||||
|
||||
## Setup of the flight controler
|
||||
|
||||
When using **EKF2** (parameter `SYS_MC_EST_GROUP` = `ekf2`):
|
||||
|
||||
* `EKF2_AID_MASK` – flag 'use optical flow' is on.
|
||||
* `EKF2_OF_DELAY` – 0.
|
||||
* `EKF2_OF_QMIN` – 10.
|
||||
* `EKF2_OF_N_MIN` – 0.05.
|
||||
* `EKF2_OF_N_MAX` - 0.2.
|
||||
* `SENS_FLOW_ROT` – No rotation.
|
||||
* `SENS_FLOW_MAXHGT` – 4.0 (for the rangefinder VL53L1X)
|
||||
* `SENS_FLOW_MINHGT` – 0.01 (for the rangefinder VL53L1X)
|
||||
* Optional: `EKF2_HGT_MODE` – range sensor (cf. [rangefinder setup](laser.md)).
|
||||
|
||||
When using **LPE** (parameter `SYS_MC_EST_GROUP` = `local_position_estimator, attitude_estimator_q`):
|
||||
|
||||
* `LPE_FUSION` – flags 'fuse optical flow' and 'flow gyro compensation' are on.
|
||||
* `LPE_FLW_QMIN` – 10.
|
||||
* `LPE_FLW_SCALE` – 1.0.
|
||||
* `LPE_FLW_R` – 0.1.
|
||||
* `LPE_FLW_RR` – 0.0.
|
||||
* `SENS_FLOW_ROT` – No rotation.
|
||||
* `SENS_FLOW_MAXHGT` – 4.0 (for the rangefinder VL53L1X)
|
||||
* `SENS_FLOW_MINHGT` – 0.01 (for the rangefinder VL53L1X)
|
||||
* Optional: `LPE_FUSION` – falg 'pub agl as lpos down' is on (сf. [rangefinder setup](laser.md).
|
||||
|
||||
[The `selfcheck.py` utility](selfcheck.md) will help you verify that all settings are corectly set.
|
||||
|
||||
## POSCTL flight
|
||||
|
||||
Setup POSCTL to be one of PX4 flight modes and then select POSCTL.
|
||||
|
||||
## Autonomous flight
|
||||
|
||||
The module [simple_offboard](simple_offboard.mb) enables autonomous flight.
|
||||
|
||||
Example of take off and leveling at 1.5m above the ground:
|
||||
|
||||
```python
|
||||
navigate(z=1.5, frame_id='body', auto_arm=True)
|
||||
```
|
||||
|
||||
Flying forward for 1m:
|
||||
|
||||
```python
|
||||
navigate(x=1.5, frame_id='body')
|
||||
```
|
||||
|
||||
[Navigation using ArUco-markers](aruco_marker) and [using VPE] are available when using Optical Flow.
|
||||
|
||||
## Additional settings
|
||||
|
||||
<!-- TODO: статья по пидам -->
|
||||
|
||||
If the copter has an unstable position using VPE, try to increase the *P* coefficient of speed PID controler - parameters are `MPC_XY_VEL_P` and `MPC_Z_VEL_P`.
|
||||
|
||||
If the copter has an unstable height, try increasing `MPC_Z_VEL_P` coefficient or getting better hover throttle - `MPC_THR_HOVER`.
|
||||
|
||||
If the copter is consistently yawing, try:
|
||||
|
||||
* recalibrate gyroscopes;
|
||||
* recalibrate magnetometer;
|
||||
* different values for `EKF2_MAG_TYPE` parameter, that indicates how data from the magnetometer is used in EKF2;
|
||||
* changing values of `EKF2_MAG_NOISE`, `EKF2_GYR_NOISE`, `EKF2_GYR_B_NOISE` parameters.
|
||||
|
||||
If the copter's height is deviating, try:
|
||||
|
||||
* increasing the value of `MPC_Z_VEL_P` coefficient;
|
||||
* change the value of `MPC_THR_HOVER` parameter;
|
||||
* add `MPC_ALT_MODE` = 2 (Terrain following).
|
||||
|
||||
When using Optical Flow, the maximal horizontal speed is further limited. This is an indirect influence of the parameter `SENS_FLOW_MAXR` (maximal reliable "angular speed" of the optical flow). In normal flight mode, control loops will be adjusted so that Optical Flow values do not exceed 50% of this parameter.
|
||||
|
||||
## Errors
|
||||
|
||||
If errors of `EKF INTERNAL CHECKS` occur, try to restart EKF2. To do so, enter in the MAVLink-console : в MAVLink-консоли:
|
||||
|
||||
```nsh
|
||||
ekf2 stop
|
||||
ekf2 start
|
||||
```
|
||||
66
docs/en/ros-install.md
Normal file
66
docs/en/ros-install.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# ROS Kinetic package installation and setup
|
||||
|
||||
In order to use tools such as rqt, rviz and others as well as running the simulator (SITL), you will need to install and setup ROS package
|
||||
|
||||
> **Hint** For more details on installation refer to [the main article](http://wiki.ros.org/kinetic/Installation/Ubuntu).
|
||||
|
||||
<!-- -->
|
||||
|
||||
> **Hint** If you are using Ubuntu 18.04, you will need to install ROS Melodic instead of ROS Kinetic. A complete guide of the installation is available [here](http://wiki.ros.org/melodic/Installation/Ubuntu).
|
||||
|
||||
## ROS Kinetic installation on Ubuntu
|
||||
|
||||
To find the correct package version, you will need to change the settings of your repositories. Go to "Software and updates" and enable `restricted`, `universe` and `multiverse`.
|
||||
|
||||
Set up your system so that software form `packages.ros.org` can be installed :
|
||||
|
||||
```bash
|
||||
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
|
||||
```
|
||||
|
||||
Configure access keys in your system for correct download:
|
||||
|
||||
```bash
|
||||
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
|
||||
```
|
||||
|
||||
Make sure that your packages are up to date:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
```
|
||||
|
||||
Now you can install the ROS package itself.
|
||||
|
||||
+ If you plan to use ROS together with the simulator (also includes tools such as rqt, rviz and others):
|
||||
|
||||
```bash
|
||||
sudo apt-get install ros-kinetic-desktop-full
|
||||
```
|
||||
|
||||
+ If you plan to use ROS exclusively for tools rqt, rviz etc.:
|
||||
|
||||
```bash
|
||||
sudo apt-get install ros-kinetic-desktop
|
||||
```
|
||||
|
||||
After the package has installed, initialize `rosdep`.
|
||||
Package `rosdep` will allow to easily install dependecies for the source files that you whish to compile. Running some essential components of ROS will as well require this package.
|
||||
|
||||
```bash
|
||||
sudo rosdep init
|
||||
rosdep update
|
||||
```
|
||||
|
||||
If you are not confortable with entering environment variables manually each time, you may configure it in a way that it add itself in your bash session on every new shell startup:
|
||||
|
||||
```bash
|
||||
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
If you whish to install any additionnal packages for yout ROS Kinetic simply use:
|
||||
|
||||
```bash
|
||||
sudo apt-get install ros-kinetic-PACKAGE
|
||||
```
|
||||
@@ -14,6 +14,8 @@ ROS is already installed on [the RPi image](microsd_images.md).
|
||||
|
||||
To use ROS on a PC, we recommend using Ubuntu Linux (or a virtual machine such as Parallels Desktop Lite](https://itunes.apple.com/ru/app/parallels-desktop-lite/id1085114709?mt=12) or [VirtualBox](https://www.virtualbox.org)).
|
||||
|
||||
> **Note** For ROS Kinetic distribution, we recommend using Ubuntu 16.04.
|
||||
|
||||
Concepts
|
||||
---
|
||||
|
||||
@@ -23,9 +25,9 @@ Main article: http://wiki.ros.org/Nodes
|
||||
|
||||
ROS node is a special program (usually written in Python or C++) that communicates with other nodes via ROS topics and ROS services. Dividing complex robotic systems into isolated nodes provides certain advantages: reduced coupling of the code, increases re-usability and reliability.
|
||||
|
||||
Many robotic libraries, and the driver are executed in the form of ROS-nodes.
|
||||
Many robotic libraries and the drivers are executed in the form of ROS-nodes.
|
||||
|
||||
In order to turn an ordinary program into a ROS node, connect to it a `rospy` or `roscpp` library, and add the initialization code.
|
||||
In order to turn an ordinary program into a ROS node, include a `rospy` or `roscpp` library, and insert the initialization code.
|
||||
|
||||
An example of a ROS node in Python:
|
||||
|
||||
@@ -43,7 +45,7 @@ Main article: http://wiki.ros.org/Topics
|
||||
|
||||
A topic is a named data bus used by the nodes for exchanging messages. Any node can *post* a message in a random topic, and *subscribe* to an arbitrary topic.
|
||||
|
||||
An example of posting a message of type [`std_msgs/String`](http://docs.ros.org/api/std_msgs/html/msg/String.html) (line) in topic `/foo` in Python:
|
||||
An example of [`std_msgs/String`](http://docs.ros.org/api/std_msgs/html/msg/String.html) (line) message type posting in topic `/foo` in Python:
|
||||
|
||||
```python
|
||||
from std_msgs.msg import String
|
||||
@@ -77,9 +79,9 @@ rostopic echo /mavros/state
|
||||
|
||||
Main article: http://wiki.ros.org/Services
|
||||
|
||||
A service is an analogue to the function that can be called from one node, and processed in another one. The service has a name that is similar to the name of the topic, and 2 message types: request type and response type.
|
||||
A service can be assimilated to the a function that can be called from one node, and processed in another one. The service has a name that is similar to the name of the topic, and 2 message types: request type and response type.
|
||||
|
||||
An example of invoking a ROS service from Python:
|
||||
An example ROS service invoking from Python:
|
||||
|
||||
```python
|
||||
from clever.srv import GetTelemetry
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Automatic check
|
||||
|
||||
Before flying (especially autonomous), you can use several methods of automatic self-testing of the quadcopter subsystems.
|
||||
It is generally a good idea to perform some checks before flight, especially before an autonomous one. There are several methods of automated self-checks of the drone subsystems.
|
||||
|
||||
## <span>selfcheck</span>.py
|
||||
|
||||
Utility `selfcheck.py` is part of `clever` package, and automatically tests the main aspects of the ROS platform and the PX4. The utility is pre-installed on [the Raspberry Pi image](microsd_images.md).
|
||||
The `selfcheck.py` utility script is part of the `clever` package; it performs automated tests of the main aspects of the ROS platform and PX4. The utility is pre-installed on [the Raspberry Pi image](microsd_images.md).
|
||||
|
||||
To initiate it, type in [the Raspberry Pi console](ssh.md):
|
||||
In order to run it, enter the following command in [the Raspberry Pi console](ssh.md):
|
||||
|
||||
```(bash)
|
||||
rosrun clever selfcheck.py
|
||||
@@ -16,17 +16,20 @@ rosrun clever selfcheck.py
|
||||
|
||||
Description of some checks:
|
||||
|
||||
* FCU – checking proper connection with the flight controller;
|
||||
* IMU – checking correctness of the data from IMU;
|
||||
* Local position – presence of the local position of the drone;
|
||||
* Velocity estimation – drone velocity estimation (**if this check fails, never take off offline!**);
|
||||
* Global position (GPS) — presence of the global position (GPS required);
|
||||
* Camera — proper operation of the Raspberry camera.
|
||||
* FCU – checks for proper connection with the flight controller;
|
||||
* IMU – checks whether the data from from IMU is sane;
|
||||
* Local position – checks presence of local position data;
|
||||
* Velocity estimation – checks whether drone velocity estimation is sane(**autonomous flight is not to be performed if this check fails!**);
|
||||
* Global position (GPS) — checks for presence of global position data (GPS module is required for this check);
|
||||
* Camera — checks for proper operation of the Raspberry camera.
|
||||
* ArUco — checks whether [ArUco](aruco.md) detection is working
|
||||
* VPE — checks whether VPE data is published
|
||||
* Rangefinder — checks whether [rangefinder](laser.md) data is published
|
||||
|
||||
## commander check
|
||||
|
||||
To check the main sub systems of PX4 and the possibility of arming at the moment, you can perform command `commander check` in the MAVLink console.
|
||||
In order check the main subsystems of PX4 and the possibility of arming at the moment you can run the `commander check` command in the MAVLink console.
|
||||
|
||||
<img src="../assets/commander-check.png">
|
||||
|
||||
When using SITL instead of the MAVLink console, use a terminal with SITL running.
|
||||
If you're running SITL, you should use the terminal where PX4 simulation is running instead of the MAVLink console.
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
Simple OFFBOARD
|
||||
===
|
||||
|
||||
> **Note** Documentation for the [image](microsd_images.md), versions, starting with **0.15**. For older versions refer to [documentation for version **0.14**](https://github.com/CopterExpress/clever/blob/v0.14/docs/ru/simple_offboard.md).
|
||||
> **Note** Documentation for the [image](microsd_images.md), versions, starting with **0.15**. For older versions refer to [documentation for version **0.14**](https://github.com/droneExpress/clever/blob/v0.14/docs/ru/simple_offboard.md).
|
||||
|
||||
The `simple_offboard` module of the `clever` package is intended for simplified programming of an autonomous drone ([mode](modes.md) `OFFBOARD`). It allows setting the desired flight tasks, and automatically transforms [the system of coordinates](frames.md).
|
||||
<!-- -->
|
||||
|
||||
> **Hint** For autonomous flights it is recommanded to use [special firmware PX4 for Clever](firmware.md#прошивка-для-клевера).
|
||||
|
||||
The `simple_offboard` module of the `clever` package is intended for simplified programming of the autonomous drone ([mode](modes.md) `OFFBOARD`). It allows setting the desired flight tasks, and automatically transforms [the system of coordinates](frames.md).
|
||||
|
||||
`simple_offboard` is a high level way of interacting with the flight controller. For a more low level work, see [mavros](mavros.md).
|
||||
|
||||
@@ -12,7 +16,7 @@ Main services are `get_telemetry` (receiving all telemetry), `navigate` (flying
|
||||
The use of Python language
|
||||
---
|
||||
|
||||
To use the services, create proxies to them. An example of the program the declared proxies to all `simple_offboard` services:
|
||||
To use the services, create proxies to them. Following is an example of the program that declares proxies to all `simple_offboard` services:
|
||||
|
||||
```python
|
||||
import rospy
|
||||
@@ -42,7 +46,7 @@ API description
|
||||
|
||||
### get_telemetry
|
||||
|
||||
Obtaining complete telemetry of the copter.
|
||||
Obtaining complete telemetry of the drone.
|
||||
|
||||
Parameters:
|
||||
|
||||
@@ -52,12 +56,12 @@ Response format:
|
||||
|
||||
* `frame_id` — frame;
|
||||
* `connected` – whether there is a connection to <abbr title="Flight Control Unit flight controller">FCU</abbr>;
|
||||
* `armed` `armed` state of propellers (the propellers are armed, if true);
|
||||
* `armed` - state of propellers (the propellers are armed, if true);
|
||||
* `mode` – current [flight mode](modes.md);
|
||||
* `x, y, z` — local position of the copter *(m)*;
|
||||
* `x, y, z` — local position of the drone *(m)*;
|
||||
* `lat, lon` – latitude, longitude *(degrees)*, [GPS](gps.md) is to be available;
|
||||
* `alt` – altitude in the global system of coordinates (standard [WGS-84](https://ru.wikipedia.org/wiki/WGS_84), not <abbr title="Above Mean Sea Level">AMSL</abbr>!), [GPS](gps.md) is to be available ;
|
||||
* `vx, vy, vz` – copter velocity *(m/s)*;
|
||||
* `vx, vy, vz` – drone velocity *(m/s)*;
|
||||
* `pitch` – pitch angle *(radians)*;
|
||||
* `roll` – roll angle *(radians)*;
|
||||
* `yaw` — yaw angle *(radians)*;
|
||||
@@ -67,16 +71,16 @@ Response format:
|
||||
* `voltage` – total battery voltage *(V)*;
|
||||
* `cell_voltage` – battery cell voltage *(V)*.
|
||||
|
||||
> **Note** Fields that are available for some reason will contain the `NaN` value.
|
||||
> **Note** Fields that are unavailabe for any reason will contain the `NaN` value.
|
||||
|
||||
Displaying copter coordinates `x`, `y` and `z` in the local system of coordinates:
|
||||
Displaying drone coordinates `x`, `y` and `z` in the local system of coordinates:
|
||||
|
||||
```python
|
||||
telemetry = get_telemetry()
|
||||
print telemetry.x, telemetry.y, telemetry.z
|
||||
```
|
||||
|
||||
Displaying copter altitude relative to [the card of ArUco tags](aruco.md):
|
||||
Displaying drone altitude relative to [the card of ArUco tags](aruco.md):
|
||||
|
||||
```python
|
||||
telemetry = get_telemetry(frame_id='aruco_map')
|
||||
@@ -109,7 +113,7 @@ Parameters:
|
||||
* `yaw` — yaw angle *(radians)*;
|
||||
* `yaw_rate` – angular yaw velocity (used for setting the yaw to `NaN`) *(rad/s)*;
|
||||
* `speed` – flight speed (setpoint speed) *(m/s)*;
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
* `frame_id` – [system of coordinates](frames.md) for values `x`, `y`, `z`, `vx`, `vy`, `vz`. Example: `map`, `body`, `aruco_map`. Default value: `map`.
|
||||
|
||||
> **Note** To fly without changing the yaw angle, it is sufficient to set the `yaw` to `NaN` (angular velocity by default is 0).
|
||||
@@ -132,7 +136,7 @@ Flying to point 5:0 without changing the yaw angle (`yaw` = `NaN`, `yaw_rate` =
|
||||
navigate(x=5, y=0, z=3, speed=0.8, yaw=float('nan'))
|
||||
```
|
||||
|
||||
Flying 3 m to the right from the copter:
|
||||
Flying 3 m to the right from the drone:
|
||||
|
||||
```python
|
||||
navigate(x=0, y=-3, z=0, speed=1, frame_id='body')
|
||||
@@ -179,12 +183,12 @@ Parameters:
|
||||
* `yaw` — yaw angle *(radians)*;
|
||||
* `yaw_rate` – angular yaw velocity (used for setting the yaw to `NaN`) *(rad/s)*;
|
||||
* `speed` – flight speed (setpoint speed) *(m/s)*;
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
* `frame_id` – [system of coordinates](frames.md), given `z` и `yaw` (Default value: `map`).
|
||||
|
||||
> **Note** To fly without changing the yaw angle, it is sufficient to set the `yaw` to `NaN` (angular velocity by default is 0).
|
||||
|
||||
Flying to a global point at the speed of 5 m/s, while remaining at current altitude (`yaw` will be set to 0, the copter will face East):
|
||||
Flying to a global point at the speed of 5 m/s, while remaining at current altitude (`yaw` will be set to 0, the drone will face East):
|
||||
|
||||
```python
|
||||
navigate_global(lat=55.707033, lon=37.725010, z=0, speed=5, frame_id='body')
|
||||
@@ -204,7 +208,7 @@ rosservice call /navigate_global "{lat: 55.707033, lon: 37.725010, z: 0.0, yaw:
|
||||
|
||||
### set_position
|
||||
|
||||
Set the target by position and yaw. This service may be used to specify the continuous flow of target points, for example, for flying along complex trajectories (circular, arcuate, etc.).
|
||||
Set the target for position and yaw. This service may be used to specify the continuous flow of target points, for example, for flying along complex trajectories (circular, arcuate, etc.).
|
||||
|
||||
> **Hint** For flying to a point in a straight line or takeoff, use the [`navigate`] higher-level service (#navigate).
|
||||
|
||||
@@ -213,7 +217,7 @@ Parameters:
|
||||
* `x`, `y`, `z` — point coordinates *(m)*;
|
||||
* `yaw` — yaw angle *(radians)*;
|
||||
* `yaw_rate` – angular yaw velocity (used for setting the yaw to NaN) *(rad/s)*;
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
* `frame_id` – [system of coordinates](frames.md), given `x`, `y`, `z` и `yaw` (Default value: `map`).
|
||||
|
||||
Hovering on the spot:
|
||||
@@ -247,12 +251,12 @@ Setting speed and yaw.
|
||||
* `vx`, `vy`, `vz` – required flight speed *(m/s)*;
|
||||
* `yaw` — yaw angle *(radians)*;
|
||||
* `yaw_rate` – angular yaw velocity (used for setting the yaw to NaN) *(rad/s)*;
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
* `frame_id` – [system of coordinates](frames.md), given `vx`, `vy`, `vz` и `yaw` (Default value: `map`).
|
||||
|
||||
> **Note** Parameter `frame_id` specifies only the orientation of the resulting velocity vector, but not its length.
|
||||
|
||||
Flying forward (relative to the copter) at the speed of 1 m/s:
|
||||
Flying forward (relative to the drone) at the speed of 1 m/s:
|
||||
|
||||
```python
|
||||
set_velocity(vx=1, vy=0.0, vz=0, frame_id='body')
|
||||
@@ -266,41 +270,41 @@ set_velocity(vx=0.4, vy=0.0, vz=0, yaw=float('nan'), yaw_rate=0.4, frame_id='bod
|
||||
|
||||
### set_attitude
|
||||
|
||||
Setting pitch, roll, yaw and throttle level (approximate analogue to control in [the `STABILIZED` mode](modes.md)). This service may be used for lower level monitoring of the copter behavior or controlling the copter, if no reliable data about its position are available.
|
||||
Setting pitch, roll, yaw and throttle level (approximate analogue to control in [the `STABILIZED` mode](modes.md)). This service may be used for lower level monitoring of the drone behavior or controlling the drone, if no reliable data on its position are available.
|
||||
|
||||
Parameters:
|
||||
|
||||
* `pitch`, `roll`, `yaw` – required pitch, roll, and yaw angle *(radians)*;
|
||||
* `thrust` — throttle level from 0 (no throttle, propellers are stopped) to 1 (full throttle).
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
* `frame_id` – [system of coordinates](frames.md), given `yaw` (Default value: `map`).
|
||||
|
||||
### set_rates
|
||||
|
||||
Setting pitch, roll, and yaw angular velocity and the throttle level (approximate analogue to control in [the `ACRO` mode](modes.md)). This is the lowest copter control level (excluding direct control of motor rotation speed). This service may be used to automatically perform acrobatic tricks (e.g., flips).
|
||||
Setting pitch, roll, and yaw angular velocity and the throttle level (approximate analogue to control in [the `ACRO` mode](modes.md)). This is the lowest drone control level (excluding direct control of motor rotation speed). This service may be used to automatically perform acrobatic tricks (e.g., flips).
|
||||
|
||||
Parameters:
|
||||
|
||||
* `pitch_rate`, `roll_rate`, `yaw_rate` – angular pitch, roll, and yaw velocity *(rad/s)*;
|
||||
* `thrust` — throttle level from 0 (no throttle, propellers are stopped) to 1 (full throttle).
|
||||
* `auto_arm` – switch the copter to `OFFBOARD` and arm automatically (**the copter will take off**);
|
||||
* `auto_arm` – switch the drone to `OFFBOARD` and arm automatically (**the drone will take off**);
|
||||
|
||||
### land
|
||||
|
||||
Transfer the copter to the landing [mode](modes.md) (`AUTO.LAND` or similar).
|
||||
Transfer the drone to the landing [mode](modes.md) (`AUTO.LAND` or similar).
|
||||
|
||||
> **Note** For automated disabling the propellers after landing [parameter PX4](px4_parameters.md) `COM_DISARM_LAND` is to be set to a value > 0.
|
||||
> **Note** For automatic propeller disabling after landing, [parameter PX4](px4_parameters.md) `COM_DISARM_LAND` is to be set to a value > 0.
|
||||
|
||||
Landing the copter:
|
||||
Landing the drone:
|
||||
|
||||
```python
|
||||
res = land()
|
||||
|
||||
if res.success:
|
||||
print 'Copter is landing'
|
||||
print 'drone is landing'
|
||||
```
|
||||
|
||||
Landing the copter (command line):
|
||||
Landing the drone (command line):
|
||||
|
||||
```(bash)
|
||||
rosservice call /land "{}"
|
||||
@@ -309,7 +313,7 @@ rosservice call /land "{}"
|
||||
<!--
|
||||
### release
|
||||
|
||||
Stop publishing setpoints to the copter (release control). Required to continue monitoring by means of [MAVROS](mavros.md).
|
||||
Stop publishing setpoints to the drone (release control). Required to continue monitoring by means of [MAVROS](mavros.md).
|
||||
-->
|
||||
|
||||
Additional materials
|
||||
|
||||
@@ -4,9 +4,18 @@ Code examples
|
||||
Python
|
||||
---
|
||||
|
||||
<!-- markdownlint-disable MD031 -->
|
||||
|
||||
> **Note** When using cyrillic simbols with UTF-8 encoding, specify the encoding in the beginning of the program:
|
||||
> ```python
|
||||
> # -*- coding: utf-8 -*-
|
||||
> ```
|
||||
|
||||
<!-- markdownlint-enable MD031 -->
|
||||
|
||||
### # {#distance}
|
||||
|
||||
The function of determining the distance between two points (**important**: the points are to be in the same [system of coordinates](frames.md)):
|
||||
Calculating the distance between two points (**important**: the points are to be in the same [system of coordinates](frames.md)):
|
||||
|
||||
```python
|
||||
def get_distance(x1, y1, z1, x2, y2, z2):
|
||||
@@ -15,7 +24,7 @@ def get_distance(x1, y1, z1, x2, y2, z2):
|
||||
|
||||
### # {#distance-global}
|
||||
|
||||
A function for approximate determination of the distance (in meters) between two global coordinates (latitude/longitude):
|
||||
Approximation of distance (in meters) between two global coordinates (latitude/longitude):
|
||||
|
||||
```python
|
||||
def get_distance_global(lat1, lon1, lat2, lon2):
|
||||
@@ -24,16 +33,16 @@ def get_distance_global(lat1, lon1, lat2, lon2):
|
||||
|
||||
### # {#block-takeoff}
|
||||
|
||||
Takeoff and waiting for the end of takeoff:
|
||||
Takeoff and waiting for it to finish:
|
||||
|
||||
```python
|
||||
z = 2 # altitude
|
||||
tolerance = 0.2 # precision of altitude check (m)
|
||||
|
||||
# Remembering the initial point
|
||||
# Saving the initial point
|
||||
start = get_telemetry()
|
||||
|
||||
# Take off to the altitude of 2 m
|
||||
# Take off and leveling at 2 m above the ground
|
||||
print navigate(z=z, speed=0.5, frame_id='body', auto_arm=True)
|
||||
|
||||
# Waiting for takeoff
|
||||
@@ -47,7 +56,7 @@ while True:
|
||||
|
||||
### # {#block-nav}
|
||||
|
||||
Flying to a point and waiting for the copter to arrive at it:
|
||||
Flying towards a point and waiting for copter's arrival:
|
||||
|
||||
```python
|
||||
tolerance = 0.2 # precision of arrival check (m)
|
||||
@@ -93,10 +102,10 @@ tf_listener = tf2_ros.TransformListener(tf_buffer)
|
||||
|
||||
# ...
|
||||
|
||||
# Creating as PoseStamped object (or getting it from the topic):
|
||||
# PoseStamped object creation (or getting it from a topic):
|
||||
pose = PoseStamped()
|
||||
pose.header.frame_id = 'map' # frame, which is the position is specified
|
||||
pose.header.stamp = rospy.get_rostime() # the moment for which the position is specified (current time)
|
||||
pose.header.stamp = rospy.get_rostime() # the instant for which the position is specified (current time)
|
||||
pose.pose.position.x = 1
|
||||
pose.pose.position.y = 2
|
||||
pose.pose.position.z = 3
|
||||
@@ -111,7 +120,7 @@ new_pose = tf_buffer.transform(pose, frame_id, transform_timeout)
|
||||
|
||||
### # {#upside-down}
|
||||
|
||||
Determining whether the copter is turned over:
|
||||
Determining whether the copter is turned upside-down:
|
||||
|
||||
```python
|
||||
PI_2 = math.pi / 2
|
||||
@@ -122,7 +131,7 @@ flipped = not -PI_2 <= telem.pitch <= PI_2 or not -PI_2 <= telem.roll <= PI_2
|
||||
|
||||
### # {#angle-hor}
|
||||
|
||||
Calculating the copter total angle to the horizon:
|
||||
Calculating the copter total horizontal angle:
|
||||
|
||||
```python
|
||||
PI_2 = math.pi / 2
|
||||
@@ -158,7 +167,7 @@ while not rospy.is_shutdown():
|
||||
|
||||
### # {#rate}
|
||||
|
||||
repeating an action with the frequency of 10 Hz:
|
||||
repeating an action at a frequency of 10 Hz:
|
||||
|
||||
```python
|
||||
r = rospy.Rate(10)
|
||||
@@ -179,7 +188,7 @@ from mavros_msgs.msg import RCIn
|
||||
# ...
|
||||
|
||||
def pose_update(pose):
|
||||
# Processing new data about the copter position
|
||||
# Processing new data of copter's position
|
||||
pass
|
||||
|
||||
# Other handler functions
|
||||
@@ -191,7 +200,7 @@ rospy.Subscriber('/mavros/battery', BatteryState, battery_update)
|
||||
rospy.Subscriber('mavros/rc/in', RCIn, rc_callback)
|
||||
```
|
||||
|
||||
Information about MAVROS topics us available at [the link](mavros.md).
|
||||
Information about MAVROS topics is available at [the link](mavros.md).
|
||||
|
||||
<!-- markdownlint-disable MD044 -->
|
||||
|
||||
@@ -199,7 +208,7 @@ Information about MAVROS topics us available at [the link](mavros.md).
|
||||
|
||||
<!-- markdownlint-enable MD044 -->
|
||||
|
||||
An example of sending an arbitrary [MAVLink message](mavlink.md) to the copter:
|
||||
Sending an arbitrary [MAVLink message](mavlink.md) to the copter:
|
||||
|
||||
```python
|
||||
# ...
|
||||
@@ -223,14 +232,14 @@ mavlink_pub.publish(ros_msg)
|
||||
|
||||
### # {#rc-sub}
|
||||
|
||||
Reaction to switching the mode on the transmitter (may be used for starting an offline flight, see [example](https://gist.github.com/okalachev/b709f04522d2f9af97e835baedeb806b)):
|
||||
Return on mode switching with the transmitter (may be used for starting an autonomous flight, see [example](https://gist.github.com/okalachev/b709f04522d2f9af97e835baedeb806b)):
|
||||
|
||||
```python
|
||||
from mavros_msgs.msg import RCIn
|
||||
|
||||
# Called when new data are received from the transmitter
|
||||
# Called when new data is received from the transmitter
|
||||
def rc_callback(data):
|
||||
# Arbitrary reaction to switching the toggle switch on the transmitter
|
||||
# Return on switch toggling of the transmitter
|
||||
if data.channels[5] < 1100:
|
||||
# ...
|
||||
pass
|
||||
@@ -247,8 +256,53 @@ rospy.Subscriber('mavros/rc/in', RCIn, rc_callback)
|
||||
rospy.spin()
|
||||
```
|
||||
|
||||
### # {#set_mode}
|
||||
|
||||
Change the [flight mode](modes.md) to arbitrary one:
|
||||
|
||||
```python
|
||||
from mavros_msgs.srv import SetMode
|
||||
|
||||
# ...
|
||||
|
||||
set_mode = rospy.ServiceProxy('mavros/set_mode', SetMode)
|
||||
|
||||
# ...
|
||||
|
||||
set_mode(custom_mode='STABILIZED')
|
||||
```
|
||||
|
||||
### # {#flip}
|
||||
|
||||
Flip:
|
||||
Flip on roll:
|
||||
|
||||
TODO
|
||||
```python
|
||||
import math
|
||||
|
||||
# ...
|
||||
|
||||
def flip():
|
||||
start = get_telemetry() # saving starting position
|
||||
|
||||
set_rates(thrust=1) # bump up
|
||||
rospy.sleep(0.2)
|
||||
|
||||
set_rates(roll_rate=30, thrust=0.2) # maximum roll rate
|
||||
|
||||
while True:
|
||||
telem = get_telemetry()
|
||||
|
||||
if -math.pi + 0.1 < telem.roll < -0.2:
|
||||
break
|
||||
|
||||
rospy.loginfo('finish flip')
|
||||
set_position(x=start.x, y=start.y, z=start.z, yaw=start.yaw) # finish flip
|
||||
|
||||
print navigate(z=2, speed=1, frame_id='body', auto_arm=True) # take off
|
||||
rospy.sleep(10)
|
||||
|
||||
rospy.loginfo('flip')
|
||||
flip()
|
||||
```
|
||||
|
||||
Requires the [special PX4 firmware for Clever](firmware.md#modified-firmware-for-clever). Before running a flip, take all necessary safty precautions.
|
||||
|
||||
Reference in New Issue
Block a user