Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
template<bool B, class T, class F>
struct conditional { typedef T type; };
template<class T, class F>
struct conditional<false, T, F> { typedef F type; };
template <typename... Ts>
struct largest_type;
# Mount Mixer (e.g. Gimbal, servo-controlled gimbal, etc...)
# pitch
M: 1
S: 2 1 10000 10000 0 -10000 10000
# roll
M: 1
S: 2 0 10000 10000 0 -10000 10000
#!/usr/bin/env python
import sys, os
from optparse import OptionParser
import time
from datetime import datetime
import calendar
# tell python where to find mavlink so we can import it
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../mavlink'))
# BabyShark VTOL mixer for PX4FMU
# 1-4 (main): Ailerons (Y-cable), A-tail left, Pusher, A-tail right
# 5-8 (main): quad motors
#=============================
Quad motors 1 - 4
-----------------
R: 4x 10000 10000 10000 0
Aileron mixer (roll)
python-dict_to_protobuf:
ubuntu:
bionic:
pip:
packages: [dict_to_protobuf]
focal:
pip:
packages: [dict_to_protobuf]
python-huawei-modem-api-client:
ubuntu:
import rospy
import numpy as np
from mavros_msgs.msg import ActuatorControl
from geometry_msgs.msg import PoseStamped
from tf.transformations import euler_from_quaternion
class Gimbal_test():
def __init__(self,
):
@dayjaby
dayjaby / tmux.md
Created April 25, 2019 07:12 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dayjaby
dayjaby / myrosdep.yaml
Last active April 1, 2019 14:09
My ros dependencies
libqt4:
debian: [libqtcore4]
python-neo4j:
debian:
pip:
packages: [neo4j]
ubuntu:
pip:
packages: [neo4j]
@dayjaby
dayjaby / kalman.py
Created December 3, 2018 12:34
Python+OpenCV Kalman Filter example for positioning
r'''
==================================
Kalman Filter tracking a sine wave
==================================
This example shows how to use the Kalman Filter for state estimation.
In this example, we generate a fake target trajectory using a sine wave.
Instead of observing those positions exactly, we observe the position plus some
random noise. We then use a Kalman Filter to estimate the velocity of the
@dayjaby
dayjaby / move-along-direction.py
Created November 2, 2018 09:15
Move some distance along direction from a geographic coordinate
def distance_in_direction(origin, distance, direction):
lat1, lon1 = origin
lat1 = math.radians(lat1)
lon1 = math.radians(lon1)
r = 6371000.0
lat2 = math.asin(math.sin(lat1)*math.cos(distance/r)+math.cos(lat1)*math.sin(distance/r)*math.cos(math.radians(direction)))
lon2 = lon1 + math.atan2(math.sin(direction)*math.sin(distance/r)*math.cos(lat1), math.cos(distance/r)-math.sin(lat1)*math.sin(lat2))
return math.degrees(lat2), math.degrees(lon2)