mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 05:29:32 +00:00
Merge remote-tracking branch 'origin' into buster
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"title": "Clever",
|
||||
"description": "Конструктор квадрокоптера «Клевер»",
|
||||
"author": "Copter Express",
|
||||
"language": "ru",
|
||||
"language": "en",
|
||||
"root": "docs/",
|
||||
"gitbook": "^3.2.2",
|
||||
"plugins": [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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") ||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
#include <geometry_msgs/TransformStamped.h>
|
||||
#include <geometry_msgs/PoseStamped.h>
|
||||
#include <geometry_msgs/PoseWithCovarianceStamped.h>
|
||||
#include <std_srvs/Trigger.h>
|
||||
// #include <aruco_pose/MarkerArray.h>
|
||||
|
||||
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 +86,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 +109,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 +149,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();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
```
|
||||
|
||||
## Дополнительные настройки
|
||||
|
||||
<!-- TODO: статья по пидам -->
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user