Compare commits

..

65 Commits

Author SHA1 Message Date
Alexey Rogachevskiy
998796045c aruco_pose nodelet cleanup (#239)
* aruco_pose: Unhardcode contour refinement

Besides, this was basically a no-op anyway, since dynamic parameters
overwrote that anyway.

* aruco_pose: Late-construct objects that use ROS

* aruco_map: Don't create/store node handle

* aruco_pose: Don't assume dist_coeffs size

* aruco_pose: more const == more better

* aruco_pose: Be more obvious about changing variables

* aruco_pose: Fix building for Kinetic

* aruco_pose: Remove global add_definitions
2020-05-30 01:59:51 +03:00
Alexey Rogachevskiy
c5e954b56a optical_flow: Use functional-style parameter fetching 2020-05-30 01:58:14 +03:00
Alexey Rogachevskiy
2814fea9cd optical_flow: Pass nodelet callback queue to TransformListener 2020-05-30 01:58:14 +03:00
Alexey Rogachevskiy
b85326c02a optical_flow: Use cv::Mat(std::vector, bool) ctor for dist_coeffs_ 2020-05-30 01:58:14 +03:00
Alexey Rogachevskiy
98d5d50607 aruco_pose: Prevent OpenCV from crashing (#238)
* aruco_pose: Add tests that crash OpenCV

* aruco_pose: Don't try to interpolate single points
2020-05-30 01:57:14 +03:00
Alexey Rogachevskiy
69c46786de builder: Set apt retries to 3
This should lower the number of builds that failed due to
repositories being unstable
2020-05-29 21:25:58 +03:00
Oleg Kalachev
abb495275b docs: translate robocross-2019 article 2020-05-26 06:54:42 +03:00
Oleg Kalachev
044d6c6d33 docs: switch lpe and ekf2 settings in aruco map navigation articles 2020-05-21 21:01:16 +03:00
Alexey Rogachevskiy
22d5a356b6 clover: Update ros3djs, THREE.js 2020-05-18 16:25:56 +03:00
Alexey Rogachevskiy
c7828557ca standalone_install: Fail on error 2020-05-16 15:49:38 +03:00
Alexey Rogachevskiy
514c0f1b65 Flysky FS-A8S article (#229)
* docs: Add FS-A8S article draft

* docs: Fix image links

* docs/flysky_a8s: Make images appear smaller

* docs: Add animated images

* docs/flysky_a8s: Proofreading

* docs/flysky_a8s: Sync up header to summary entry

* docs/flysky_a8s: Add Flysky FS-A8S article (en)

* docs/flysky_a8s: More proofreading
2020-05-12 12:35:05 +03:00
Oleg Kalachev
6a79b8292a docs: little fix 2020-05-08 17:02:36 +03:00
Oleg Kalachev
10b6661266 docs: add images for ROS javascript article 2020-05-08 16:54:10 +03:00
Oleg Kalachev
7f2cb1c63e docs: add using ROS with javascript article 2020-05-08 16:51:15 +03:00
Oleg Kalachev
1d48c79c52 docs: rename package and service to clover 2020-05-07 19:43:25 +03:00
Oleg Kalachev
ad46a0918c Temporarily disable documentation upload 2020-05-07 19:03:51 +03:00
Alexey Rogachevskiy
9487522992 clover: Use saner min marker perimeter rate 2020-05-07 18:07:11 +03:00
Oleg Kalachev
80b35d3b90 Change camera calibration name to main_camera_optical 2020-05-06 19:49:45 +03:00
VeneraDal
12e292c9d7 docs: add Russian and English trainer mode article (#219)
* Upload trainer_mode.md

Add an English version of the file

* Update trainer mode article

* Update SUMMARY.md

For adding the trainer mode article

* Update SUMMARY.md

For adding trainer mode article

* docs: edit trainer mode articles

* docs: move trainer mode article in summary

* docs: fix

* Update SUMMARY.md

Co-authored-by: Oleg Kalachev <okalachev@gmail.com>
2020-05-06 19:41:17 +03:00
Alexey Rogachevskiy
9b28e9cad2 travis: Resolve some issues with validation 2020-05-06 16:39:24 +03:00
Alexey Rogachevskiy
d57ab82f38 docs: Fix up according to MD037 2020-05-06 15:03:39 +03:00
Oleg Kalachev
c8da639eab Merge pull request #227 from goldarte/target-system-id
Add fcu_sys_id argument to clover.launch
2020-05-06 13:30:46 +03:00
Alexey Rogachevskiy
c7e7edec70 builder: Enable ROS services after first boot (#208)
Merging this into master, this should not break anything.
2020-05-06 13:24:53 +03:00
Oleg Kalachev
72869fcf2b Merge pull request #216 from CopterExpress/new-camera-calib
Average camera calibration
2020-05-01 01:04:04 +03:00
Oleg Kalachev
387d2c2341 Update documentation links 2020-05-01 00:39:38 +03:00
Oleg Kalachev
a665caeea3 docs: small fixes 2020-04-30 20:04:20 +03:00
Oleg Kalachev
3079d2a3e1 docs: typos 2020-04-30 20:02:31 +03:00
Alexey Rogachevskiy
7d5bdf4f22 docs/migrate20: Remove extra space character 2020-04-30 19:35:51 +03:00
Oleg Kalachev
2a3efa2908 docs: reflect camera frame configuration changes 2020-04-30 05:03:29 +03:00
Oleg Kalachev
ddee29a0e8 docs: English version on 0.20 image transition article + add to summary 2020-04-30 04:19:09 +03:00
Oleg Kalachev
8596be07c6 docs: add article on migration to v0.20 2020-04-30 04:02:52 +03:00
Oleg Kalachev
a480ebe80a Continue renaming to Clover 2020-04-30 03:41:14 +03:00
Oleg Kalachev
77ca50b901 docs: change rpi version on main page 2020-04-30 01:39:56 +03:00
Oleg Kalachev
ead9b904fa docs: small fix 2020-04-29 05:05:22 +03:00
Oleg Kalachev
90956ecd44 docs: English version of new camera calibration article 2020-04-29 04:44:52 +03:00
Oleg Kalachev
f070c60e14 docs: add example of wait_for_message for rangefinder 2020-04-28 05:53:45 +03:00
Arthur Golubtsov
68edf07f6e Add fcu_sys_id argument to clover.launch and mavros.launch to set up target_system_id parameter in mavros 2020-04-27 15:36:08 +03:00
Oleg Kalachev
7f161b1ad7 Fix Travis badge 2020-04-26 08:00:33 +03:00
Oleg Kalachev
a41a432ef3 Fixes 2020-04-23 21:20:29 +03:00
Oleg Kalachev
2b896b06d9 Move manual installation and running to clover/readme.md 2020-04-23 21:19:46 +03:00
Oleg Kalachev
5070cafbfb Update main readme 2020-04-23 20:54:15 +03:00
Oleg Kalachev
9c0af7285c docs: decrease video size in clever-show article 2020-04-20 18:25:06 +03:00
Arthur Golubtsov
c67d937842 docs: Add article about clever-show (#226)
* docs: Add article about clever-show

* docs: Fix mistake in sentence in en clever-show article

* docs: Add dots to clever-show article

* docs: resolve conflict

Co-authored-by: Oleg Kalachev <okalachev@gmail.com>
2020-04-20 13:30:20 +03:00
Oleg Kalachev
b79d87242f docs: add p4df2 team article in NTI olympics 2020 2020-04-18 15:42:55 +03:00
Alamoris
4d0ddcb319 docs: fix .html link typo 2020-04-18 15:12:09 +03:00
Oleg Kalachev
3ff4ee6c4c docs: add instructions on easy way of sending documentation updates 2020-04-18 14:36:15 +03:00
Oleg Kalachev
90049182cf image: add navigate_wait example 2020-04-09 15:44:48 +03:00
Oleg Kalachev
33f4601fdc docs: add example on retrieving one camera frame 2020-04-09 15:32:45 +03:00
Arthur Golubtsov
2a62891d60 Install pyzbar to image (#225)
* Install pyzbar to image

I suggest installing pyzbar to RPi image for making barcodes scanning easier during different competitions.

* pyzbar: Add libzbar0 install

* pyzbar: Add simple tests

* pyzbar: Update docs
2020-04-09 04:16:05 +03:00
Alamoris
b043737e91 docs: An article on how to configure an image for flying on wall markers (#221)
* docs: Add a draft of an article about flying using wall markers

* docs: Add paragraph about setting up launch files

* docs: Fix typos and add some links

* Small logic fixes

* docs: fix

* docs: Add description setting for earlier version

* docs: Fix sed string

* docs: Add article about wall aruco in summary
2020-04-08 15:13:32 +03:00
Oleg Kalachev
c61a0485ff docs: fix 2020-04-07 17:35:07 +03:00
Arthur Golubtsov
f1539177eb docs: Update install instruction for qr code scan 2020-04-07 17:25:11 +03:00
Arthur Golubtsov
6cbbb5580e docs (en): Update qr code scan instruction and script 2020-04-07 17:06:05 +03:00
Arthur Golubtsov
c2d22ae12a docs: fix codestyle in camera.md 2020-04-07 16:58:20 +03:00
Arthur Golubtsov
7160d804cd docs (ru): Update qr code scan instruction and script 2020-04-07 16:47:03 +03:00
Oleg Kalachev
3ac51baf7c docs: small fix
It’s better not to nest the throttled image topic as this way consumers would subscribe to appropriate camera_info topic automatically
2020-04-07 02:58:08 +03:00
Alamoris
48cc82001d docs: Fix typo 2020-04-03 21:15:04 +03:00
Alamoris
43eae885c6 docs: Add small mounting deck model 2020-04-03 21:13:14 +03:00
Alexey Rogachevskiy
2bb29ff389 clover: Add required OpenCV libraries 2020-03-31 23:56:04 +03:00
Oleg Kalachev
3811cbff3e examples: fix markers example link 2020-03-19 13:10:05 +03:00
Oleg Kalachev
2d49f58fb8 image: add markers flight example 2020-03-19 13:09:31 +03:00
Oleg Kalachev
bbcf75b806 docs: add gyro calibration snippet 2020-03-18 21:52:19 +03:00
Oleg Kalachev
3e79c25147 Camera info resolution matching camera resolution is not necessary with auto rescaling 2020-02-20 19:16:23 +03:00
Oleg Kalachev
2f69ad3f43 Keep only one calibration file 2020-02-13 23:17:52 +03:00
Oleg Kalachev
b08ad5a618 Camera calibration: set principal point strictly to the center 2020-02-13 23:14:05 +03:00
203 changed files with 21070 additions and 1226 deletions

View File

@@ -1,4 +1,5 @@
sudo: required
os: linux
dist: xenial
language: generic
services:
- docker
@@ -43,7 +44,7 @@ jobs:
- cd images && zip ${IMAGE_NAME}.zip ${IMAGE_NAME}
deploy:
provider: releases
api_key: ${GITHUB_OAUTH_TOKEN}
token: ${GITHUB_OAUTH_TOKEN}
file: ${IMAGE_NAME}.zip
skip_cleanup: true
on:
@@ -82,18 +83,18 @@ jobs:
- ./check_unused_assets.py
- gitbook install
- gitbook build
deploy:
provider: pages
local-dir: _book
skip-cleanup: true
github-token: ${GITHUB_OAUTH_TOKEN}
keep-history: true
target-branch: master
repo: CopterExpress/clever.coex.tech
fqdn: clever.coex.tech
verbose: true
on:
branch: master
# deploy:
# provider: pages
# local_dir: _book
# skip_cleanup: true
# token: ${GITHUB_OAUTH_TOKEN}
# keep_history: true
# target_branch: master
# repo: CopterExpress/clover.coex.tech
# fqdn: clover.coex.tech
# verbose: true
# on:
# branch: master
- stage: Annotate
name: Auto-generate changelog
language: python

105
README.md
View File

@@ -1,103 +1,40 @@
# CLEVER
# COEX Clover Drone Kit
<img src="docs/assets/clever4-front-white.png" align="right" width="400px" alt="CLEVER drone">
<img src="docs/assets/clever4-front-white.png" align="right" width="400px" alt="Clover Drone">
CLEVER (Russian: *"Клевер"*, meaning *"Clover"*) is an educational programmable drone kit consisting of an unassembled quadcopter, open source software and documentation. The kit includes Pixhawk/Pixracer autopilot running PX4 firmware, Raspberry Pi 3 as companion computer, a camera for computer vision navigation as well as additional sensors and peripheral devices.
Clover is an educational programmable drone kit consisting of an unassembled quadcopter, open source software and documentation. The kit includes Pixracer-compatible autopilot running PX4 firmware, Raspberry Pi 4 as companion computer, a camera for computer vision navigation as well as additional sensors and peripheral devices.
Copter Express has implemented a large number of different autonomous drone projects using exactly the same platform: [automated pizza delivery](https://www.youtube.com/watch?v=hmkAoZOtF58) in Samara and Kazan, coffee delivery in Skolkovo Innovation Center, [autonomous quadcopter with charging station](https://www.youtube.com/watch?v=RjX6nUqw1mI) for site monitoring and security, winning drones on [Robocross-2016](https://www.youtube.com/watch?v=dGbDaz_VmYU) and [Robocross-2017](https://youtu.be/AQnd2CRczbQ) competitions and many others.
The main documentation is available [on Gitbook](https://clover.coex.tech/).
**The main documentation is available [on Gitbook](https://clever.coex.tech/).**
Official website: <a href="https://coex.tech/clover">coex.tech/clover</a>.
Use it to learn how to assemble, configure, pilot and program autonomous CLEVER drone.
## Video compilation
[![Clover Drone Kit autonomy compilation](http://img.youtube.com/vi/u3omgsYC4Fk/hqdefault.jpg)](https://youtu.be/u3omgsYC4Fk)
Clover drone is used on a wide range of educational events, including [Copter Hack](https://www.youtube.com/watch?v=xgXheg3TTs4), WorldSkills Drone Operation competition, [Autonomous Vehicles Track of NTI Olympics 20162020](https://www.youtube.com/watch?v=E1_ehvJRKxg), Quadro Hack 2019 (National University of Science and Technology MISiS), Russian Robot Olympiad (autonomous flights), and others.
## Raspberry Pi image
**Preconfigured image for Raspberry Pi 3 with installed and configured software, ready to fly, is available [in the Releases section](https://github.com/CopterExpress/clever/releases).**
Preconfigured image for Raspberry Pi with installed and configured software, ready to fly, is available [in the Releases section](https://github.com/CopterExpress/clover/releases).
[![Build Status](https://travis-ci.org/CopterExpress/clever.svg?branch=master)](https://travis-ci.org/CopterExpress/clever)
[![Build Status](https://travis-ci.org/CopterExpress/clover.svg?branch=master)](https://travis-ci.org/CopterExpress/clover)
Image includes:
Image features:
* Raspbian Buster
* ROS Melodic
* [ROS Melodic](http://wiki.ros.org/melodic)
* Configured networking
* OpenCV
* mavros
* Periphery drivers (`pigpiod`, `rpi_ws281x`, etc)
* CLEVER software bundle for autonomous drone control
* [`mavros`](http://wiki.ros.org/mavros)
* Periphery drivers for ROS ([GPIO](https://clover.coex.tech/en/gpio.html), [LED strip](https://clover.coex.tech/en/leds.html), etc)
* `aruco_pose` package for marker-assisted navigation
* `clover` package for autonomous drone control
API description (in Russian) for autonomous flights is available [on GitBook](https://clever.coex.tech/simple_offboard.html).
API description for autonomous flights is available [on GitBook](https://clover.coex.tech/en/simple_offboard.html).
## Manual installation
Install ROS Melodic according to the [documentation](http://wiki.ros.org/melodic/Installation), then [create a Catkin workspace](http://wiki.ros.org/catkin/Tutorials/create_a_workspace).
Clone this repo to directory `~/catkin_ws/src/clever`:
```bash
cd ~/catkin_ws/src
git clone https://github.com/CopterExpress/clever.git clever
```
All the required ROS packages (including `mavros` and `opencv`) can be installed using `rosdep`:
```bash
cd ~/catkin_ws/
rosdep install -y --from-paths src --ignore-src
```
Build ROS packages (on memory constrained platforms you might be going to need to use `-j1` key):
```bash
cd ~/catkin_ws
catkin_make -j1
```
To complete `mavros` install you'll need to install `geographiclib` datasets:
```bash
curl https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh | sudo bash
```
You may optionally install udev rules to provide `/dev/px4fmu` symlink to your PX4-based flight controller connected over USB. Copy `99-px4fmu.rules` to your `/lib/udev/rules.d` folder:
```bash
cd ~/catkin_ws/src/clever/clever/config
sudo cp 99-px4fmu.rules /lib/udev/rules.d
```
Alternatively you may change the `fcu_url` property in `mavros.launch` file to point to your flight controller device.
## Running
Enable systemd service `roscore` (if not running):
```bash
sudo systemctl enable /home/<username>/catkin_ws/src/clever/builder/assets/roscore.service
sudo systemctl start roscore
```
To start connection to SITL, use:
```bash
roslaunch clever sitl.launch
```
To start connection to the flight controller, use:
```bash
roslaunch clever clever.launch
```
> Note that the package is configured to connect to `/dev/px4fmu` by default (see [previous section](#manual-installation)). Install udev rules or specify path to your FCU device in `mavros.launch`.
Also, you can enable and start the systemd service:
```bash
sudo systemctl enable /home/<username>/catkin_ws/src/clever/deploy/clever.service
sudo systemctl start clever
```
For manual package installation and running see [`clover` package documentation](clover/README.md).
## License
While the Clever platform source code is available under the MIT License, note, that the [documentation](docs/) is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
While the Clover platform source code is available under the MIT License, note, that the [documentation](docs/) is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

View File

@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.0)
project(aruco_pose)
add_definitions(-std=c++11 -Wall -g)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
@@ -25,7 +23,7 @@ find_package(catkin REQUIRED COMPONENTS
)
find_package(OpenCV 3 REQUIRED COMPONENTS core imgproc calib3d)
if ("${OpenCV_VERSION_MINOR}" LESS "3")
if ("${OpenCV_VERSION_MINOR}" LESS "9")
message(STATUS "OpenCV version too low, using vendored ArUco package")
include(vendor/VendorOpenCV.cmake)
else()
@@ -229,4 +227,5 @@ if (CATKIN_ENABLE_TESTING)
add_rostest(test/test_parser_empty_map.test)
add_rostest(test/test_node_failure.test)
add_rostest(test/largemap.test)
add_rostest(test/crash_opencv.test)
endif()

View File

@@ -58,10 +58,9 @@ using cv::Mat;
class ArucoDetect : public nodelet::Nodelet {
private:
ros::NodeHandle nh_, nh_priv_;
tf2_ros::TransformBroadcaster br_;
tf2_ros::Buffer tf_buffer_;
tf2_ros::TransformListener tf_listener_{tf_buffer_};
std::unique_ptr<tf2_ros::TransformBroadcaster> br_;
std::unique_ptr<tf2_ros::Buffer> tf_buffer_;
std::unique_ptr<tf2_ros::TransformListener> tf_listener_;
std::shared_ptr<dynamic_reconfigure::Server<aruco_pose::DetectorConfig>> dyn_srv_;
cv::Ptr<cv::aruco::Dictionary> dictionary_;
cv::Ptr<cv::aruco::DetectorParameters> parameters_;
@@ -81,30 +80,32 @@ private:
public:
virtual void onInit()
{
nh_ = getNodeHandle();
nh_priv_ = getPrivateNodeHandle();
ros::NodeHandle& nh_ = getNodeHandle();
ros::NodeHandle& nh_priv_ = getPrivateNodeHandle();
br_.reset(new tf2_ros::TransformBroadcaster());
tf_buffer_.reset(new tf2_ros::Buffer());
tf_listener_.reset(new tf2_ros::TransformListener(*tf_buffer_, nh_));
int dictionary;
nh_priv_.param("dictionary", dictionary, 2);
nh_priv_.param("estimate_poses", estimate_poses_, true);
nh_priv_.param("send_tf", send_tf_, true);
dictionary = nh_priv_.param("dictionary", 2);
estimate_poses_ = nh_priv_.param("estimate_poses", true);
send_tf_ = nh_priv_.param("send_tf", true);
if (estimate_poses_ && !nh_priv_.getParam("length", length_)) {
NODELET_FATAL("can't estimate marker's poses as ~length parameter is not defined");
ros::shutdown();
}
readLengthOverride();
readLengthOverride(nh_priv_);
nh_priv_.param<std::string>("known_tilt", known_tilt_, "");
nh_priv_.param("auto_flip", auto_flip_, false);
known_tilt_ = nh_priv_.param<std::string>("known_tilt", "");
auto_flip_ = nh_priv_.param("auto_flip", false);
nh_priv_.param<std::string>("frame_id_prefix", frame_id_prefix_, "aruco_");
frame_id_prefix_ = nh_priv_.param<std::string>("frame_id_prefix", "aruco_");
camera_matrix_ = cv::Mat::zeros(3, 3, CV_64F);
dist_coeffs_ = cv::Mat::zeros(8, 1, CV_64F);
dictionary_ = cv::aruco::getPredefinedDictionary(static_cast<cv::aruco::PREDEFINED_DICTIONARY_NAME>(dictionary));
parameters_ = cv::aruco::DetectorParameters::create();
parameters_->cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX;
image_transport::ImageTransport it(nh_);
image_transport::ImageTransport it_priv(nh_priv_);
@@ -170,8 +171,8 @@ private:
if (!known_tilt_.empty()) {
try {
snap_to = tf_buffer_.lookupTransform(msg->header.frame_id, known_tilt_,
msg->header.stamp, ros::Duration(0.02));
snap_to = tf_buffer_->lookupTransform(msg->header.frame_id, known_tilt_,
msg->header.stamp, ros::Duration(0.02));
} catch (const tf2::TransformException& e) {
NODELET_WARN_THROTTLE(5, "can't snap: %s", e.what());
}
@@ -205,7 +206,7 @@ private:
if (map_markers_ids_.find(ids[i]) == map_markers_ids_.end()) {
transform.transform.rotation = marker.pose.orientation;
fillTranslation(transform.transform.translation, tvecs[i]);
br_.sendTransform(transform);
br_->sendTransform(transform);
}
}
}
@@ -326,10 +327,10 @@ private:
return frame_id_prefix_ + std::to_string(id);
}
void readLengthOverride()
void readLengthOverride(ros::NodeHandle& nh)
{
std::map<std::string, double> length_override;
nh_priv_.getParam("length_override", length_override);
nh.getParam("length_override", length_override);
for (auto const& item : length_override) {
length_override_[std::stoi(item.first)] = item.second;
}

View File

@@ -58,7 +58,6 @@ typedef message_filters::sync_policies::ExactTime<Image, CameraInfo, MarkerArray
class ArucoMap : public nodelet::Nodelet {
private:
ros::NodeHandle nh_, nh_priv_;
ros::Publisher img_pub_, pose_pub_, markers_pub_, vis_markers_pub_;
image_transport::Publisher debug_pub_;
message_filters::Subscriber<Image> image_sub_;
@@ -83,8 +82,8 @@ private:
public:
virtual void onInit()
{
nh_ = getNodeHandle();
nh_priv_ = getPrivateNodeHandle();
ros::NodeHandle &nh_ = getNodeHandle();
ros::NodeHandle &nh_priv_ = getPrivateNodeHandle();
image_transport::ImageTransport it_priv(nh_priv_);
@@ -96,19 +95,18 @@ public:
board_->dictionary = cv::aruco::getPredefinedDictionary(
static_cast<cv::aruco::PREDEFINED_DICTIONARY_NAME>(nh_priv_.param("dictionary", 2)));
camera_matrix_ = cv::Mat::zeros(3, 3, CV_64F);
dist_coeffs_ = cv::Mat::zeros(8, 1, CV_64F);
std::string type, map;
nh_priv_.param<std::string>("type", type, "map");
nh_priv_.param<std::string>("frame_id", transform_.child_frame_id, "aruco_map");
nh_priv_.param<std::string>("known_tilt", known_tilt_, "");
nh_priv_.param("auto_flip", auto_flip_, false);
nh_priv_.param("image_width", image_width_, 2000);
nh_priv_.param("image_height", image_height_, 2000);
nh_priv_.param("image_margin", image_margin_, 200);
nh_priv_.param("image_axis", image_axis_, true);
nh_priv_.param<std::string>("markers/frame_id", markers_parent_frame_, transform_.child_frame_id);
nh_priv_.param<std::string>("markers/child_frame_id_prefix", markers_frame_, "");
type = nh_priv_.param<std::string>("type", "map");
transform_.child_frame_id = nh_priv_.param<std::string>("frame_id", "aruco_map");
known_tilt_ = nh_priv_.param<std::string>("known_tilt", "");
auto_flip_ = nh_priv_.param("auto_flip", false);
image_width_ = nh_priv_.param("image_width" , 2000);
image_height_ = nh_priv_.param("image_height", 2000);
image_margin_ = nh_priv_.param("image_margin", 200);
image_axis_ = nh_priv_.param("image_axis", true);
markers_parent_frame_ = nh_priv_.param<std::string>("markers/frame_id", transform_.child_frame_id);
markers_frame_ = nh_priv_.param<std::string>("markers/child_frame_id_prefix", "");
// createStripLine();
@@ -116,7 +114,7 @@ public:
param(nh_priv_, "map", map);
loadMap(map);
} else if (type == "gridboard") {
createGridBoard();
createGridBoard(nh_priv_);
} else {
NODELET_FATAL("unknown type: %s", type.c_str());
ros::shutdown();
@@ -331,7 +329,7 @@ publish_debug:
NODELET_INFO("loading %s complete (%d markers)", filename.c_str(), static_cast<int>(board_->ids.size()));
}
void createGridBoard()
void createGridBoard(ros::NodeHandle& nh)
{
NODELET_INFO("generate gridboard");
NODELET_WARN("gridboard maps are deprecated");
@@ -339,15 +337,15 @@ publish_debug:
int markers_x, markers_y, first_marker;
double markers_side, markers_sep_x, markers_sep_y;
std::vector<int> marker_ids;
nh_priv_.param<int>("markers_x", markers_x, 10);
nh_priv_.param<int>("markers_y", markers_y, 10);
nh_priv_.param<int>("first_marker", first_marker, 0);
markers_x = nh.param("markers_x", 10);
markers_y = nh.param("markers_y", 10);
first_marker = nh.param("first_marker", 0);
param(nh_priv_, "markers_side", markers_side);
param(nh_priv_, "markers_sep_x", markers_sep_x);
param(nh_priv_, "markers_sep_y", markers_sep_y);
param(nh, "markers_side", markers_side);
param(nh, "markers_sep_x", markers_sep_x);
param(nh, "markers_sep_y", markers_sep_y);
if (nh_priv_.getParam("marker_ids", marker_ids)) {
if (nh.getParam("marker_ids", marker_ids)) {
if ((unsigned int)(markers_x * markers_y) != marker_ids.size()) {
NODELET_FATAL("~marker_ids length should be equal to ~markers_x * ~markers_y");
ros::shutdown();
@@ -394,7 +392,7 @@ publish_debug:
int num_markers = board_->dictionary->bytesList.rows;
if (num_markers <= id) {
NODELET_ERROR("Marker id %d is not in dictionary; current dictionary contains %d markers. "
"Please see https://github.com/CopterExpress/clever/blob/master/aruco_pose/README.md#parameters for details",
"Please see https://github.com/CopterExpress/clover/blob/master/aruco_pose/README.md#parameters for details",
id, num_markers);
return;
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# Copyright (C) 2018 Copter Express Technologies
#

View File

@@ -35,9 +35,7 @@ static void parseCameraInfo(const sensor_msgs::CameraInfoConstPtr& cinfo, cv::Ma
for (unsigned int i = 0; i < 3; ++i)
for (unsigned int j = 0; j < 3; ++j)
matrix.at<double>(i, j) = cinfo->K[3 * i + j];
for (unsigned int k = 0; k < cinfo->D.size(); k++)
dist.at<double>(k) = cinfo->D[k];
dist = cv::Mat(cinfo->D, true);
}
inline void rotatePoint(cv::Point3f& p, cv::Point3f origin, float angle)

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View File

@@ -0,0 +1,18 @@
import rospy
import pytest
from visualization_msgs.msg import MarkerArray as VisMarkerArray
@pytest.fixture
def node():
return rospy.init_node('aruco_pose_opencv_crash', anonymous=True)
def test_opencv_crashes_img01(node):
rospy.wait_for_message('aruco_detect_01/visualization', VisMarkerArray, timeout=5)
def test_opencv_crashes_img02(node):
rospy.wait_for_message('aruco_detect_02/visualization', VisMarkerArray, timeout=5)
def test_opencv_crashes_img03(node):
rospy.wait_for_message('aruco_detect_03/visualization', VisMarkerArray, timeout=5)

View File

@@ -0,0 +1,51 @@
<launch>
<arg name="corner_method" default="2"/>
<node pkg="image_publisher" type="image_publisher" name="imgpub_01" args="$(find aruco_pose)/test/crash_image_01.png">
<param name="frame_id" value="main_camera_optical"/>
<param name="publish_rate" value="10"/>
<param name="camera_info_url" value="file://$(find aruco_pose)/test/camera_info.yaml" />
</node>
<node pkg="image_publisher" type="image_publisher" name="imgpub_02" args="$(find aruco_pose)/test/crash_image_02.png">
<param name="frame_id" value="main_camera_optical"/>
<param name="publish_rate" value="10"/>
<param name="camera_info_url" value="file://$(find aruco_pose)/test/camera_info.yaml" />
</node>
<node pkg="image_publisher" type="image_publisher" name="imgpub_03" args="$(find aruco_pose)/test/crash_image_03.png">
<param name="frame_id" value="main_camera_optical"/>
<param name="publish_rate" value="10"/>
<param name="camera_info_url" value="file://$(find aruco_pose)/test/camera_info.yaml" />
</node>
<node pkg="nodelet" type="nodelet" name="nodelet_manager_01" args="manager"/>
<node pkg="nodelet" clear_params="true" type="nodelet" name="aruco_detect_01" args="load aruco_pose/aruco_detect nodelet_manager_01">
<remap from="image_raw" to="imgpub_01/image_raw"/>
<remap from="camera_info" to="imgpub_01/camera_info"/>
<param name="length" value="0.33"/>
<param name="cornerRefinementMethod" value="$(arg corner_method)"/>
</node>
<node pkg="nodelet" type="nodelet" name="nodelet_manager_02" args="manager"/>
<node pkg="nodelet" clear_params="true" type="nodelet" name="aruco_detect_02" args="load aruco_pose/aruco_detect nodelet_manager_02">
<remap from="image_raw" to="imgpub_02/image_raw"/>
<remap from="camera_info" to="imgpub_02/camera_info"/>
<param name="length" value="0.33"/>
<param name="cornerRefinementMethod" value="$(arg corner_method)"/>
</node>
<node pkg="nodelet" type="nodelet" name="nodelet_manager_03" args="manager"/>
<node pkg="nodelet" clear_params="true" type="nodelet" name="aruco_detect_03" args="load aruco_pose/aruco_detect nodelet_manager_03">
<remap from="image_raw" to="imgpub_03/image_raw"/>
<remap from="camera_info" to="imgpub_03/camera_info"/>
<param name="length" value="0.33"/>
<param name="cornerRefinementMethod" value="$(arg corner_method)"/>
</node>
<param name="test_module" value="$(find aruco_pose)/test/crash_opencv.py"/>
<test test-name="crash_opencv" pkg="ros_pytest" type="ros_pytest_runner"/>
</launch>

View File

@@ -1,19 +1,26 @@
#!/usr/bin/env python
import sys
import unittest
import json
import rospy
import pytest
import rostest
from sensor_msgs.msg import Image
from visualization_msgs.msg import MarkerArray as VisMarkerArray
@pytest.fixture
def node():
return rospy.init_node('test_aruco_largemap', anonymous=True)
def test_large_map_image(node):
img = rospy.wait_for_message('aruco_map/image', Image, timeout=5)
assert img.width == 2000
assert img.height == 2000
assert img.encoding in ('mono8', 'rgb8')
class TestArucoPose(unittest.TestCase):
def setUp(self):
rospy.init_node('test_aruco_largemap', anonymous=True)
def test_large_map_visualization(node):
vis = rospy.wait_for_message('aruco_map/visualization', VisMarkerArray, timeout=5)
assert len(vis.markers) == 11
def test_map_image(self):
img = rospy.wait_for_message('aruco_map/image', Image, timeout=5)
self.assertEqual(img.width, 2000)
self.assertEqual(img.height, 2000)
self.assertIn(img.encoding, ('mono8', 'rgb8'))
def test_map_visualization(self):
vis = rospy.wait_for_message('aruco_map/visualization', VisMarkerArray, timeout=5)
rostest.rosrun('aruco_pose', 'test_aruco_largemap', TestArucoPose, sys.argv)

View File

@@ -9,6 +9,5 @@
<param name="map" value="$(find aruco_pose)/test/largemap.txt"/>
</node>
<param name="test_module" value="$(find aruco_pose)/test/largemap.py"/>
<test test-name="test_node_pass" pkg="ros_pytest" type="ros_pytest_runner"/>
<test test-name="test_aruco_pose_largemap" pkg="aruco_pose" type="largemap.py"/>
</launch>

View File

@@ -924,6 +924,8 @@ static void _refineCandidateLines(std::vector<Point>& nContours, std::vector<Poi
// calculate the line :: who passes through the grouped points
Point3f lines[4];
for(int i=0; i<4; i++){
// Don't try to "interpolate" single points
if (cntPts[i].size() < 2) return;
lines[i]=_interpolate2Dline(cntPts[i]);
}

View File

@@ -1,5 +1,5 @@
{
"title": "Clever",
"title": "Clover",
"description": "Конструктор квадрокоптера «Клевер»",
"author": "Copter Express",
"language": "en",
@@ -28,7 +28,7 @@
"blank": true
},
"sitemap": {
"hostname": "https://clever.coex.tech"
"hostname": "https://clover.coex.tech"
},
"toolbar": {
"buttons":
@@ -37,19 +37,19 @@
"label": "Edit page on github",
"icon": "fa fa-pencil-square-o",
"position" : "left",
"url": "https://github.com/CopterExpress/clever/edit/master/docs/{{filepath_lang}}"
"url": "https://github.com/CopterExpress/clover/edit/master/docs/{{filepath_lang}}"
},
{
"label": "GitHub",
"icon": "fa fa-github",
"position" : "left",
"url": "https://github.com/CopterExpress/clever"
"url": "https://github.com/CopterExpress/clover"
}
]
},
"addcssjs": {
"css": ["../clever.css"],
"js": ["../clever.js"]
"css": ["../clover.css"],
"js": ["../clover.js"]
},
"language-picker": {
"languages": [["ru", "Russian"], ["en", "English"]]

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
from distutils.core import setup

View File

@@ -1,4 +1,4 @@
# Information: https://clever.coex.tech/en/programming.html
# Information: https://clover.coex.tech/programming
import rospy
from clover import srv
@@ -15,7 +15,7 @@ set_attitude = rospy.ServiceProxy('set_attitude', srv.SetAttitude)
set_rates = rospy.ServiceProxy('set_rates', srv.SetRates)
land = rospy.ServiceProxy('land', Trigger)
# Takeoff and hover 1 m above the ground
# Take off and hover 1 m above the ground
navigate(x=0, y=0, z=1, frame_id='body', auto_arm=True)
# Wait for 3 seconds

View File

@@ -0,0 +1,37 @@
# Information: https://clover.coex.tech/en/aruco.html
import rospy
from clover import srv
from std_srvs.srv import Trigger
rospy.init_node('flight')
get_telemetry = rospy.ServiceProxy('get_telemetry', srv.GetTelemetry)
navigate = rospy.ServiceProxy('navigate', srv.Navigate)
navigate_global = rospy.ServiceProxy('navigate_global', srv.NavigateGlobal)
set_position = rospy.ServiceProxy('set_position', srv.SetPosition)
set_velocity = rospy.ServiceProxy('set_velocity', srv.SetVelocity)
set_attitude = rospy.ServiceProxy('set_attitude', srv.SetAttitude)
set_rates = rospy.ServiceProxy('set_rates', srv.SetRates)
land = rospy.ServiceProxy('land', Trigger)
# Take off and hover 1 m above the ground
navigate(x=0, y=0, z=1, frame_id='body', auto_arm=True)
# Wait for 3 seconds
rospy.sleep(3)
# Fly 1 meter above ArUco marker 0
navigate(x=0, y=0, z=1, frame_id='aruco_0')
# Wait for 3 seconds
rospy.sleep(3)
# Fly to x=1 y=1 z=1 relative to ArUco markers map
navigate(x=1, y=1, z=1, frame_id='aruco_map')
# Wait for 3 seconds
rospy.sleep(3)
# Perform landing
land()

View File

@@ -1,4 +1,4 @@
# Information: https://clever.coex.tech/en/leds.html
# Information: https://clover.coex.tech/en/leds.html
import rospy
from clover.srv import SetLEDEffect

View File

@@ -0,0 +1,41 @@
# Information: https://clover.coex.tech/en/snippets.html#block-nav
import math
import rospy
from clover import srv
from std_srvs.srv import Trigger
rospy.init_node('flight')
get_telemetry = rospy.ServiceProxy('get_telemetry', srv.GetTelemetry)
navigate = rospy.ServiceProxy('navigate', srv.Navigate)
navigate_global = rospy.ServiceProxy('navigate_global', srv.NavigateGlobal)
set_position = rospy.ServiceProxy('set_position', srv.SetPosition)
set_velocity = rospy.ServiceProxy('set_velocity', srv.SetVelocity)
set_attitude = rospy.ServiceProxy('set_attitude', srv.SetAttitude)
set_rates = rospy.ServiceProxy('set_rates', srv.SetRates)
land = rospy.ServiceProxy('land', Trigger)
def navigate_wait(x=0, y=0, z=0, yaw=float('nan'), yaw_rate=0, speed=0.5, \
frame_id='body', tolerance=0.2, auto_arm=False):
res = navigate(x=x, y=y, z=z, yaw=yaw, yaw_rate=yaw_rate, speed=speed, \
frame_id=frame_id, auto_arm=auto_arm)
if not res.success:
return res
while not rospy.is_shutdown():
telem = get_telemetry(frame_id='navigate_target')
if math.sqrt(telem.x ** 2 + telem.y ** 2 + telem.z ** 2) < tolerance:
return res
rospy.sleep(0.2)
# Take off 1 meter
navigate_wait(z=1, frame_id='body', auto_arm=True)
# Fly forward 1 m
navigate_wait(x=1, frame_id='body')
# Land
land()

View File

@@ -62,6 +62,10 @@ hostnamectl set-hostname $NEW_HOSTNAME
sed -i 's/127\.0\.1\.1.*/127.0.1.1\t'${NEW_HOSTNAME}' '${NEW_HOSTNAME}'.local/g' /etc/hosts
# .local (mdns) hostname added to make it accesable when wlan and ethernet interfaces are down
echo_stamp "Enable ROS services"
systemctl enable roscore
systemctl enable clover
echo_stamp "Harware setup"
/root/hardware_setup.sh

View File

@@ -1,9 +0,0 @@
python3-wxgtk:
debian:
buster: [python3-wxgtk4.0]
python3-serial:
debian:
buster: [python3-serial]
python3-requests:
debian:
buster: [python3-requests]

View File

@@ -115,7 +115,6 @@ ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-network.
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/clover.service' '/lib/systemd/system/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/roscore.service' '/lib/systemd/system/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/melodic-rosdep-clover.yaml' '/etc/ros/rosdep/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/python3.yaml' '/etc/ros/rosdep/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/ros_python_paths' '/etc/sudoers.d/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/pigpiod.service' '/lib/systemd/system/'
${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/launch.nanorc' '/usr/share/nano/'

View File

@@ -68,8 +68,7 @@ my_travis_retry() {
# TODO: 'kinetic-rosdep-clover.yaml' should add only if we use our repo?
echo_stamp "Init rosdep"
my_travis_retry rosdep init
echo "yaml file:///etc/ros/rosdep/melodic-rosdep-clover.yaml" > /etc/ros/rosdep/sources.list.d/30-clover.list
echo "yaml file:///etc/ros/rosdep/python3.yaml" > /etc/ros/rosdep/sources.list.d/40-python3.list
echo "yaml file:///etc/ros/rosdep/melodic-rosdep-clover.yaml" >> /etc/ros/rosdep/sources.list.d/20-default.list
my_travis_retry rosdep update
echo_stamp "Populate rosdep for ROS user"
@@ -88,7 +87,6 @@ resolve_rosdep() {
}
export ROS_IP='127.0.0.1' # needed for running tests
export ROS_PYTHON_VERSION=3
echo_stamp "Reconfiguring Clover repository for simplier unshallowing"
cd /home/pi/catkin_ws/src/clover
@@ -97,15 +95,11 @@ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
echo_stamp "Build and install Clover"
cd /home/pi/catkin_ws
resolve_rosdep $(pwd)
my_travis_retry pip3 install wheel
my_travis_retry pip3 install -r /home/pi/catkin_ws/src/clover/clover/requirements.txt
my_travis_retry pip install wheel
my_travis_retry pip install -r /home/pi/catkin_ws/src/clover/clover/requirements.txt
source /opt/ros/melodic/setup.bash
catkin_make -j2 -DCMAKE_BUILD_TYPE=Release
echo_stamp "Enable ROS services"
systemctl enable roscore
systemctl enable clover
echo_stamp "Install clever package (for backwards compatibility)"
cd /home/pi/catkin_ws/src/clover/builder/assets/clever
./setup.py install
@@ -135,7 +129,7 @@ echo_stamp "Install GeographicLib datasets (needed for mavros)" \
# FIXME: Buster comes with tornado==5.1.1 but we need tornado==4.2.1 for rosbridge_suite
# (note that Python 3 will still have a more recent version)
pip3 install tornado==4.2.1
pip install tornado==4.2.1
echo_stamp "Running tests"
cd /home/pi/catkin_ws

View File

@@ -57,6 +57,10 @@ my_travis_retry() {
return $result
}
echo_stamp "Increase apt retries"
echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
echo_stamp "Install apt keys & repos"
# TODO: This STDOUT consist 'OK'
@@ -67,7 +71,7 @@ apt-get update \
echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list
echo "deb http://deb.coex.tech/opencv3 buster main" > /etc/apt/sources.list.d/opencv3.list
echo "deb http://deb.coex.tech/melodic-py3 buster main" > /etc/apt/sources.list.d/rpi-ros-melodic.list
echo "deb http://deb.coex.tech/rpi-ros-melodic buster main" > /etc/apt/sources.list.d/rpi-ros-melodic.list
echo "deb http://deb.coex.tech/clover buster main" > /etc/apt/sources.list.d/clover.list
echo_stamp "Update apt cache"
@@ -95,21 +99,21 @@ libjpeg8 \
tcpdump \
ltrace \
libpoco-dev \
python3-rosdep \
python3-rosinstall-generator \
python3-wstool \
python3-rosinstall \
libzbar0 \
python-rosdep \
python-rosinstall-generator \
python-wstool \
python-rosinstall \
build-essential \
libffi-dev \
monkey \
pigpio python-pigpio python3-pigpio \
i2c-tools \
espeak espeak-data python3-espeak \
espeak espeak-data python-espeak \
ntpdate \
python-dev \
python3-dev \
python3-venv \
python3-systemd \
python-systemd \
mjpg-streamer \
python3-opencv \
&& echo_stamp "Everything was installed!" "SUCCESS" \
@@ -133,14 +137,13 @@ pip3 --version
echo_stamp "Install and enable Butterfly (web terminal)"
echo_stamp "Workaround for tornado >= 6.0 breaking butterfly"
my_travis_retry pip3 install tornado==4.2.1
my_travis_retry pip3 install tornado==5.1.1
my_travis_retry pip3 install butterfly
my_travis_retry pip3 install butterfly[systemd]
systemctl enable butterfly.socket
echo_stamp "Install ws281x library"
my_travis_retry pip2 install --prefer-binary rpi_ws281x
my_travis_retry pip3 install --prefer-binary rpi_ws281x
my_travis_retry pip install --prefer-binary rpi_ws281x
echo_stamp "Setup Monkey"
mv /etc/monkey/sites/default /etc/monkey/sites/default.orig
@@ -156,9 +159,13 @@ rm -rf node-v10.15.0-linux-armv6l/
rm node-v10.15.0-linux-armv6l.tar.gz
echo_stamp "Installing ptvsd"
my_travis_retry pip2 install ptvsd
my_travis_retry pip install ptvsd
my_travis_retry pip3 install ptvsd
echo_stamp "Installing pyzbar"
my_travis_retry pip install pyzbar
my_travis_retry pip3 install pyzbar
echo_stamp "Add .vimrc"
cat << EOF > /home/pi/.vimrc
set mouse-=a

View File

@@ -18,15 +18,13 @@ echo "Run image tests"
export ROS_DISTRO='melodic'
export ROS_IP='127.0.0.1'
export ROS_PYTHON_VERSION=3
source /opt/ros/melodic/setup.bash
source /home/pi/catkin_ws/devel/setup.bash
cd /home/pi/catkin_ws/src/clover/builder/test/
./tests.sh
./tests.py
# Disable Python 2 tests for image - we're dropping support, right?
# ./tests_py2.py
./tests_py3.py
[[ $(./tests_clever.py) == "Warning: clever package is renamed to clover" ]] # test backwards compatibility
echo "Move /etc/ld.so.preload back to its original position"

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Perform a "standalone install" in a Docker container
set -e
# Step 1: Install pip
apt update
apt install -y curl

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# validate all required modules installed
@@ -17,8 +17,6 @@ from std_srvs.srv import Trigger
from clover.srv import GetTelemetry, Navigate, NavigateGlobal, SetPosition, SetVelocity, \
SetAttitude, SetRates, SetLEDEffect
get_telemetry = rospy.ServiceProxy('get_telemetry', GetTelemetry)
import tf2_ros
import tf2_geometry_msgs
@@ -28,5 +26,6 @@ from pymavlink import mavutil
import rpi_ws281x
import pigpio
from espeak import espeak
from pyzbar import pyzbar
print(cv2.getBuildInformation())
print cv2.getBuildInformation()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# test backwards compatibility

View File

@@ -1,7 +0,0 @@
#!/usr/bin/env python
# Make sure our Python 2 software is installed
import cv2
print(cv2.getBuildInformation())

8
builder/test/tests_py3.py Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env python3
# Make sure our Python 3 software is installed
import cv2
from pyzbar import pyzbar
print(cv2.getBuildInformation())

View File

@@ -30,6 +30,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(GeographicLib REQUIRED)
find_package(OpenCV 3 REQUIRED
COMPONENTS
calib3d
imgproc
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
@@ -204,6 +210,7 @@ add_dependencies(shell ${PROJECT_NAME}_generate_messages_cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
#############

73
clover/README.md Normal file
View File

@@ -0,0 +1,73 @@
# `clover` ROS package
A bundle for autonomous navigation and drone control.
## Manual installation
Install ROS Melodic according to the [documentation](http://wiki.ros.org/melodic/Installation), then [create a Catkin workspace](http://wiki.ros.org/catkin/Tutorials/create_a_workspace).
Clone this repo to directory `~/catkin_ws/src/clover`:
```bash
cd ~/catkin_ws/src
git clone https://github.com/CopterExpress/clover.git clover
```
All the required ROS packages (including `mavros` and `opencv`) can be installed using `rosdep`:
```bash
cd ~/catkin_ws/
rosdep install -y --from-paths src --ignore-src
```
Build ROS packages (on memory constrained platforms you might be going to need to use `-j1` key):
```bash
cd ~/catkin_ws
catkin_make -j1
```
To complete `mavros` install you'll need to install `geographiclib` datasets:
```bash
curl https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh | sudo bash
```
You may optionally install udev rules to provide `/dev/px4fmu` symlink to your PX4-based flight controller connected over USB. Copy `99-px4fmu.rules` to your `/lib/udev/rules.d` folder:
```bash
cd ~/catkin_ws/src/clover/clover/config
sudo cp 99-px4fmu.rules /lib/udev/rules.d
```
Alternatively you may change the `fcu_url` property in `mavros.launch` file to point to your flight controller device.
## Running
Enable systemd service `roscore` (if not running):
```bash
sudo systemctl enable /home/<username>/catkin_ws/src/clover/builder/assets/roscore.service
sudo systemctl start roscore
```
To start connection to SITL, use:
```bash
roslaunch clover sitl.launch
```
To start connection to the flight controller, use:
```bash
roslaunch clover clover.launch
```
> Note that the package is configured to connect to `/dev/px4fmu` by default (see [previous section](#manual-installation)). Install udev rules or specify path to your FCU device in `mavros.launch`.
Also, you can enable and start the systemd service:
```bash
sudo systemctl enable /home/<username>/catkin_ws/src/clover/deploy/clover.service
sudo systemctl start clover
```

View File

@@ -1,17 +1,17 @@
image_width: 640
image_height: 480
distortion_model: plumb_bob
camera_name: raspicam
camera_name: main_camera_optical
camera_matrix:
rows: 3
cols: 3
data:
- 332.47884746146343
- 0.
- 324.38022493658536
- 320.0
- 0.
- 333.1761847948052
- 219.6445547142857
- 240.0
- 0.
- 0.
- 1.

View File

@@ -1,45 +0,0 @@
image_width: 320
image_height: 240
distortion_model: plumb_bob
camera_name: raspicam
camera_matrix:
rows: 3
cols: 3
data:
- 166.23942373073172
- 0.
- 162.19011246829268
- 0.
- 166.5880923974026
- 109.82227735714285
- 0.
- 0.
- 1.
distortion_coefficients:
rows: 1
cols: 8
data: [ 2.15356885e-01, -1.17472846e-01, -3.06197672e-04,
-1.09444025e-04, -4.53657258e-03, 5.73090623e-01,
-1.27574577e-01, -2.86125589e-02, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00]
rectification_matrix:
rows: 3
cols: 3
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
rows: 3
cols: 4
data:
- 166.23942373073172
- 0.
- 162.19011246829268
- 0.
- 0.
- 166.5880923974026
- 109.82227735714285
- 0.
- 0.
- 0.
- 1.
- 0.

View File

@@ -3,18 +3,20 @@
<arg name="aruco_map" default="false"/>
<arg name="aruco_vpe" default="false"/>
<!-- For additional help go to https://clever.coex.tech/aruco -->
<!-- For additional help go to https://clover.coex.tech/aruco -->
<!-- aruco_detect: detect aruco markers, estimate poses -->
<node name="aruco_detect" pkg="nodelet" if="$(arg aruco_detect)" type="nodelet" args="load aruco_pose/aruco_detect nodelet_manager" output="screen" clear_params="true">
<remap from="image_raw" to="main_camera/image_raw"/>
<remap from="camera_info" to="main_camera/camera_info"/>
<remap from="map_markers" to="aruco_map/markers" if="$(arg aruco_map)"/>
<param name="cornerRefinementMethod" value="2"/>
<param name="estimate_poses" value="true"/>
<param name="send_tf" value="true"/>
<param name="known_tilt" value="map"/>
<param name="length" value="0.33"/>
<!-- aruco detector parameters -->
<param name="cornerRefinementMethod" value="2"/> <!-- contour refinement -->
<param name="minMarkerPerimeterRate" value="0.075"/> <!-- 0.075 for 320x240, 0.0375 for 640x480 -->
</node>
<!-- aruco_map: estimate aruco map pose -->

View File

@@ -1,6 +1,7 @@
<launch>
<arg name="fcu_conn" default="usb"/>
<arg name="fcu_ip" default="127.0.0.1"/>
<arg name="fcu_sys_id" default="1"/>
<arg name="gcs_bridge" default="tcp"/>
<arg name="web_video_server" default="true"/>
<arg name="rosbridge" default="true"/>
@@ -19,6 +20,7 @@
<include file="$(find clover)/launch/mavros.launch">
<arg name="fcu_conn" value="$(arg fcu_conn)"/>
<arg name="fcu_ip" value="$(arg fcu_ip)"/>
<arg name="fcu_sys_id" value="$(arg fcu_sys_id)"/>
<arg name="gcs_bridge" value="$(arg gcs_bridge)"/>
</include>

View File

@@ -1,5 +1,5 @@
<launch>
<!-- article about camera setup: https://clever.coex.tech/camera_frame -->
<!-- article about camera setup: https://clover.coex.tech/camera_setup -->
<arg name="direction_z" default="down"/> <!-- direction the camera points: down, up -->
<arg name="direction_y" default="backward"/> <!-- direction the camera cable points: backward, forward -->
@@ -18,14 +18,14 @@
<node pkg="nodelet" type="nodelet" name="main_camera" args="load cv_camera/CvCameraNodelet nodelet_manager" clear_params="true">
<param name="device_path" value="/dev/video0"/> <!-- v4l2 device -->
<param name="frame_id" value="main_camera_optical"/>
<param name="camera_info_url" value="file://$(find clover)/camera_info/fisheye_cam_320.yaml"/>
<param name="camera_info_url" value="file://$(find clover)/camera_info/fisheye_cam.yaml"/>
<param name="rate" value="100"/> <!-- poll rate -->
<param name="cv_cap_prop_fps" value="40"/> <!-- camera FPS -->
<param name="capture_delay" value="0.02"/> <!-- approximate delay on frame retrieving -->
<param name="rescale_camera_info" value="true"/> <!-- automatically rescale camera calibration info -->
<!-- camera resolution, NOTE: camera_info file should match it -->
<!-- camera resolution -->
<param name="image_width" value="320"/>
<param name="image_height" value="240"/>
</node>

View File

@@ -1,6 +1,7 @@
<launch>
<arg name="fcu_conn" default="usb"/> <!-- options: usb, uart, tcp, udp, sitl -->
<arg name="fcu_ip" default="127.0.0.1"/>
<arg name="fcu_sys_id" default="1"/>
<arg name="gcs_bridge" default="tcp"/>
<arg name="viz" default="true"/>
<arg name="respawn" default="true"/>
@@ -19,6 +20,9 @@
<!-- sitl since PX4 1.9.0 -->
<param name="fcu_url" value="udp://@$(arg fcu_ip):14580" if="$(eval fcu_conn == 'sitl')"/>
<!-- set target_system_id -->
<param name="target_system_id" value="$(arg fcu_sys_id)" />
<!-- gcs bridge -->
<param name="gcs_url" value="tcp-l://0.0.0.0:5760" if="$(eval gcs_bridge == 'tcp')"/>
<param name="gcs_url" value="udp://0.0.0.0:14550@14550" if="$(eval gcs_bridge == 'udp')"/>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package format="3">
<package format="2">
<name>clover</name>
<version>0.0.1</version>
<description>The Clover package</description>
@@ -7,7 +7,7 @@
<maintainer email="okalachev@gmail.com">Oleg Kalachev</maintainer>
<license>MIT</license>
<url type="website">https://clever.coex.tech/</url>
<url type="website">https://clover.coex.tech/</url>
<author email="okalachev@gmail.com">Oleg Kalachev</author>
<author email="urpylka@gmail.com">Artem Smirnov</author>
@@ -37,10 +37,8 @@
<depend>rosbridge_server</depend>
<depend>web_video_server</depend>
<depend>tf2_web_republisher</depend>
<depend condition="$ROS_PYTHON_VERSION == 2">python-lxml</depend>
<depend condition="$ROS_PYTHON_VERSION == 3">python3-lxml</depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-pymavlink</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python-pymavlink</exec_depend>
<depend>python-lxml</depend>
<exec_depend>python-pymavlink</exec_depend>
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->

View File

@@ -1,5 +1,5 @@
flask==1.1.1
docopt==0.6.2
geopy==1.20.0
smbus2==0.3.0
VL53L1X==0.0.4
geopy==1.11.0
smbus2==0.2.1
VL53L1X==0.0.2

View File

@@ -34,9 +34,7 @@ class OpticalFlow : public nodelet::Nodelet
{
public:
OpticalFlow():
camera_matrix_(3, 3, CV_64F),
dist_coeffs_(8, 1, CV_64F),
tf_listener_(tf_buffer_)
camera_matrix_(3, 3, CV_64F)
{}
private:
@@ -52,8 +50,8 @@ private:
Mat hann_;
Mat prev_, curr_;
Mat camera_matrix_, dist_coeffs_;
tf2_ros::Buffer tf_buffer_;
tf2_ros::TransformListener tf_listener_;
std::unique_ptr<tf2_ros::Buffer> tf_buffer_;
std::unique_ptr<tf2_ros::TransformListener> tf_listener_;
bool calc_flow_gyro_;
void onInit()
@@ -63,11 +61,14 @@ private:
image_transport::ImageTransport it(nh);
image_transport::ImageTransport it_priv(nh_priv);
nh.param<std::string>("mavros/local_position/tf/frame_id", local_frame_id_, "map");
nh.param<std::string>("mavros/local_position/tf/child_frame_id", fcu_frame_id_, "base_link");
nh_priv.param("roi", roi_px_, 128);
nh_priv.param("roi_rad", roi_rad_, 0.0);
nh_priv.param("calc_flow_gyro", calc_flow_gyro_, false);
tf_buffer_.reset(new tf2_ros::Buffer());
tf_listener_.reset(new tf2_ros::TransformListener(*tf_buffer_, nh));
local_frame_id_ = nh.param<std::string>("mavros/local_position/tf/frame_id", "map");
fcu_frame_id_ = nh.param<std::string>("mavros/local_position/tf/child_frame_id", "base_link");
roi_px_ = nh_priv.param("roi", 128);
roi_rad_ = nh_priv.param("roi_rad", 0.0);
calc_flow_gyro_ = nh_priv.param("calc_flow_gyro", false);
img_sub_ = it.subscribeCamera("image_raw", 1, &OpticalFlow::flow, this);
img_pub_ = it_priv.advertise("debug", 1);
@@ -91,9 +92,7 @@ private:
camera_matrix_.at<double>(i, j) = cinfo->K[3 * i + j];
}
}
for (int k = 0; k < cinfo->D.size(); k++) {
dist_coeffs_.at<double>(k) = cinfo->D[k];
}
dist_coeffs_ = cv::Mat(cinfo->D, true);
}
void drawFlow(Mat& frame, double x, double y, double quality) const
@@ -186,7 +185,7 @@ private:
flow_camera.vector.x = flow_y; // +y means counter-clockwise rotation around Y axis
flow_camera.vector.y = -flow_x; // +x means clockwise rotation around X axis
try {
tf_buffer_.transform(flow_camera, flow_fcu, fcu_frame_id_);
tf_buffer_->transform(flow_camera, flow_fcu, fcu_frame_id_);
} catch (const tf2::TransformException& e) {
// transform is not available yet
return;
@@ -200,7 +199,7 @@ private:
try {
auto flow_gyro_camera = calcFlowGyro(msg->header.frame_id, prev_stamp_, msg->header.stamp);
static geometry_msgs::Vector3Stamped flow_gyro_fcu;
tf_buffer_.transform(flow_gyro_camera, flow_gyro_fcu, fcu_frame_id_);
tf_buffer_->transform(flow_gyro_camera, flow_gyro_fcu, fcu_frame_id_);
flow_.integrated_xgyro = flow_gyro_fcu.vector.x;
flow_.integrated_ygyro = flow_gyro_fcu.vector.y;
flow_.integrated_zgyro = flow_gyro_fcu.vector.z;
@@ -247,8 +246,8 @@ private:
geometry_msgs::Vector3Stamped calcFlowGyro(const std::string& frame_id, const ros::Time& prev, const ros::Time& curr)
{
tf2::Quaternion prev_rot, curr_rot;
tf2::fromMsg(tf_buffer_.lookupTransform(frame_id, local_frame_id_, prev).transform.rotation, prev_rot);
tf2::fromMsg(tf_buffer_.lookupTransform(frame_id, local_frame_id_, curr, ros::Duration(0.1)).transform.rotation, curr_rot);
tf2::fromMsg(tf_buffer_->lookupTransform(frame_id, local_frame_id_, prev).transform.rotation, prev_rot);
tf2::fromMsg(tf_buffer_->lookupTransform(frame_id, local_frame_id_, curr, ros::Duration(0.1)).transform.rotation, curr_rot);
geometry_msgs::Vector3Stamped flow;
flow.header.frame_id = frame_id;

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# coding=utf-8
# Copyright (C) 2018 Copter Express Technologies
@@ -138,7 +138,7 @@ def mavlink_exec(cmd, timeout=3.0):
timeout=3,
baudrate=0,
count=len(cmd),
data=[ord(c) for c in cmd.ljust(70, '\0')])
data=map(ord, cmd.ljust(70, '\0')))
msg.pack(link)
ros_msg = mavlink.convert_to_rosmsg(msg)
mavlink_pub.publish(ros_msg)
@@ -210,7 +210,7 @@ def check_fcu():
is_clover_firmware = True
if not is_clover_firmware:
failure('not running Clover PX4 firmware, https://clever.coex.tech/firmware')
failure('not running Clover PX4 firmware, https://clover.coex.tech/firmware')
est = get_param('SYS_MC_EST_GROUP')
if est == 1:
@@ -250,11 +250,11 @@ def check_fcu():
try:
battery = rospy.wait_for_message('mavros/battery', BatteryState, timeout=3)
if not battery.cell_voltage:
failure('cell voltage is not available, https://clever.coex.tech/power')
failure('cell voltage is not available, https://clover.coex.tech/power')
else:
cell = battery.cell_voltage[0]
if cell > 4.3 or cell < 3.0:
failure('incorrect cell voltage: %.2f V, https://clever.coex.tech/power', cell)
failure('incorrect cell voltage: %.2f V, https://clover.coex.tech/power', cell)
elif cell < 3.7:
failure('critically low cell voltage: %.2f V, recharge battery', cell)
except rospy.ROSException:
@@ -609,7 +609,7 @@ def check_rangefinder():
@check('Boot duration')
def check_boot_duration():
output = subprocess.check_output('systemd-analyze').decode()
output = subprocess.check_output('systemd-analyze')
r = re.compile(r'([\d\.]+)s\s*$', flags=re.MULTILINE)
duration = float(r.search(output).groups()[0])
if duration > 15:
@@ -620,7 +620,7 @@ def check_boot_duration():
def check_cpu_usage():
WHITELIST = 'nodelet',
CMD = "top -n 1 -b -i | tail -n +8 | awk '{ printf(\"%-8s\\t%-8s\\t%-8s\\n\", $1, $9, $12); }'"
output = subprocess.check_output(CMD, shell=True).decode()
output = subprocess.check_output(CMD, shell=True)
processes = output.split('\n')
for process in processes:
if not process:
@@ -636,7 +636,7 @@ def check_cpu_usage():
def check_clover_service():
try:
output = subprocess.check_output('systemctl show -p ActiveState --value clover.service'.split(),
stderr=subprocess.STDOUT).decode()
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
failure('systemctl returned %s: %s', e.returncode, e.output)
return
@@ -718,7 +718,7 @@ def check_network():
if ros_hostname in parts:
break
else:
failure('not found %s in /etc/hosts, ROS will malfunction if network interfaces are down, https://clever.coex.tech/hostname', ros_hostname)
failure('not found %s in /etc/hosts, ROS will malfunction if network interfaces are down, https://clover.coex.tech/hostname', ros_hostname)
@check('RPi health')
@@ -751,7 +751,7 @@ def check_rpi_health():
# <parameter>=<value>
# In case of `get_throttled`, <value> is a hexadecimal number
# with some of the FLAGs OR'ed together
output = subprocess.check_output(['vcgencmd', 'get_throttled']).decode()
output = subprocess.check_output(['vcgencmd', 'get_throttled'])
except OSError:
failure('could not call vcgencmd binary; not a Raspberry Pi?')
return

View File

@@ -490,7 +490,7 @@ inline void checkState()
throw std::runtime_error("State timeout, check mavros settings");
if (!state.connected)
throw std::runtime_error("No connection to FCU, https://clever.coex.tech/connection");
throw std::runtime_error("No connection to FCU, https://clover.coex.tech/connection");
}
#define ENSURE_FINITE(var) { if (!std::isfinite(var)) throw std::runtime_error(#var " argument cannot be NaN or Inf"); }

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env python
import rospy
import pytest
from mavros_msgs.msg import State

View File

@@ -1,7 +1,7 @@
<h1>Clover Drone Kit Tools</h1>
<ul>
<li><a href="docs">View documentation</a> (snapshot of <a href="https://clever.coex.tech">clever.coex.tech</a>)</li>
<li><a href="docs">View documentation</a> (snapshot of <a href="https://clover.coex.tech">clover.coex.tech</a>)</li>
<li><a href="" id="wvs">View image topics</a> (<code>web_video_server</code>)</li>
<li><a href="" id="butterfly">Open web terminal</a> (<code>Butterfly</code>)</li>
<li><a href="viz.html">View 3D visualization</a> (<code>ros3djs</code>)</li>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
docs/assets/js-ros.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

BIN
docs/assets/p4df2_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
docs/assets/p4df2_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
docs/assets/p4df2_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

BIN
docs/assets/p4df2_4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

BIN
docs/assets/web-gcs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -40,7 +40,7 @@ section ul li:before {
margin-bottom: 0.85em;
}
/* Main Clever image */
/* Main Clover image */
.book img.bigclever {
margin-bottom: -12%;
}

View File

@@ -6,7 +6,7 @@ The project was created in collaboration with Texel inc. that develops 3D-scanne
Our fellows from Texel provided a module consisting of a Raspberry Pi and a PrimeSense 3D-sensor.
We provided a Clever 3 drone that's capable of autonomous flight and wrote a flight program.
We provided a Clover 3 drone that's capable of autonomous flight and wrote a flight program.
To make it all work we conducted many tests, made changes in the drone's design and tuned the drone properly.

View File

@@ -1,12 +1,12 @@
# COEX Clever
# COEX Clover
<img class="center bigclever zoom" src="../assets/clever4-front-white-large.png" width="80%" alt="COEX Clever 4">
<img class="center bigclever zoom" src="../assets/clever4-front-white-large.png" width="80%" alt="COEX Clover 4">
CLEVER (Russian: *"Клевер"*, meaning *"Clover"*) is an educational kit of a programmable quadcopter that consists of popular open source components, and a set of necessary documentation and libraries for working with it.
**Clover** is an educational kit of a programmable quadcopter that consists of popular open source components, and a set of necessary documentation and libraries for working with it.
The kit includes a Pixhawk/Pixracer flight controller with the PX4 flight stack, a [Raspberry Pi 3](raspberry.md) as a controlling onboard computer, and a [camera module](camera.md) for performing flights with the use of computer vision, as well as a set of various sensors and other peripherals.
The kit includes a Pixhawk/Pixracer flight controller with the PX4 flight stack, a [Raspberry Pi 4](raspberry.md) as a controlling onboard computer, and a [camera module](camera.md) for performing flights with the use of computer vision, as well as a set of various sensors and other peripherals.
The Clever platform contains a [pre-configured image for Raspberry Pi](image.md) with the full set of required software for working with peripheral devices and [programming autonomous flights](simple_offboard.md). The source code of the platform and of the documentation is open and [available on GitHub](https://github.com/CopterExpress/clever).
The Clover platform contains a [pre-configured image for Raspberry Pi](image.md) with the full set of required software for working with peripheral devices and [programming autonomous flights](simple_offboard.md). The source code of the platform and of the documentation is open and [available on GitHub](https://github.com/CopterExpress/clover).
If you have studied the documentation but have not found an answer to your question, join our support chat and our specialists will be happy to answer you: [@COEXHelpdesk](tg://resolve?domain=COEXHelpdesk).

View File

@@ -4,13 +4,14 @@
* [Glossary](gloss.md)
* [Safety tips](safety.md)
* Assembly
* [Clever 4 assembly](assemble_4.md)
* [Clever 3 assembly](assemble_3.md)
* [Clever 2 assembly](assemble_2.md)
* [Clover 4 assembly](assemble_4.md)
* [Clover 3 assembly](assemble_3.md)
* [Clover 2 assembly](assemble_2.md)
* Configuration
* [Initial setup](setup.md)
* [Sensor calibration](calibration.md)
* [RC setup](radio.md)
* [Using FS-A8S](rc_flysky_a8s.md)
* [Flight modes](modes.md)
* [Power setup](power.md)
* [Failsafe configuration](failsafe.md)
@@ -41,7 +42,8 @@
* [Interfacing with a sonar](sonar.md)
* [Computer vision basics](camera.md)
* [Using rviz and rqt](rviz.md)
* [Software autorun](autolaunch.md)
* [Software autorun](autolaunch.md)
* [Using JavaScript](javascript.md)
* [ROS](ros.md)
* [MAVROS](mavros.md)
* Supplementary materials
@@ -52,8 +54,9 @@
* [PID Setup](calibratePID.md)
* [Model files for parts](models.md)
* [ROS Melodic installation](ros-install.md)
* [Camera calibration](camera_calibration.md)
* [Quadcopter control with 4G communication](4g.md)
* [Clever and Jetson Nano](jetson_nano.md)
* [Clover and Jetson Nano](jetson_nano.md)
* [Remote control app](rc.md)
* [Wi-Fi Configuration](network.md)
* [UART settings](uart.md)
@@ -64,18 +67,20 @@
* [Multimeter usage](test_connection.md)
* [RC Troubleshooting](radioerrors.md)
* [Flashing ESCs](esc_firmware.md)
* [Camera calibration](camera_calibration.md)
* [Interfacing with Arduino](arduino.md)
* [Connecting GPS](gps.md)
* [Working with IR sensors on Raspberry Pi 3](ir_sensors.md)
* [FPV Setup](fpv.md)
* [Trainer mode](trainer_mode.md)
* [Tinning](tinning.md)
* [Types of power connectors](connectortypes.md)
* [Connecting 4 in 1 ESCs](4in1.md)
* [Soldering safety](tb.md)
* [LED strip (legacy)](leds_old.md)
* [Contribution Guidelines](contributing.md)
* Clever-based projects
* [Migration to v0.20](migrate20.md)
* Clover-based projects
* [Drone show](clever-show.md)
* [Copter spheric guard](shield.md)
* [Face recognition system](face_recognition.md)
* [Android RC app](android.md)
@@ -84,3 +89,5 @@
* [Copter Hack 2019](copterhack2019.md)
* [Copter Hack 2018](copterhack2018.md)
* [Copter Hack 2017](copterhack2017.md)
* [Robocross-2019](robocross2019.md)
* [Camera calibration (legacy)](camera_calib.md)

View File

@@ -14,11 +14,11 @@ However, to make you fully understand the application, I will tell you about eac
## Wrapper
Let's start with the simplest thing — the appearance of our application. At [**GitHub**](https://github.com/CopterExpress/clever/tree/master/apps/android/app/src/main/assets), you can find *HTML*, *CSS* and *JavaScript* files, which make up the web page to be used for controlling the copter. To have this page displayed in our application, do the following:
Let's start with the simplest thing — the appearance of our application. At [**GitHub**](https://github.com/CopterExpress/clover/tree/master/apps/android/app/src/main/assets), you can find *HTML*, *CSS* and *JavaScript* files, which make up the web page to be used for controlling the copter. To have this page displayed in our application, do the following:
1. Create folder **assets** in the main folder of the app named **app**
2. Add to it all files from [here](https://github.com/CopterExpress/clever/tree/master/apps/android/app/src/main/assets)
2. Add to it all files from [here](https://github.com/CopterExpress/clover/tree/master/apps/android/app/src/main/assets)
If you reached this stage, you already have the web page you want, congratulations! Now we have to display it somehow in the app. To do this, in class *activity* in method **onCreate**, write the following code:

View File

@@ -4,7 +4,7 @@ For interaction with ROS topics and services on a Raspberry Pi, you can use the
The main tutorial for rosserial: http://wiki.ros.org/rosserial_arduino/Tutorials
Arudino is to be installed on Clever and connected via a USB port.
Arudino is to be installed on Clover and connected via a USB port.
## Configuring Arduino IDE
@@ -21,19 +21,19 @@ The obtained folder `ros_lib` is to be copied to `<sketches folder>/libraries` o
To run the program on Arduino once, you can use command:
```(bash)
roslaunch clever arduino.launch
roslaunch clover arduino.launch
```
To start the link with Arduino at the startup automatically, set argument `arudino` in the Clever launch file (`~/catkin_ws/src/clever/clever/launch/clever.launch`):
To start the link with Arduino at the startup automatically, set argument `arudino` in the Clover launch file (`~/catkin_ws/src/clover/clover/launch/clover.launch`):
```xml
<arg name="arduino" default="true"/>
```
After the launch file is edited, restart package `clever`:
After the launch file is edited, restart the `clover` service:
```(bash)
sudo systemctl restart clever
sudo systemctl restart clover
```
## Delays
@@ -59,7 +59,7 @@ for(int i=0; i<8; i++) {
}
```
## Working with Clever
## Working with Clover
The set of services and topics is similar to the regular set in [simple_offboard](simple_offboard.md) and [mavros](mavros.md).
@@ -69,11 +69,11 @@ An example of a program that controls the copter by position using the `navigate
// Connecting libraries for working with rosseral
#include <ros.h>
// Connecting Clever and MAVROS package message header files
#include <clever/Navigate.h>
// Connecting Clover and MAVROS package message header files
#include <clover/Navigate.h>
#include <mavros_msgs/SetMode.h>
using namespace clever;
using namespace clover;
using namespace mavros_msgs;
ros::NodeHandle nh;
@@ -174,7 +174,7 @@ With Arduino, you can use the [`get_telemetry` service](simple_offboard.md). To
// ...
#include <clever/GetTelemetry.h>
#include <clover/GetTelemetry.h>
// ...

View File

@@ -1,6 +1,6 @@
# ArUco markers
> **Note** The following applies to [image versions](image.md) **0.16** and up. Older documentation is still available for [for version **0.15.1**](https://github.com/CopterExpress/clever/blob/v0.15.1/docs/ru/aruco.md).
> **Note** The following applies to [image versions](image.md) **0.16** and up. Older documentation is still available for [for version **0.15.1**](https://github.com/CopterExpress/clover/blob/v0.15.1/docs/en/aruco.md).
[ArUco markers](https://docs.opencv.org/3.2.0/d5/dae/tutorial_aruco_detection.html) are commonly used for vision-based position estimation.
@@ -12,13 +12,13 @@ Examples of ArUco markers:
For rapid generation of markers for printing, you may use an online tool: http://chev.me/arucogen/.
[Clever Raspberry Pi image](image.md) contains a pre-installed `aruco_pose` ROS package, which can be used for marker detection.
[Clover Raspberry Pi image](image.md) contains a pre-installed `aruco_pose` ROS package, which can be used for marker detection.
## Modes of operation
There are several preconfigured modes of operation for ArUco markers on the Clever drone:
There are several preconfigured modes of operation for ArUco markers on the Clover drone:
* [single marker detection and navigation](aruco_marker.md);
* [map-based navigation](aruco_map.md).
> **Info** Additional documentation for the `aruco_pose` ROS package is available [on GitHub](https://github.com/CopterExpress/clever/blob/master/aruco_pose/README.md).
> **Info** Additional documentation for the `aruco_pose` ROS package is available [on GitHub](https://github.com/CopterExpress/clover/blob/master/aruco_pose/README.md).

View File

@@ -10,13 +10,13 @@
## Configuration
Set the `aruco` argument in `~/catkin_ws/src/clever/clever/launch/clever.launch` to `true`:
Set the `aruco` argument in `~/catkin_ws/src/clover/clover/launch/clover.launch` to `true`:
```xml
<arg name="aruco" default="true"/>
```
In order to enable map detection set `aruco_map` and `aruco_detect` arguments to `true` in `~/catkin_ws/src/clever/clever/launch/aruco.launch`:
In order to enable map detection set `aruco_map` and `aruco_detect` arguments to `true` in `~/catkin_ws/src/clover/clover/launch/aruco.launch`:
```xml
<arg name="aruco_detect" default="true"/>
@@ -45,12 +45,12 @@ Map path is defined in the `map` parameter:
<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).
Some map examples are provided in [`~/catkin_ws/src/clover/aruco_pose/map`](https://github.com/CopterExpress/clover/tree/master/aruco_pose/map).
Grid maps may be generated using the `genmap.py` script:
```bash
rosrun aruco_pose genmap.py length x y dist_x dist_y first > ~/catkin_ws/src/clever/aruco_pose/map/test_map.txt
rosrun aruco_pose genmap.py length x y dist_x dist_y first > ~/catkin_ws/src/clover/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 (top left marker, unless `--bottom-left` is specified), `test_map.txt` is the name of the generated map file. The optional `--bottom-left` parameter changes the numbering of markers, making the bottom left marker the first one.
@@ -58,7 +58,7 @@ rosrun aruco_pose genmap.py length x y dist_x dist_y first > ~/catkin_ws/src/cle
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
rosrun aruco_pose genmap.py 0.33 2 4 1 1 0 > ~/catkin_ws/src/clover/aruco_pose/map/test_map.txt
```
Additional information on the utility can be obtained using `-h` key: `rosrun aruco_pose genmap.py -h`.
@@ -91,13 +91,6 @@ The marker map adheres to the [ROS coordinate system convention](http://www.ros.
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.
@@ -108,6 +101,13 @@ If you're using **LPE** (`SYS_MC_EST_GROUP` parameter is set to `local_position_
<!-- * Compass should not be fused: `ATT_W_MAG` = 0 -->
If you're using **EKF2** estimator (`SYS_MC_EST_GROUP` parameter is set to `ekf2`), make sure the following is set:
* `EKF2_AID_MASK` should have `vision position fusion` and `vision yaw fusion` flags set.
* Vision angle observations noise: `EKF2_EVA_NOISE` = 0.1 rad.
* Vision position observations noise: `EKF2_EVP_NOISE` = 0.1 m.
* `EKF2_EV_DELAY` = 0.
> **Hint** We recommend using **LPE** for marker-based navigation.
You may use [the `selfcheck.py` utility](selfcheck.md) to check your settings.
@@ -152,7 +152,7 @@ If the drone's altitude is not stable, try increasing the `MPC_Z_VEL_P` paramete
In order to navigate using markers on the ceiling, mount the onboard camera so that it points up and [adjust the camera frame accordingly](camera_setup.md).
You should also set the `known_tilt` parameter to `map_flipped` in both `aruco_detect` and `aruco_map` sections of `~/catkin_ws/src/clever/clever/launch/aruco.launch`:
You should also set the `known_tilt` parameter to `map_flipped` in both `aruco_detect` and `aruco_map` sections of `~/catkin_ws/src/clover/clover/launch/aruco.launch`:
```xml
<param name="known_tilt" value="map_flipped"/>

View File

@@ -10,13 +10,13 @@ Using this module along with [map-based navigation](aruco_map.md) is also possib
## Setup
Set the `aruco` argument in `~/catkin_ws/src/clever/clever/launch/clever.launch` to `true`:
Set the `aruco` argument in `~/catkin_ws/src/clover/clover/launch/clover.launch` to `true`:
```xml
<arg name="aruco" default="true"/>
```
For enabling detection set the `aruco_detect` argument in `~/catkin_ws/src/clever/clever/launch/aruco.launch` to `true`:
For enabling detection set the `aruco_detect` argument in `~/catkin_ws/src/clover/clover/launch/aruco.launch` to `true`:
```xml
<arg name="aruco_detect" default="true"/>

View File

@@ -1,7 +1,7 @@
Clever 2 construction kit assembly instruction
Clover 2 construction kit assembly instruction
============================================
![Clever](../assets/clever2.jpg)
![Clover](../assets/clever2.jpg)
## The constructor kit contents
@@ -78,7 +78,7 @@ Clever 2 construction kit assembly instruction
## Additional equipment
### This equipment is not part of the Clever 2 constructor kit, but it is required for the assembly process
### This equipment is not part of the Clover 2 constructor kit, but it is required for the assembly process
1. Soldering iron
2. Colophony/ Flux (neutral)

View File

@@ -1,8 +1,8 @@
# Assembly of Clever 3
# Assembly of Clover 3
This manual discusses the assembly of the COEX Clever 3 kit with a 4 in 1 EDC circuit-board.
This manual discusses the assembly of the COEX Clover 3 kit with a 4 in 1 EDC circuit-board.
![Clever 3](../assets/clever3_main.jpg)
![Clover 3](../assets/clever3_main.jpg)
> **Caution** Before using soldering equipment, be sure to read the [safety precautions when soldering](tb.md).

View File

@@ -1,4 +1,4 @@
# Clever 4 assembly
# Clover 4 assembly
<img src="../assets/assembling_clever4/clover_assembly.png" width=900 class="zoom center">

View File

@@ -1,4 +1,6 @@
# Step-by-step guide on autonomous flight with Clever 4
# Step-by-step guide on autonomous flight with Clover 4
> **Note** The following applies to [image version](image.md) **0.20** and up. See [previous version of the article](https://github.com/CopterExpress/clover/blob/v0.19/docs/en/auto_setup.md) for older images.
This manual contains links to other articles in which each of the topics addressed is discussed in more detail. If you encounter difficulties while reading one of these articles, it is recommended that you return to this manual, since many operations here are described step by step and some unnecessary steps are skipped.
@@ -15,9 +17,9 @@ This manual contains links to other articles in which each of the topics address
- Connect to Wi-Fi and open the web interface ([this article](wifi.md)).
   After the first power-up, the network appears with a delay. You need to wait until the system is fully loaded. If the Clever network does not appear in the list of networks for a long time, reopen the window with the network selection. Then the list of networks will be updated.
   After the first power-up, the network appears with a delay. You need to wait until the system is fully loaded. If the Clover network does not appear in the list of networks for a long time, reopen the window with the network selection. Then the list of networks will be updated.
> **Hint** Now if you have connected to the Clever's Wi-Fi network, it is recommended to open the [local version of this guide](http://192.168.11.1/docs/ru/auto_setup.html), otherwise the links will not work.
> **Hint** Now if you have connected to the Clover's Wi-Fi network, it is recommended to open the [local version of this guide](http://192.168.11.1/docs/ru/auto_setup.html), otherwise the links will not work.
- Connect to Raspberry Pi via SSH.
@@ -47,7 +49,7 @@ This manual contains links to other articles in which each of the topics address
## Basic commands
You will need the basic Linux commands, as well as special Clever commands, to work efficiently in the system.
You will need the basic Linux commands, as well as special Clover commands, to work efficiently in the system.
Show list of files and folders:
@@ -55,10 +57,10 @@ Show list of files and folders:
ls
```
Go to certain directory by entering the path too it (catkin_ws/src/clever/clever/launch/):
Go to certain directory by entering the path too it (catkin_ws/src/clover/clover/launch/):
```bash
cd catkin_ws/src/clever/clever/launch/
cd catkin_ws/src/clover/clover/launch/
```
Go to home directory:
@@ -73,10 +75,10 @@ Open the file `file.py`:
nano file.py
```
Open the file clever.launch by entering the full path to it (it works even if you're in a different directory):
Open the file clover.launch by entering the full path to it (it works even if you're in a different directory):
```bash
nano ~/catkin_ws/src/clever/clever/launch/clever.launch
nano ~/catkin_ws/src/clover/clover/launch/clover.launch
```
Save file (press sequentially):
@@ -103,16 +105,16 @@ Raspberry Pi complete reboot:
sudo reboot
```
Reboot only Clever package:
Reboot only the `clover` service:
```bash
sudo systemctl restart clever
sudo systemctl restart clover
```
Perform selfcheck:
```bash
rosrun clever selfcheck.py
rosrun clover selfcheck.py
```
Stop a program:
@@ -127,10 +129,10 @@ Start a program `myprogram.py` using Python:
python myprogram.py
```
Journal of the events related to Clever package. Scroll the list by pressing Enter or Ctrl+V (scrolls faster):
Journal of the events related to `clover` package. Scroll the list by pressing Enter or Ctrl+V (scrolls faster):
```bash
journalctl -u clever
journalctl -u clover
```
Open the sudoers file with super user rights (this particular file doesn't open without sudo. You can use sudo to open other locked files or run programs that require super user rights):
@@ -141,45 +143,45 @@ sudo nano /etc/sudoers
## Setting Raspberry Pi for autonomous flight
Most of the parameters for autonomous flight are located in the following directory: `~/catkin_ws/src/clever/clever/launch/`.
Most of the parameters for autonomous flight are located in the following directory: `~/catkin_ws/src/clover/clover/launch/`.
- Enter the directory:
```bash
cd ~/catkin_ws/src/clever/clever/launch/
cd ~/catkin_ws/src/clover/clover/launch/
```
The `~` symbol stands for home directory of your user. If you are already in the directory, you can go with just the command:
```bash
cd catkin_ws/src/clever/clever/launch/
cd catkin_ws/src/clover/clover/launch/
```
> **Hint** Tab can automatically complete the names of files, folders or commands. You need to start entering the desired name and press Tab. If there are no conflicts, the name will be auto completed. For example, to quickly enter the path to the `catkin_ws/src/clever/clever/launch/` directory, after entering `cd`, you can start typing the following key combination:`c-Tab-s-Tab-c-Tab-c-Tab-l-Tab`. This way you can save a lot of time when writing a long command, and also avoid possible mistakes in writing the path.
> **Hint** Tab can automatically complete the names of files, folders or commands. You need to start entering the desired name and press Tab. If there are no conflicts, the name will be auto completed. For example, to quickly enter the path to the `catkin_ws/src/clover/clover/launch/` directory, after entering `cd`, you can start typing the following key combination:`c-Tab-s-Tab-c-Tab-c-Tab-l-Tab`. This way you can save a lot of time when writing a long command, and also avoid possible mistakes in writing the path.
- In this folder you need to configure three files:
- `clever.launch`
- `clover.launch`
- `aruco.launch`
- `main_camera.launch`
- Open the file `clever.launch`:
- Open the file `clover.launch`:
```bash
nano clever.launch
nano clover.launch
```
You must be in the directory in which the file is located. If you are in other directory, you can open the file by writing the full path to it:
```bash
nano ~/catkin_ws/src/clever/clever/launch/clever.launch
nano ~/catkin_ws/src/clover/clover/launch/clover.launch
```
If two users are editing a file at the same time, or if previously the file was closed incorrectly, nano will not display the file contents, it will ask for permission to display the file. To grant permission, press Y.
  If the content of a file is still empty, you may have entered the file name incorrectly. You need to pay attention to the extension. If you entered a wrong name or extension, nano will create a new empty file named this way, which is undesirable. Such file should be deleted.
- Find the following line in clever.launch file:
- Find the following line in clover.launch file:
```xml
<arg name="aruco" default="false"/>
@@ -222,7 +224,7 @@ Most of the parameters for autonomous flight are located in the following direct
- the marker map numbering is from the top left corner (key `--top-left`)
```bash
rosrun aruco_pose genmap.py 0.335 10 10 1 1 0 > ~/catkin_ws/src/clever/aruco_pose/map/map.txt --top-left
rosrun aruco_pose genmap.py 0.335 10 10 1 1 0 > ~/catkin_ws/src/clover/aruco_pose/map/map.txt --top-left
```
In most maps, numbering starts with a zero marker. Also, in most cases, numbering starts from the upper left corner, so when generating, it is very important to enter the key `--top-left`.
@@ -269,10 +271,10 @@ and replace map.txt with your map name.
Ctrl+x; y; Enter
```
- Restart the `clever` service:
- Restart the `clover` service:
```bash
sudo systemctl restart clever
sudo systemctl restart clover
```
## Setting the flight controller
@@ -289,7 +291,7 @@ and replace map.txt with your map name.
- Connect remotely to the flight controller through QGroundControl.
All the necessary settings for that are already set in Clever. Now you need to create a new connection in QGroundControl. Use the settings from [this article](gcs_bridge.md).
All the necessary settings for that are already set in Clover. Now you need to create a new connection in QGroundControl. Use the settings from [this article](gcs_bridge.md).
## Remote controller setup
@@ -297,14 +299,14 @@ and replace map.txt with your map name.
Set channel 5 to SwC switch; channel 5 to SwA switch. Or you can use any other switches you like.
## Clever selfcheck
## Clover selfcheck
Perform selfcheck when you have set up your drone or when you have faced problems. The selfcheck process is described in the article "[Automated self checks](selfcheck.md)"
- Run the command:
```bash
rosrun clever selfcheck.py
rosrun clover selfcheck.py
```
## Writing a program
@@ -368,7 +370,7 @@ The article "[Simple OFFBOARD](simple_offboard.md)" describes working with `simp
## Writing the program to the drone
The easiest way to send the program is to copy the content of the program, create a new file on the Clever command line and paste the program text into the file.
The easiest way to send the program is to copy the content of the program, create a new file in the command line and paste the program text into the file.
- To create the file `myprogram.py`, run the command:

View File

@@ -1,36 +1,38 @@
Software autorun
===
> **Note** In the image version **0.20** `clever` package and service was renamed to `clover`. See [previous version of the article](https://github.com/CopterExpress/clover/blob/v0.19/docs/en/autolaunch.md) for older images.
systemd
---
Main documentation: [https://wiki.archlinux.org/index.php/Systemd_(Russian)](https://wiki.archlinux.org/index.php/Systemd_(Russian)).
All automatically started Clever software is launched as a `clever.service` systemd service.
All automatically started Clover software is launched as a `clover.service` systemd service.
The service may be restarted by the `systemctl` command:
```(bash)
sudo systemctl restart clever
sudo systemctl restart clover
```
Text output of the software can be viewed using the `journalctl` command:
```(bash)
journalctl -u clever
journalctl -u clover
```
To run Clever software directly in the current console session, you can use the `roslaunch` command:
To run Clover software directly in the current console session, you can use the `roslaunch` command:
```(bash)
sudo systemctl restart clever
roslaunch clever clever.launch
sudo systemctl restart clover
roslaunch clover clover.launch
```
You can disable Clever software autolaunch using the `disable` command:
You can disable Clover software autolaunch using the `disable` command:
```(bash)
sudo systemctl disable clever
sudo systemctl disable clover
```
roslaunch
@@ -38,12 +40,12 @@ roslaunch
Main documentation: http://wiki.ros.org/roslaunch.
The list of nodes / programs declared for running is specified in file `/home/pi/catkin_ws/src/clever/clever/launch/clever.launch`.
The list of nodes / programs declared for running is specified in file `/home/pi/catkin_ws/src/clover/clover/launch/clover.launch`.
You can add your own node to the list of automatically launched ones. To do this, place your executable file (e.g. `my_program.py`) into folder `/home/pi/catkin_ws/src/clever/clever/src`. Then add the start of your node to `clever.launch`, for example:
You can add your own node to the list of automatically launched ones. To do this, place your executable file (e.g. `my_program.py`) into folder `/home/pi/catkin_ws/src/clover/clover/src`. Then add the start of your node to `clover.launch`, for example:
```xml
<node name="my_program" pkg="clever" type="my_program.py" output="screen"/>
<node name="my_program" pkg="clover" type="my_program.py" output="screen"/>
```
The started file must have *permission* to run:

View File

@@ -1,6 +1,8 @@
# Working with the camera
Make sure the camera is enabled in the `~/catkin_ws/src/clever/clever/launch/clever.launch` file:
> **Note** In the image version **0.20** `clever` package was renamed to `clover`. See [previous version of the article](https://github.com/CopterExpress/clover/blob/v0.19/docs/en/camera.md) for older images.
Make sure the camera is enabled in the `~/catkin_ws/src/clover/clover/launch/clover.launch` file:
```xml
<arg name="main_camera" default="true"/>
@@ -8,10 +10,10 @@ Make sure the camera is enabled in the `~/catkin_ws/src/clever/clever/launch/cle
Also make sure that [position and orientation of the camera](camera_setup.md) is correct.
The `clever` package must be restarted after the launch-file has been edited:
The `clover` service must be restarted after the launch-file has been edited:
```(bash)
sudo systemctl restart clever
sudo systemctl restart clover
```
You may use rqt or [web_video_server](web_video_server.md) to view the camera stream.
@@ -20,10 +22,10 @@ You may use rqt or [web_video_server](web_video_server.md) to view the camera st
If the camera stream is missing, try using the [`raspistill`](https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md) utility to check whether the camera works.
First, stop the Clever service:
First, stop the `clover` service:
```bash
sudo systemctl stop clever
sudo systemctl stop clover
```
Then use `raspistill` to capture an image from the camera:
@@ -88,53 +90,66 @@ image_pub.publish(bridge.cv2_to_imgmsg(cv_image, 'bgr8'))
The obtained images can be viewed using [web_video_server](web_video_server.md).
#### Retrieving one frame
It's possibly to retrieve one camera frame at a time. This method works slower than normal topic subscribing and should not be used when it's necessary to process camera images continuously.
```python
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
rospy.init_node('computer_vision_sample')
bridge = CvBridge()
# ...
# Retrieve a frame:
img = bridge.imgmsg_to_cv2(rospy.wait_for_message('main_camera/image_raw', Image), 'bgr8')
```
### Examples
#### Working with QR codes
> **Hint** For high-speed recognition and positioning, it is better to use [ArUco markers](aruco.md).
To program actions of the copter upon detection of [QR codes](https://en.wikipedia.org/wiki/QR_code) you can use the [ZBar] library (http://zbar.sourceforge.net). It should be installed using pip:
```bash
sudo pip install zbar
```
To program actions of the copter for the detection of [QR codes](https://en.wikipedia.org/wiki/QR_code) you can use the [pyZBar](https://pypi.org/project/pyzbar/). This lib is installed in the last image for Raspberry Pi.
QR codes recognition in Python:
```python
import cv2
import zbar
import rospy
from pyzbar import pyzbar
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
bridge = CvBridge()
scanner = zbar.ImageScanner()
scanner.parse_config('enable')
rospy.init_node('barcode_test')
# Image subscriber callback function
def image_callback(data):
cv_image = bridge.imgmsg_to_cv2(data, 'bgr8') # OpenCV image
gray = cv2.cvtColor(cv_image, cv2.COLOR_BGR2GRAY, dstCn=0)
pil = ImageZ.fromarray(gray)
raw = pil.tobytes()
image = zbar.Image(320, 240, 'Y800', raw) # Image params
scanner.scan(image)
for symbol in image:
# print detected QR code
print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
barcodes = pyzbar.decode(cv_image)
for barcode in barcodes:
b_data = barcode.data.encode("utf-8")
b_type = barcode.type
(x, y, w, h) = barcode.rect
xc = x + w/2
yc = y + h/2
print ("Found {} with data {} with center at x={}, y={}".format(b_type, b_data, xc, yc))
image_sub = rospy.Subscriber('main_camera/image_raw', Image, image_callback, queue_size=1)
rospy.spin()
```
The script will take up to 100% CPU capacity. To slow down the script artificially, you can use [throttling](http://wiki.ros.org/topic_tools/throttle) of frames from the camera, for example, at 5 Hz (`main_camera.launch`):
```xml
<node pkg="topic_tools" name="cam_throttle" type="throttle"
args="messages main_camera/image_raw 5.0 main_camera/image_raw/throttled"/>
args="messages main_camera/image_raw 5.0 main_camera/image_raw_throttled"/>
```
The topic for the subscriber in this case should be changed for `main_camera/image_raw/throttled`.
The topic for the subscriber in this case should be changed for `main_camera/image_raw_throttled`.

228
docs/en/camera_calib.md Normal file
View File

@@ -0,0 +1,228 @@
# Camera calibration
Computer vision is becoming more and more widespread. Often, computer vision algorithms are not precise and obtain distorted images from the camera, which is especially true for fisheye cameras.
![img](../assets/img1.jpg)
> The image is "rounded" closer to the edge.
Any computer vision algorithm will perceive the picture incorrectly. To remove such distortion, the camera that receives the image is to be calibrated in accordance with its own peculiarities.
## Script installation
First, you have to install the necessary libraries:
```
pip install numpy
pip install opencv-python
pip install glob
pip install pyyaml
pip install urllib.request
```
Then download the script from the repository:
```(bash)
git clone https://github.com/tinderad/clever_cam_calibration.git
```
Go to the downloaded folder and install the script:
```(bash)
cd clever_cam_calibration
sudo python setup.py build
sudo python setup.py install
```
If you are using Windows, download the archive from the [repository](https://github.com/tinderad/clever_cam_calibration/archive/master.zip), unzip it and install:
```(bash)
cd path\to\archive\clever_cam_calibration\
python setup.py build
python setup.py install
```
> path\to\archive path to unpacked archive.
## Preparing for calibration
You will have to prepare a calibration target. It looks like a chessboard. The file is available for downloading [here](https://www.oreilly.com/library/view/learning-opencv-3/9781491937983/assets/lcv3_ac01.png).
Glue a printed target to any solid surface. Count the number of intersections on the board lengthwise and widthwise, measure the size of a cell (mm).
![img](../assets/chessboard.jpg)
Turn on Clover and connect to its Wi-Fi.
> Navigate to 192.168.11.1:8080 and check whether the computer receives images from the image_raw topic.
## Calibration
Run script ***calibrate_cam***:
**Windows:**
```(bash)
>path\to\python\Scripts\calibrate_cam.exe
```
> path\to\Python path to the Python folder
**Linux:**
```(bash)
>calibrate_cam
```
Specify board parameters:
```(bash)
>calibrate_cam
Chessboard width: # Intersections widthwise
Chessboard height: # Intersections heightwise
Square size: # Length of cell edge (mm)
Saving mode (YES - on): # Save mode
```
> Save mode: if enabled, all received pictures will be saved in the current folder.
The script will start running:
```
Calibration started!
Commands:
help, catch (key: Enter), delete, restart, stop, finish
```
To calibrate the camera, make at least 25 photos of the chessboard at various angles.
![img](../assets/calibration.jpg)
To make a photo, enter command ***catch***.
```(bash)
>catch
```
The program will inform you about the calibration status.
```(bash)
...
Chessboard not found, now 0 (25 required)
> # Enter
---
Image added, now 1 (25 required)
```
> Instead of entering command ***catch*** each time, you can just press ***Enter*** (enter a blank line).
After you have made a sufficient number of images, enter command ***finish***.
```(bash)
...
>finish
Calibration successful!
```
### Calibration by the existing images
If you already have images, you can calibrate the camera by them with the help of script ***calibrate_cam_ex***.
```(bash)
>calibrate_cam_ex
```
Specify target characteristics and the path to the folder with images:
```(bash)
>calibrate_cam_ex
Chessboard width: # Intersections widthwise
Chessboard height: # Intersections heightwise
Square size: # Length of cell edge (mm)
Path: # Path to the folder with images
```
Apart from that, this script works similarly to ***calibrate_cam***.
The program will process all received pictures, and create file ***camera_info.yaml*** in the current folder. Using this file, you can equalize distortions in the images obtained from this camera.
> If you change the resolution of the received image, you will have to re-calibrate the camera.
## Correcting distortions
Function ***get_undistorted_image(cv2_image, camera_info)*** is responsible for obtaining a corrected image:
* ***cv2_image***: An image encoded into a cv2 array.
* ***camera_info***: The path to the calibration file.¬
The function returns a cv2 array, into which the corrected image is coded.
> If you are using a fisheye camera provided with Clover, for processing images with resolution 320x240 or 640x480, you can use the existing calibration settings. To do this, pass parameters ***clever_cam_calibration.clevercamcalib.CLEVER_FISHEYE_CAM_320*** or ***clever_cam_calibration.clevercamcalib.CLEVER_FISHEYE_CAM_640*** as argument ***camera_info***, respectively.
## Examples of operation
Source images:
![img](../assets/img1.jpg)
![img](../assets/img2.jpg)
Corrected images:
![img](../assets/calibresult.jpg)
![img](../assets/calibresult1.jpg)
## An example of usage
**Processing image stream from the camera**.
This program receives images from the camera on Clover and displays them on the screen in corrected for, using the existing calibration file.
```python
import clevercamcalib.clevercamcalib as ccc
import cv2
import urllib.request
import numpy as np
while True:
req = urllib.request.urlopen('http://192.168.11.1:8080/snapshot?topic=/main_camera/image_raw')
arr = np.asarray(bytearray(req.read()), dtype=np.uint8)
image = cv2.imdecode(arr, -1)
undistorted_img = ccc.get_undistorted_image(image, ccc.CLEVER_FISHEYE_CAM_640)
cv2.imshow("undistort", undistorted_img)
cv2.waitKey(33)
cv2.destroyAllWindows()
```
## The usage for ArUco
To apply the calibration parameters to the ArUco navigation system, move the calibration .yaml file to Raspberry Pi of Clover, and initialize it.
> Don't forget to connect to Wi-Fi of Clover.
The SFTP protocol is used for transferring the file. This example, WinSCP program is used.
Connect to Raspberry Pi via SFTP:
> Password: ***raspberry***
![img](../assets/wcp1.png)
Press “Enter”. Go to ***/home/pi/catkin_ws/src/clever/clever/camera_info/***, and copy the calibration .yaml file to this folder:
![img](../assets/wcp2.jpg)
Now we have to select this file in ArUco configuration. Connection via SSH is used for this purpose. This example, PuTTY program is used.
Connect to Raspberry Pi via SSH:
![img](../assets/pty1.jpg)
Log in with username ***pi*** and password ***raspberry***, go to directory ***/home/pi/catkin_ws/src/clever/clever/launch*** and start editing configuration ***main_camera.launch***:
![img](../assets/pty2.jpg)
In line ***camera node***, change parameter ***camera_info*** to ***camera_info.yaml***:
![img](../assets/pty3.jpg)
> Don't forget to change camera resolution.

View File

@@ -1,228 +1,45 @@
# Camera calibration
Computer vision is becoming more and more widespread. Often, computer vision algorithms are not precise and obtain distorted images from the camera, which is especially true for fisheye cameras.
Camera calibration can significantly improve the quality of nodes related to computer vision: [ArUco markers detection](aruco.md) and [optical flow](optical_flow.md).
![img](../assets/img1.jpg)
Camera calibration process allows to define the parameters reflecting the specific lens installed. These parameters include focal lengths, principal point (which depends on camera lens placement regarding the centre), distortion coefficient *D*. You can read more about camera distortion model used in the [OpenCV documentation](https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html).
> The image is "rounded" closer to the edge.
There are several tools allowing to calibrate the camera and store calculated parameters into the system. Usually they use calibration images, "chessboards" or combinations of "chessboards" and ArUco-marker grids ([ChArUco](https://docs.opencv.org/3.4/df/d4a/tutorial_charuco_detection.html)).
Any computer vision algorithm will perceive the picture incorrectly. To remove such distortion, the camera that receives the image is to be calibrated in accordance with its own peculiarities.
## camera_calibration ROS-package
## Script installation
Main tutorial: http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration.
First, you have to install the necessary libraries:
In order to calibrate the camera with the `camera_calibration` ROS-package you need a computer with OS GNU/Linux and [ROS Melodic](ros-install.md) installed.
```
pip install numpy
pip install opencv-python
pip install glob
pip install pyyaml
pip install urllib.request
```
<img src="../assets/camera_calibration.png" alt="ROS Camera Calibrator" class="zoom center" width=600>
Then download the script from the repository:
1. Using the Terminal, install `camera_calibration` package to your computer:
```(bash)
git clone https://github.com/tinderad/clever_cam_calibration.git
```
```bash
sudo apt-get install ros-melodic-camera-calibration
```
Go to the downloaded folder and install the script:
2. Download the chessboard [chessboard.pdf](../assets/chessboard.pdf). Print the chessboard on paper or open it on the computer screen.
```(bash)
cd clever_cam_calibration
sudo python setup.py build
sudo python setup.py install
```
3. Connect to the [Clover Wi-Fi network](wifi.md).
If you are using Windows, download the archive from the [repository](https://github.com/tinderad/clever_cam_calibration/archive/master.zip), unzip it and install:
4. Run camera calibration (on your computer):
```(bash)
cd path\to\archive\clever_cam_calibration\
python setup.py build
python setup.py install
```
```bash
ROS_MASTER_URI=http://192.168.11.1:11311 rosrun camera_calibration cameracalibrator.py --size 6x8 --square 0.108 image:=/main_camera/image_raw camera:=/main_camera
```
> path\to\archive path to unpacked archive.
> **Note** Change the value *0.108* to actual size a square on the chessboard in metres. For example, value *0.03* corresponds to 3 cm.
## Preparing for calibration
5. When the calibration program starts, move the drone so the calibration board is observed from different angles:
You will have to prepare a calibration target. It looks like a chessboard. The file is available for downloading [here](https://www.oreilly.com/library/view/learning-opencv-3/9781491937983/assets/lcv3_ac01.png).
Glue a printed target to any solid surface. Count the number of intersections on the board lengthwise and widthwise, measure the size of a cell (mm).
* Place the chessboard in the left, right, top and bottom part of the frame.
* Rotate the chessboard around all 3 axes.
* Move camera toward and away from the chessboard, so that it is observed from different distance.
![img](../assets/chessboard.jpg)
6. Click the *CALIBRATE* button, when it's active. The process of calculation will take several minutes.
Turn on Clever and connect to its Wi-Fi.
When the calculation is done, you'll see calculated parameters in the terminal. The corrected camera image view will be displayed as well. If calibration was successful all straight lines will remain straight on the image displayed.
> Navigate to 192.168.11.1:8080 and check whether the computer receives images from the image_raw topic.
## Calibration
Run script **_calibrate_cam_**:
**Windows:**
```(bash)
>path\to\python\Scripts\calibrate_cam.exe
```
> path\to\Python path to the Python folder
**Linux:**
```(bash)
>calibrate_cam
```
Specify board parameters:
```(bash)
>calibrate_cam
Chessboard width: # Intersections widthwise
Chessboard height: # Intersections heightwise
Square size: # Length of cell edge (mm)
Saving mode (YES - on): # Save mode
```
> Save mode: if enabled, all received pictures will be saved in the current folder.
The script will start running:
```
Calibration started!
Commands:
help, catch (key: Enter), delete, restart, stop, finish
```
To calibrate the camera, make at least 25 photos of the chessboard at various angles.
![img](../assets/calibration.jpg)
To make a photo, enter command **_catch_**.
```(bash)
>catch
```
The program will inform you about the calibration status.
```(bash)
...
Chessboard not found, now 0 (25 required)
> # Enter
---
Image added, now 1 (25 required)
```
> Instead of entering command **_catch_** each time, you can just press **_Enter_** (enter a blank line).
After you have made a sufficient number of images, enter command **_finish_**.
```(bash)
...
>finish
Calibration successful!
```
### Calibration by the existing images
If you already have images, you can calibrate the camera by them with the help of script **_calibrate_cam_ex_**.
```(bash)
>calibrate_cam_ex
```
Specify target characteristics and the path to the folder with images:
```(bash)
>calibrate_cam_ex
Chessboard width: # Intersections widthwise
Chessboard height: # Intersections heightwise
Square size: # Length of cell edge (mm)
Path: # Path to the folder with images
```
Apart from that, this script works similarly to **_calibrate_cam_**.
The program will process all received pictures, and create file **_camera_info_****_._****_yaml_** in the current folder. Using this file, you can equalize distortions in the images obtained from this camera.
> If you change the resolution of the received image, you will have to re-calibrate the camera.
## Correcting distortions
Function **_get_undistorted_image(cv2_image, camera_info)_** is responsible for obtaining a corrected image:
* **_cv2_image_**: An image encoded into a cv2 array.
* **_camera_****___****_info_**: The path to the calibration file.¬
The function returns a cv2 array, into which the corrected image is coded.
> If you are using a fisheye camera provided with Clever, for processing images with resolution 320x240 or 640x480, you can use the existing calibration settings. To do this, pass parameters **_clever_cam_calibration.clevercamcalib.CLEVER_FISHEYE_CAM_320_** or **_clever_cam_calibration.clevercamcalib.CLEVER_FISHEYE_CAM_640_** as argument **_camera_info_**, respectively.
## Examples of operation
Source images:
![img](../assets/img1.jpg)
![img](../assets/img2.jpg)
Corrected images:
![img](../assets/calibresult.jpg)
![img](../assets/calibresult1.jpg)
## An example of usage
**Processing image stream from the camera**.
This program receives images from the camera on Clever and displays them on the screen in corrected for, using the existing calibration file.
```python
import clevercamcalib.clevercamcalib as ccc
import cv2
import urllib.request
import numpy as np
while True:
req = urllib.request.urlopen('http://192.168.11.1:8080/snapshot?topic=/main_camera/image_raw')
arr = np.asarray(bytearray(req.read()), dtype=np.uint8)
image = cv2.imdecode(arr, -1)
undistorted_img = ccc.get_undistorted_image(image, ccc.CLEVER_FISHEYE_CAM_640)
cv2.imshow("undistort", undistorted_img)
cv2.waitKey(33)
cv2.destroyAllWindows()
```
## The usage for ArUco
To apply the calibration parameters to the ArUco navigation system, move the calibration .yaml file to Raspberry Pi of Clever, and initialize it.
> Don't forget to connect to Wi-Fi of Clever.
The SFTP protocol is used for transferring the file. This example, WinSCP program is used.
Connect to Raspberry Pi via SFTP:
> Password: _**raspberry**_
![img](../assets/wcp1.png)
Press “Enter”. Go to _**/home/pi/catkin_ws/src/clever/clever/camera_info/**_, and copy the calibration .yaml file to this folder:
![img](../assets/wcp2.jpg)
Now we have to select this file in ArUco configuration. Connection via SSH is used for this purpose. This example, PuTTY program is used.
Connect to Raspberry Pi via SSH:
![img](../assets/pty1.jpg)
Log in with username _**pi**_ and password _**raspberry**_, go to directory _**/home/pi/catkin_ws/src/clever/clever/launch**_ and start editing configuration _**main_camera.launch**_:
![img](../assets/pty2.jpg)
In line _**camera node**_, change parameter _**camera_info**_ to _**camera_info.yaml**_:
![img](../assets/pty3.jpg)
> Don't forget to change camera resolution.
7. Click the *COMMIT* button to store calculated calibration parameters. The result will be stored in the main Clover camera calibration file: `/home/pi/catkin_ws/src/clover/clover/camera_info/fisheye_cam_320.yaml`.

View File

@@ -1,10 +1,10 @@
# Camera setup
> **Note** The following applies to [image version](image.md) **0.15** and up. See [previous version of the article](https://github.com/CopterExpress/clever/blob/v0.14/docs/ru/camera_frame.md) (Russian only) for older images.
> **Note** The following applies to [image version](image.md) **0.20** and up. See [previous version of the article](https://github.com/CopterExpress/clover/blob/v0.19/docs/en/camera_frame.md) for older images.
Computer vision modules (like [ArUco markers](aruco.md) and [Optical Flow](optical_flow.md)) require adjusting the camrea focus and set up camera position and orientation relative to the drone body.
Computer vision modules (like [ArUco markers](aruco.md) and [Optical Flow](optical_flow.md)) require adjusting the camera focus and set up camera position and orientation relative to the drone body. Optional camera calibration can improve their quality of performance.
## Focusing the camera lens
## Focusing the camera lens {#focus}
In order to focus the camera lens, do the following:
@@ -19,10 +19,71 @@ In order to focus the camera lens, do the following:
## Setting the camera position {#frame}
Position and orientation of the main camera is [set in the](cli.md#editing) `~/catkin_ws/src/clever/clever/launch/main_camera.launch` file:
Position and orientation of the main camera is [set in the](cli.md#editing) `~/catkin_ws/src/clover/clover/launch/main_camera.launch` file:
```xml
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0 0 -0.07 -1.5707963 0 3.1415926 base_link main_camera_optical"/>
<arg name="direction_z" default="down"/> <!-- direction the camera points: down, up -->
<arg name="direction_y" default="backward"/> <!-- direction the camera cable points: backward, forward -->
```
To set the orientation, define:
* direction the camera lens points `direction_z`: `down` or `up`;
* direction the camera cable points `direction_y`: `backward` or `forward`.
### Examples
### Camera faces downward, cable goes backward
```xml
<arg name="direction_z" default="down"/>
<arg name="direction_y" default="backward"/>
```
<img src="../assets/camera_option_1_rviz.png" width=300>
<img src="../assets/camera_option_1_clever.jpg" width=300>
### Camera faces downward, cable goes forward
```xml
<arg name="direction_z" default="down"/>
<arg name="direction_y" default="forward"/>
```
<img src="../assets/camera_option_2_rviz.png" width=300>
<img src="../assets/camera_option_2_clever.jpg" width=300>
### Camera faces upward, cable goes backward
```xml
<arg name="direction_z" default="up"/>
<arg name="direction_y" default="backward"/>
```
<img src="../assets/camera_option_3_rviz.png" width=300>
<img src="../assets/camera_option_3_clever.jpg" width=300>
### Camera faces upward, cable goes forward
```xml
<arg name="direction_z" default="up"/>
<arg name="direction_y" default="forward"/>
```
<img src="../assets/camera_option_4_rviz.png" width=300>
<img src="../assets/camera_option_4_clever.jpg" width=300>
> **Hint** The [`selfcheck.py` utility](selfcheck.md) will describe your current camera setup in a human-readable fashion. Be sure to check whether this description corresponds to your actual camera position.
### Custom camera position
It's possible to set arbitrary camera position and orientation. In order to do that uncomment node, marked as `Template for custom camera orientation`:
```xml
<!-- Template for custom camera orientation -->
<!-- Camera position and orientation are represented by base_link -> main_camera_optical transform -->
<!-- static_transform_publisher arguments: x y z yaw pitch roll frame_id child_frame_id -->
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0.05 0 -0.07 -1.5707963 0 3.1415926 base_link main_camera_optical"/>
```
This line describes how the camera is positioned relative to the drone body. Technically, it creates a static transform between the `base_link` frame ( which [corresponds to the flight controller housing](frames.md)) and the camera (`main_camera_optical`) in the following format:
@@ -39,44 +100,6 @@ Camera frame (that is, [frame of reference](frames.md)) is aligned as follows:
Shifts are set in meters, angles are in radians. You can check the transform for correctness using [rviz](rviz.md).
## Presets for Clever
## Calibration {#calibration}
The presets for usual camera orientations are available in the `main_camera.launch` file. The images should help you choose the one that is right for you: the first one is how your drone will be displayed in [rviz](rviz.md), the second is how the camera is actually mounted on the drone.
### 1. Camera faces downward, cable goes backward
```xml
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0.05 0 -0.07 -1.5707963 0 3.1415926 base_link main_camera_optical"/>
```
<img src="../assets/camera_option_1_rviz.png" width=400>
<img src="../assets/camera_option_1_clever.jpg" width=400>
### 2. Camera faces downward, cable goes forward
```xml
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0.05 0 -0.07 1.5707963 0 3.1415926 base_link main_camera_optical"/>
```
<img src="../assets/camera_option_2_rviz.png" width=400>
<img src="../assets/camera_option_2_clever.jpg" width=400>
### 3. Camera faces upward, cable goes backward
```xml
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0.05 0 0.07 1.5707963 0 0 base_link main_camera_optical"/>
```
<img src="../assets/camera_option_3_rviz.png" width=400>
<img src="../assets/camera_option_3_clever.jpg" width=400>
### 4. Camera faces upward, cable goes forward
```xml
<node pkg="tf2_ros" type="static_transform_publisher" name="main_camera_frame" args="0.05 0 0.07 -1.5707963 0 0 base_link main_camera_optical"/>
```
<img src="../assets/camera_option_4_rviz.png" width=400>
<img src="../assets/camera_option_4_clever.jpg" width=400>
> **Hint** The [`selfcheck.py` utility](selfcheck.md) will describe your current camera setup in a human-readable fashion. Be sure to check whether this description corresponds to your actual camera position.
To improve the quality of computer vision related algorithms it's recommended to perform camera calibration, which is described in the [appropriate article](camera_calibration.md).

18
docs/en/clever-show.md Normal file
View File

@@ -0,0 +1,18 @@
# clever-show
Software for making the drone show controlled by Raspberry Pi, PX4 and COEX [Clover](https://github.com/CopterExpress/clover) package.
Create animation in Blender, convert it to drone paths, set up the drones and run your own show!
Project repository: https://github.com/CopterExpress/clever-show.
## Demo video
<iframe width="560" height="315" src="https://www.youtube.com/embed/HdHbZFz7nR0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
12 drones perform in a show in Electrotheatre Stanislavsky, Moscow.
## Team
* Arthur Golubtsov, software engineer in COEX, https://github.com/goldarte
* Artem Vasyunik, software engineer intern in COEX, https://github.com/artem30801

View File

@@ -15,7 +15,7 @@ ls
Change current (working) directory:
```bash
cd catkin_ws/src/clever/clever/launch
cd catkin_ws/src/clover/clover/launch
```
Go one directory level up:
@@ -65,16 +65,16 @@ You can use **nano** to edit files on the Raspberry Pi. It is one of the more us
For example:
```bash
nano ~/catkin_ws/src/clever/clever/launch/clever.launch
nano ~/catkin_ws/src/clover/clover/launch/clover.launch
```
<img src="../assets/nano.png" alt="Editing files in nano" data-action="zoom">
2. Edit the file.
3. Press `Ctrl`+`X`, `Y`, `Enter` to save your file and exit.
4. Restart the `clever` package if you've changed .launch files:
4. Restart the `clover` service if you've changed .launch files:
```bash
sudo systemctl restart clever
sudo systemctl restart clover
```
You may also use other editors like **vim** if you prefer.

View File

@@ -1,6 +1,6 @@
# COEX Pix
The **COEX Pix** flight controller is a modified [Pixracer](https://docs.px4.io/v1.9.0/en/flight_controller/pixracer.html) FCU. It is a part of the **Clever 4** quadrotor kit.
The **COEX Pix** flight controller is a modified [Pixracer](https://docs.px4.io/v1.9.0/en/flight_controller/pixracer.html) FCU. It is a part of the **Clover 4** quadrotor kit.
## Revision 1.1
@@ -43,7 +43,7 @@ The **COEX Pix** flight controller is a modified [Pixracer](https://docs.px4.io/
### Mounting suggestions
**Important**: The board is meant to be installed with a non-standard orientation (roll 180º, yaw 90º) on the Clever airframe. Therefore, the `SENS_BOARD_ROT` PX4 parameter should be set to `ROLL 180, YAW 90`.
**Important**: The board is meant to be installed with a non-standard orientation (roll 180º, yaw 90º) on the Clover airframe. Therefore, the `SENS_BOARD_ROT` PX4 parameter should be set to `ROLL 180, YAW 90`.
### Usage notes

View File

@@ -20,22 +20,24 @@ USB connection is the preferred way to connect to the flight controller.
## UART connection
> **Note** In the image version **0.20** `clever` package and service was renamed to `clover`. See [previous version of the article](https://github.com/CopterExpress/clover/blob/v0.19/docs/en/connection.md) for older images.
<!-- TODO: Connection scheme -->
UART connection is another way for the Raspberry Pi and FCU to communicate.
1. Connect Raspberry Pi to your FCU using a UART cable.
2. [Connect to the Raspberry Pi over SSH](ssh.md).
3. Change the connection type in `~/catkin_ws/src/clever/clever/launch/clever.launch` to UART:
3. Change the connection type in `~/catkin_ws/src/clover/clover/launch/clover.launch` to UART:
```xml
<arg name="fcu_conn" default="uart"/>
```
Be sure to restart the `clever` service after editing the .launch file:
Be sure to restart the `clover` service after editing the .launch file:
```bash
sudo systemctl restart clever
sudo systemctl restart clover
```
> **Hint** Set the `SYS_COMPANION` PX4 parameter to 921600 to enable UART on the FCU.

Some files were not shown because too many files have changed in this diff Show More