Skip to content

Instantly share code, notes, and snippets.

@okalachev
okalachev / gist:3374004
Created August 16, 2012 22:02
pull or clone a repository
$(REPO_NAME)/:
test -d $(REPO_NAME) && (cd $(REPO_NAME); git pull) || git clone $(REPO_URL)
@okalachev
okalachev / gist:3378510
Created August 17, 2012 12:45
Find largest files
find . -printf '%s %p\n'|sort -nr|head
@okalachev
okalachev / hyper-replace
Created October 27, 2012 19:25
Script, that replaces a string in a directory (files/directories names & files content)
#!/bin/bash
# Script, that replaces a string in a directory (files/directories names & files content)
# Usage: hyper-replace what to
what=$1
to=$2
for file in `find * -depth`
do
@okalachev
okalachev / gist:5246537
Created March 26, 2013 15:53
Print every SQL query in Django Shell
import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())
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']:
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
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;

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

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

Это есть:

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

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

#!/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

MAVLink Switch

Configuration

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

Endpoints