Skip to content

Instantly share code, notes, and snippets.

@JasonRBowling
JasonRBowling / gist:16664659910432eea5924e83b5e5785b
Created September 24, 2022 16:21
Wheel Speed Calculations
# Calculate wheel speeds in m/s
#reference https://snapcraft.io/blog/your-first-robot-the-driver-4-5
left_wheel_vel = data.linear.x - ((data.angular.z * wheel_base) / 2.0)
right_wheel_vel = data.linear.x + ((data.angular.z * wheel_base) / 2.0)
# convert the required wheel speeds in m/s into rpms
c = math.pi * wheel_diameter # wheel circumference in meters
right_rpm = int((right_wheel_vel / c) * 60.0 * gear_ratio)
left_rpm = int((left_wheel_vel / c) * 60.0 * gear_ratio)
def buy(self, c, price):
#we are already in the process of a buy, don't submit another
if self.boughtIn == True:
print("Previous buy incomplete.")
return
availableCash = self.getCash()
if availableCash == -1:
print("Got an exception checking for available cash, canceling buy.")
# generate moving averages
for c in self.coinList:
colName = c + "-MA"
self.data[colName] = self.data[c].shift(1).rolling(window=self.movingAverageWindows).mean()
colName = c + "-RSI"
self.data[colName] = talib.RSI(self.data[c].values, timeperiod = self.rsiWindow)
class coin:
purchasedPrice = 0.0
numHeld = 0.0
numBought = 0.0
name = ""
lastBuyOrder = ""
timeBought = ""
def __init__(self, name=""):
print("Creating coin " + name)
#!/usr/bin/env python
rh = {
"username": "",
"password": "",
}
config = {
"statusEmailAddress": "xxxxxxxxxx@vtext.com",
"buyLimit": 0.0075,
echo "Clearing old data..."
rm -rf covid-19-data/
rm us-states.csv
echo "Getting new data..."
git clone https://github.com/nytimes/covid-19-data
echo "Done."
cp covid-19-data/us-states.csv .
echo "Starting..."
import numpy as np
import seaborn as sns
import matplotlib.pylab as plt
import pandas as pd
import csv
import datetime
reader = csv.reader(open('StatePopulations.csv'))
statePopulations = {}