Skip to content

Instantly share code, notes, and snippets.

@okalachev
okalachev / sonar.py
Last active January 30, 2022 23:06
ROS node that filters and publishes data from HC-SR04 rangefinder
# -*- coding: utf-8 -*-
import time
import threading
import pigpio
import collections
import numpy
import rospy
from sensor_msgs.msg import Range
@okalachev
okalachev / test.py
Last active October 18, 2018 20:24
import rospy
from clever import srv
from std_srvs.srv import Trigger
rospy.init_node('testflight')
navigate = rospy.ServiceProxy('navigate', srv.Navigate)
land = rospy.ServiceProxy('land', Trigger)
@okalachev
okalachev / c-cpp-java-js-swift.cpp
Last active December 12, 2019 02:21
Hats for COEX code
/*
* Description text
* Copyright (C) 2018 Copter Express Technologies
*
* Author: Ivan Petrov <ipetrov@gmail.com>
*
* Distributed under MIT License (available at https://opensource.org/licenses/MIT).
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
#include <iostream>
using namespace std;
int i = 11;
int j = 22;
void invoke(void (*callback)(void))
{
callback();

MAVLink Switch

Configuration

MAVLink Switch is configured using a configuration YAML file, containing endpoints and rules sets.

Endpoints

#!/usr/bin/python
import rospy
import thread
import sys
import math
from mavros_msgs.msg import RCIn
from clever import srv
from time import sleep
from mavros_msgs.srv import SetMode
from mavros_msgs.srv import CommandBool

Архитектура API CoexHub

Терминология

Это есть:

Drone — девайc, подключенный к CoexHub. Коптер, зарядная станция, либо еще что-нибудь.

Drone_type — тип (модель) девайса. Pyramid — дрон, который садится в зарядную станцию, Clever — клевер, charging_station — зарядная станция, и т д.

function quatFromEuler(roll, pitch, yaw) {
var c1 = Math.cos(x / 2);
var c2 = Math.cos(y / 2);
var c3 = Math.cos(z / 2);
var s1 = Math.sin(x / 2);
var s2 = Math.sin(y / 2);
var s3 = Math.sin(z / 2);
var x = s1 * c2 * c3 + c1 * s2 * s3;
var y = c1 * s2 * c3 - s1 * c2 * s3;
rostopic pub -r 5 /mavros/setpoint_position/local geometry_msgs/PoseStamped "header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
pose:
position:
x: 0.0
y: 0.0
from mongo import get_db
def is_next_try(session, result):
res = len(session['tries']) == result['tryNumber'] and \
(session['addr'] is None or session['addr'] == result['addr']) and \
not session['tries'][-1].get('last') and \
session['tries'][-1]['spent'] < result['spent']
if not res: return False
for id in session['tries'][-1]['answers']: