Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import cv2
import sys
import os, os.path
import fnmatch
import shutil
print 'Directory is: ', str(sys.argv[1])
basedir = str(sys.argv[1])
numfiles = len(fnmatch.filter(os.listdir(basedir),'*.jpg'))
{"latitude_scalar":111111.0,"longitude_scalar":87603.6779423753,"latitude":-37.960604,"waypoints":[[88.5673184002,349.5552059993],[184.8437604598,140.9998589993],[51.1605479187,134.5554209998],[-39.772069785,365.55519],[105.9128466338,369.8885189993],[162.066804195,159.9998399995],[53.7886582578,92.2221299993],[-57.1175980161,336.3329969995],[25.7554813173,344.4440999996]],"roads":[],"geofence":{"outer":[
[149.1891,79.6666],
[233.8142,111.8888],
[287.2525,39.2222]
],"nfzs":[]},"longitude":145.237026}
#define PI 3.14159265
#define LATBASE 51.0f
#define LONBASE 0.0f
#define EARTH_RAD 6378137
void calculateGPS(int32_t *lati, int32_t *loni, float x, float y)
{
float dn = -y;
float de = -x;
@JMare
JMare / build_cmav_sim.sh
Created March 26, 2018 00:31
Cmavnode Simulation setup
#!/bin/bash
# Script to set up netem and tbf to emulate a real world MAVLink network
# with inspiration from https://gist.github.com/keturn/541339
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
DEV=lo
@JMare
JMare / test.cpp
Created March 14, 2018 08:11
Chess detector
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
@JMare
JMare / qpwp
Created February 9, 2018 05:49
QGC WPL 110
0 0 0 16 0.000000 0.000000 0.000000 0.000000 -37.908981 145.133896 133.559998 1
1 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.956970 145.237213 70.000000 1
2 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.957253 145.237854 70.000000 1
3 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.958946 145.238678 70.000000 1
4 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.958984 145.238495 70.000000 1
5 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.957279 145.237610 70.000000 1
6 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.957329 145.237320 70.000000 1
7 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.959026 145.238251 70.000000 1
8 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.959072 145.237946 70.000000 1
QGC WPL 110
0 0 0 16 0.000000 0.000000 0.000000 0.000000 -37.958782 145.238510 39.820000 1
1 0 3 84 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 40.000000 1
2 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.960003 145.239227 55.160000 1
3 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.960960 145.239502 74.860001 1
4 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.961193 145.237503 79.510002 1
5 0 3 19 60.000000 0.000000 1.000000 0.000000 -37.960209 145.236511 79.430000 1
6 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.958836 145.235764 78.250000 1
7 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.957165 145.235382 74.690002 1
8 0 3 16 0.000000 0.000000 0.000000 0.000000 -37.956978 145.237656 60.000000 1
@JMare
JMare / mavros error
Created September 24, 2017 05:38
mavros segfault
mavros_node: /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:109: Eigen::internal:
:plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = double; int
Size = 4; int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(eigen
_unaligned_array_assert_workaround_gcc47(array)) & (15)) == 0 && "this assertion is
explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAs
sert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
================================================================================REQU
IRED process [mavros-6] has died!
process has died [pid 13633, exit code -6, cmd /home/avionics/catkin_ws/devel/lib/ma
vros/mavros_node __name:=mavros __log:=/home/avionics/.ros/log/af4484dc-a0e9-11e7-87
@JMare
JMare / node.launch
Created July 27, 2017 04:04
Change mavros system id
<launch>
<!-- vim: set ft=xml noet : -->
<!-- base node launch file-->
<arg name="system_id" />
<arg name="fcu_url" />
<arg name="gcs_url" />
<arg name="tgt_system" />
<arg name="tgt_component" />
<arg name="pluginlists_yaml" />
# apt update
# apt upgrade
# apt install qtcreator cmake make lvtk-dev libpcl1-dev git vim qt4-default vtk6
$ git clone https://github.com/PointCloudLibrary/pcl
$ cd pcl/doc/tutorials/content/sources/qt_visualizer/
$ mkdir build && cd build
$ cmake ..
$ make