Skip to content

Instantly share code, notes, and snippets.

View sshane's full-sized avatar
🎨
raylibbing

Shane Smiskol sshane

🎨
raylibbing
View GitHub Profile
@sshane
sshane / mssql_to_csv.bash
Created January 27, 2024 05:31 — forked from llimllib/mssql_to_csv.bash
This is a script to convert every table in a Microsoft SQL Server database backup (.bak file) to a .csv file
#!/usr/bin/env bash
# import an MS SQL .bak backup file to an MS SQL database, then export all
# tables to csv. run this script as `import.sh <filename>`. It expects to be
# run in the same directory as the backup file.
# this is only tested on my mac (OS X Catalina). I tried to stick to posix, but
# It will probably require some tweaking for you. I hope it gives a general
# sense of what you need to do at the very least.
from tools.lib.logreader import LogReader, MultiLogIterator
from tools.lib.route import Route
from cereal import messaging
from tqdm import tqdm
import time
from panda.python import uds
from selfdrive.test.openpilotci import get_url
from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
"""Given an ECU address, prints back and forth ISO-TP communication between OP and ECU"""
@sshane
sshane / perceived_loudness.py
Last active March 1, 2023 04:51
A notebook to visualize micd's a-weighting in openpilot
import matplotlib
matplotlib.use('tkagg')
import numpy as np
import scipy
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
from common.filter_simple import FirstOrderFilter
from system.micd import calculate_spl, FILTER_DT
@sshane
sshane / panda-interceptor-test.py
Last active February 4, 2022 07:15
quick and dirty test to see if panda and CS match for gas pressed with interceptor
import random
MIN_INTERCEPTOR_1 = 490
INTERCEPTOR_2_OFFSET = 490
PANDA_THRSLD = 765
CS_THRSLD = 30
# what CANParser does
@sshane
sshane / verify-parser-order.py
Last active February 2, 2022 23:36
verifies can parser maintains passed in order
from opendbc.can.parser import CANParser
from opendbc.can.packer import CANPacker
from opendbc.can.tests.test_packer_parser import can_list_to_can_capnp
import random
import time
signals = [("BRAKE_SWITCH", "POWERTRAIN_DATA"), ("USER_BRAKE", "VSA_STATUS")]
for _ in range(10):
t = time.time()
import os
import matplotlib
import matplotlib.pyplot as plt
from opendbc.can.parser import CANParser, CANDefine
from selfdrive.car.toyota.values import CAR, DBC
from tools.lib.logreader import LogReader
from tools.lib.route import Route
matplotlib.use('Qt5Agg')
from tools.lib.route import Route
from tools.lib.logreader import MultiLogIterator
from opendbc.can.parser import CANParser
import matplotlib.pyplot as plt
import numpy as np
# route = Route("0cf0840158be859e|2021-06-27--23-53-57"), 0, 2 # TOYOTA COROLLA 2017
route = Route("7627c16a16a6f69b|2021-06-15--07-46-30"), 3, 5 # KIA NIRO HYBRID 2018
# route = Route("587c6380f108936f|2021-06-11--16-55-45") # SONATA 2020
from tools.lib.route import Route
from tools.lib.logreader import MultiLogIterator
from opendbc.can.parser import CANParser
import matplotlib.pyplot as plt
import numpy as np
route = Route("163b34548290d096|2021-06-20--14-56-59"), 13, 17 # oddesey, couldn't find torque
# route = Route("0c03141535b94447|2021-06-12--08-57-29"), 3, 6 # honda civic (TODO: absolutely nothing)
# route = Route("e5554665e107572b|2021-06-20--17-11-06") # insight, same here
@sshane
sshane / ttc-simulation.py
Last active June 11, 2021 20:07
Time to Collision Simulator
import time
import numpy as np
import matplotlib.pyplot as plt
MPH_TO_MS = 0.44704
FT_TO_M = 0.3048
def start_simulation(v_ego, a_ego, v_lead, a_lead, x_lead, rate=20, plot=True):
"""