Skip to content

Instantly share code, notes, and snippets.

View Williangalvani's full-sized avatar

Willian Galvani Williangalvani

View GitHub Profile
GNU nano 2.2.6 File: threads.py
import threading
import threadly
import time
def motor():
print "Motor", time.time()
def controle():
import cv2
import numpy as np
# Create image 300x300xrgb
height=480
width=640
image = np.zeros((height,width, 3), np.uint8)
fourcc = cv2.cv.CV_FOURCC(*'XVID')
video = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
@Williangalvani
Williangalvani / udpgpstest.py
Last active December 12, 2018 19:02
usage: ./udpgpstestpy [--noheading] --ip 127.0.0.1 --port 14401
#!/usr/bin/python
import time
import socket
import argparse
from datetime import datetime
import operator
from functools import reduce
from math import floor
@Williangalvani
Williangalvani / instructions.md
Last active January 14, 2019 17:43
Dashware with ArduSub logs

How to use Dashware with ArduSub

Install DashWare

Create CSV file (can be automated on companion)

  • sdlog2_dump.py your_flight_log.bin -e -f your_flight_log.csv -m GPS -m ATT -m NTUN -m CTUN -m MODE -m CURR -m RSSI -m BARO

Make the overlay with DashWare

@Williangalvani
Williangalvani / OceanVault+ArduSub.md
Last active January 11, 2019 16:57
use Etienne's OceanVault Recorder with ArduSub

Install OceanVault Recorder

  • Download and install "BR2 DATA" (A .exe packaged mavproxy)
  • Download and install "OceanVault Recorder"
  • Download "BR2 SDP"

Setup OceanVault Recorder Video

  • Add a "multiudpsink" to gstreamer pipeline pointing to a new port (let's use 5601)
  • Change BR2 SDP PORT to 5601
[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.601
PlayResX: 854
@Williangalvani
Williangalvani / findPing360.py
Last active October 2, 2019 23:11
script to find
#!/usr/bin/env python3
"""
Scan with ./findPing360.py [current IP of the interface to scan]
"""
import socket
import time
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
#!/usr/bin/env python
#simplePingExample.py
from brping import Ping1D
import time
import argparse
from builtins import input
##Parse Command line options
@Williangalvani
Williangalvani / target_depth.py
Last active August 20, 2020 08:09
set target depth ardusub
#!/usr/bin/env python
# Script to set target depth in Ardusub 3.6 beta
# requires this commit: https://github.com/williangalvani/ardupilot/commit/85a41d5771ba9d64e594dcc0856b6a3906767c3f
from pymavlink import mavutil
# There is very likely a builtin in pymavlink for this, but I didn't find it
ALT_HOLD_MODE = 2
@Williangalvani
Williangalvani / rccontrol.py
Created December 2, 2019 19:36
code to demonstrate weird behavior of ArduSub master
#This makes my thrusters go insane!
# Import mavutil
from pymavlink import mavutil
import time
# Create the connection
master = mavutil.mavlink_connection('udpin:0.0.0.0:14551')
# Wait a heartbeat before sending commands
master.wait_heartbeat()