From 45356b19a94a5b408a5f2e005a7b4ec9b93a625a Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Sun, 15 Sep 2019 17:53:15 +0300 Subject: [PATCH 1/8] docs: add note about flying relative to a marker in the map --- docs/en/aruco_map.md | 7 +++++++ docs/ru/aruco_map.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/docs/en/aruco_map.md b/docs/en/aruco_map.md index 300333d0..cd6a97ca 100644 --- a/docs/en/aruco_map.md +++ b/docs/en/aruco_map.md @@ -120,6 +120,13 @@ time.sleep(5) navigate(2, 2, 2, speed=1, frame_id='aruco_map') ``` +Starting from the [image](image.md) version 0.18, the drone also can fly relative to a marker in the map, even if it doesn't see it: + +```python +# Fly to 1 meter above the marker 5 +navigate(frame_id='aruco_5', x=0, y=0, z=1) +``` + ## Additional settings If the drone's position is not stable when VPE is used, try increasing the *P* term in the velocity PID regulator: increase the `MPC_XY_VEL_P` and `MPC_Z_VEL_P` parameters. diff --git a/docs/ru/aruco_map.md b/docs/ru/aruco_map.md index ba0ec89c..f531f3b0 100644 --- a/docs/ru/aruco_map.md +++ b/docs/ru/aruco_map.md @@ -128,6 +128,13 @@ time.sleep(5) navigate(2, 2, 2, speed=1, frame_id='aruco_map') # полет в координату 2:2, высота 3 метра ``` +Начиная с версии [образа](image.md) 0.18, доступны также полеты относительно отдельного маркера в карте, даже если дрон его не видит: + +```python +# Полет на высоту 1 м над маркером 5 +navigate(frame_id='aruco_5', x=0, y=0, z=1) +``` + ## Дополнительные настройки From 5c2441e2e8147fed59b33cb995cfe72dd63ac0bd Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Mon, 16 Sep 2019 20:24:13 +0300 Subject: [PATCH 2/8] image: add importing SetLedEffect in tests --- builder/test/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/test/tests.py b/builder/test/tests.py index 50e5f457..6d7f6e60 100755 --- a/builder/test/tests.py +++ b/builder/test/tests.py @@ -15,7 +15,7 @@ from mavros_msgs.srv import CommandBool, CommandLong, SetMode from std_srvs.srv import Trigger from clever.srv import GetTelemetry, Navigate, NavigateGlobal, SetPosition, SetVelocity, \ - SetAttitude, SetRates + SetAttitude, SetRates, SetLEDEffect import tf2_ros import tf2_geometry_msgs From 3ba4ebf3a2f884c39ba350308e6061afe3ee831c Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 17 Sep 2019 03:15:10 +0300 Subject: [PATCH 3/8] gitbook: make main page language select --- book.json | 2 +- redirects.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/book.json b/book.json index 3e74303d..8b5f2ff9 100644 --- a/book.json +++ b/book.json @@ -2,7 +2,7 @@ "title": "Clever", "description": "Конструктор квадрокоптера «Клевер»", "author": "Copter Express", - "language": "ru", + "language": "en", "root": "docs/", "gitbook": "^3.2.2", "plugins": [ diff --git a/redirects.json b/redirects.json index 24d10962..e6dd4a11 100644 --- a/redirects.json +++ b/redirects.json @@ -1,6 +1,5 @@ { "redirects": [ - { "from": "index.html", "to": "ru/index.html" }, { "from": "assemble.html", "to": "ru/assemble_2.html" }, { "from": "assemble_clever3_4in1.html", "to": "ru/assemble_3.html" }, { "from": "glossary.html", "to": "ru/gloss.html" }, From a4fa53ba1bcb5cd24d4dfbb4fc74a39069a0ceaa Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Wed, 25 Sep 2019 23:59:48 +0300 Subject: [PATCH 4/8] vpe_publisher: implement ~reset service --- clever/src/vpe_publisher.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/clever/src/vpe_publisher.cpp b/clever/src/vpe_publisher.cpp index 34f54152..16d94103 100644 --- a/clever/src/vpe_publisher.cpp +++ b/clever/src/vpe_publisher.cpp @@ -24,6 +24,7 @@ using std::string; using namespace geometry_msgs; +bool reset_flag = false; string local_frame_id, frame_id, child_frame_id, offset_frame_id; tf2_ros::Buffer tf_buffer; ros::Publisher vpe_pub; @@ -84,13 +85,14 @@ void callback(const T& msg) // offset if (!offset_frame_id.empty()) { - if (msg->header.stamp - vpe.header.stamp > offset_timeout) { + if (reset_flag || msg->header.stamp - vpe.header.stamp > offset_timeout) { // calculate the offset offset = tf_buffer.lookupTransform(local_frame_id, frame_id, msg->header.stamp, ros::Duration(0.02)); // offset.header.frame_id = vpe.header.frame_id; offset.child_frame_id = offset_frame_id; br.sendTransform(offset); + reset_flag = false; ROS_INFO("offset reset"); } // apply the offset @@ -106,6 +108,13 @@ void callback(const T& msg) } } +bool reset(std_srvs::Trigger::Request& req, std_srvs::Trigger::Response& res) +{ + reset_flag = true; + res.success = true; + return true; +} + int main(int argc, char **argv) { ros::init(argc, argv, "vpe_publisher"); ros::NodeHandle nh, nh_priv("~"); @@ -139,6 +148,8 @@ int main(int argc, char **argv) { local_position_sub = nh.subscribe("mavros/local_position/pose", 1, &localPositionCallback); } + auto reset_serv = nh_priv.advertiseService("reset", &reset); + ROS_INFO("ready"); ros::spin(); } From 68fc2fee1aaf0f00a18ee782693b6c6884f6e801 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Thu, 26 Sep 2019 00:44:03 +0300 Subject: [PATCH 5/8] vpe_publisher: quick fix --- clever/src/vpe_publisher.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clever/src/vpe_publisher.cpp b/clever/src/vpe_publisher.cpp index 16d94103..580a5f4e 100644 --- a/clever/src/vpe_publisher.cpp +++ b/clever/src/vpe_publisher.cpp @@ -19,6 +19,7 @@ #include #include #include +#include // #include using std::string; From a6bdedbfc12eb179142a2d2f038a0d7c72d5575e Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 27 Sep 2019 00:39:24 +0300 Subject: [PATCH 6/8] selfcheck.py: fix velocity check --- clever/src/selfcheck.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clever/src/selfcheck.py b/clever/src/selfcheck.py index 2aff0fb1..5b9c58fa 100755 --- a/clever/src/selfcheck.py +++ b/clever/src/selfcheck.py @@ -477,7 +477,7 @@ def check_local_position(): @check('Velocity estimation') def check_velocity(): try: - velocity = rospy.wait_for_message('mavros/local_position/velocity', TwistStamped, timeout=1) + velocity = rospy.wait_for_message('mavros/local_position/velocity_local', TwistStamped, timeout=1) horiz = math.hypot(velocity.twist.linear.x, velocity.twist.linear.y) vert = velocity.twist.linear.z if abs(horiz) > 0.1: @@ -485,6 +485,7 @@ def check_velocity(): if abs(vert) > 0.1: failure('vertical velocity estimation is %.2f m/s; is copter staying still?' % vert) + velocity = rospy.wait_for_message('mavros/local_position/velocity_body', TwistStamped, timeout=1) angular = velocity.twist.angular ANGULAR_VELOCITY_LIMIT = 0.1 if abs(angular.x) > ANGULAR_VELOCITY_LIMIT: From 6f3ced98cbb90c864e65b90dd3bde9b9369468b8 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 1 Oct 2019 15:54:50 +0200 Subject: [PATCH 7/8] docs: fix sonar sample --- docs/en/sonar.md | 1 + docs/ru/sonar.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/en/sonar.md b/docs/en/sonar.md index bc515dfd..1ec802d5 100644 --- a/docs/en/sonar.md +++ b/docs/en/sonar.md @@ -70,6 +70,7 @@ def fall(gpio, level, tick): done.set() def read_distance(): + global low done.clear() pi.gpio_trigger(TRIG, 50, 1) done.wait(timeout=5) diff --git a/docs/ru/sonar.md b/docs/ru/sonar.md index 8d92ddce..be979100 100644 --- a/docs/ru/sonar.md +++ b/docs/ru/sonar.md @@ -70,6 +70,7 @@ def fall(gpio, level, tick): done.set() def read_distance(): + global low done.clear() pi.gpio_trigger(TRIG, 50, 1) done.wait(timeout=5) From f42392888c58904a0f82d882f338d27eb8da9fb3 Mon Sep 17 00:00:00 2001 From: sfalexrog Date: Mon, 7 Oct 2019 14:18:41 +0300 Subject: [PATCH 8/8] clever/led: Remove return type from notify --- clever/src/led.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clever/src/led.cpp b/clever/src/led.cpp index 92d01281..e72354d3 100644 --- a/clever/src/led.cpp +++ b/clever/src/led.cpp @@ -230,7 +230,7 @@ void handleState(const led_msgs::LEDStateArray& msg) led_count = state.leds.size(); } -bool notify(const std::string& event) +void notify(const std::string& event) { if (ros::param::has("~notify/" + event + "/effect") || ros::param::has("~notify/" + event + "/r") ||