Skip to content

Instantly share code, notes, and snippets.

View yabberyabber's full-sized avatar
🐐

Andrew Nelson yabberyabber

🐐
  • Arista Networks
  • San Luis Obispo, California
  • 02:24 (UTC -07:00)
View GitHub Profile
Motor at /Robot/robot/claw/conveyorMotor:
VoltHours: 1.038782
AmpHours: 3.370920
WattHours: 22.029070
Motor at /Robot/robot/claw/clawMotor:
VoltHours: 0.785695
AmpHours: 0.789711
WattHours: 3.737691
Motor at /Robot/robot/Arm/armMotor:
VoltHours: 0.041092
@yabberyabber
yabberyabber / gist:33d0b93900e07a25ae24f64a511eb530
Created March 21, 2025 01:47
Task sequence for MotorDraw branch
The eventual goal here is to have a gradle task to automatically calcualte power draw for every
motor after every match. The sequence will look like this:
- After a match, the robot comes back into pit
- The pit programmer runs `./gradlew fetch-and-analyze-log`
- That task downlaods the latest match log
- That task scans through the match log and, for every motor, calculates the power draw in watt-hours, amp-hours, and volt-hours
Example output might look like this:
```
Motor draw from match E12
@yabberyabber
yabberyabber / gist:f274cac126206267675908ad5cf2430b
Last active December 21, 2020 19:05
Given the rss feed for a podcast, download it in its entirety.
#!/usr/bin/python3
import os
import sys
import pathlib
import shutil
import tempfile
import urllib.request
import concurrent.futures
class Person( object ):
def __init__( self, name, parent ):
self.name = name
self.children = []
self.parent = parent
if parent:
parent.children.append( self )
banana = Person( "Banana" )
cherry = Person( "Cherry", parent=banana )
@yabberyabber
yabberyabber / wrapping_exceptions.py
Created April 24, 2019 16:59
Python anti-patterns
try:
do_something()
except IndexError:
raise SomeOtherException()
void ObservableDualActionJoystick::TaskPrePeriodic(RobotMode mode) {
uint32_t currBtn = GetAllButtons();
if (m_observer != nullptr) {
int mask = 1, buttonId = 0;
for ( int buttonId = 0; buttonId < 64; buttonId++ ) {
if (m_prevBtn & mask != currBtn & mask) {
m_observer->ObserveDualActionJoystickStateChange(m_port, buttonId, currBtn & mask);
}
mask <<= 1;
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as npfig = plt.figure()
ax = fig.add_subplot(111, projection='3d')anchors
a = [0,57.735,30]
b = [50,-28.868,30]
c = [-50,-28.868,30]O = [0,0,0]X = np.arange(c[0],b[0],1)
Y = np.arange(b[1],a[1],1)def calc_T(a,b,c,o):
A = np.array([[(a[0]-o[0])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[0]-o[0])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[0]-o[0])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[1]-o[1])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[1]-o[1])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[1]-o[1])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[2]-o[2])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[2]-o[2])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[2]-o[2])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)]])
#! /usr/bin/env python3
"""
Simple pomodoro tracker that has been heavily customized to my personal needs.
Each pomodoro will wait for user input before continuing on meaning that
working a little long into your break does not reduce the duration of your
break (the break timer doesn't start until you press enter). When it is time
to move on, pomodoro will present a notification repeatedly using libnotify.
import random
import time
class Item():
def __init__(self, x, y, z, width, height, depth):
self.x = x
self.y = y
self.z = z
self.width = width
self.height = height
import enchant
d = enchant.Dict("en_US")
num_mappings = {
1: [],
2: ['a', 'b', 'c'],
3: ['d', 'e', 'f'],
4: ['g', 'h', 'i'],
5: ['j', 'k', 'l'],