Skip to content

Instantly share code, notes, and snippets.

import math
from pymavlink import mavutil
class mission_item:
def __init__(self, l, current, x,y,z):
self.seq = l
self.frame = mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT
self.command = mavutil.mavlink.MAV_CMD_NAV_WAYPOINT
self.current = current
import serial
import time
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='channel')
parser.add_argument('-r', "--reset", type=int, default=0, help='reset throttle value')
import pygame
import serial
import argparse
parser = argparse.ArgumentParser(description='channel')
parser.add_argument('-t', "--throttle", type=int, default=0, help='throttle value')
args = parser.parse_args()
import serial
import time
import numpy as np
stick2 = serial.Serial("COM7", 9600)
stick1 = serial.Serial("COM9", 9600)
import serial
import time
stick1 = serial.Serial("COM7", 9600)
stick2 = serial.Serial("COM9", 9600)
# directions
#include <HardwareSerial.h>
// Configure DAC pins
const int DAC1_PIN = 25;
const int DAC2_PIN = 26;
// Set voltage range
const float VOLT_RANGE = 3.3;
void setup() {
from machine import Pin, ADC, DAC
# set up ADC and DAC pins
dac = DAC(Pin(25))
# define function to convert input value to voltage
def convert_to_voltage(input_value):
voltage = (input_value / 255) * 3.3
return voltage
import internetarchive as ia
# Create a session and search for items with CC BY-NC-SA 4.0 license
session = ia.search_items('licenseurl:"http://creativecommons.org/licenses/by-nc-sa/4.0/"')
# Print the number of items found
print(f'Found {session.num_found} items with CC BY-NC-SA 4.0 license.')
# Define fields to be retrieved for each item
fields = ["identifier", "title", "collection", "downloads", "description", "date"]
from time import sleep
import os
import subprocess
import socket
from threading import Thread
ffmpegProcessId = 1000000
controlCenterIPAddress = "192.168.0.158"
import numpy as np
import cv2
from cv2 import aruco
from time import sleep
import keyPressModule as kp
from djitellopy import tello
import serial
import time