Skip to content

Instantly share code, notes, and snippets.

View theol0403's full-sized avatar
💻

Theo Lemay theol0403

💻
View GitHub Profile
@theol0403
theol0403 / FlywheelImplementation.cpp
Last active August 20, 2019 07:36
7842F Flywheel Control System
#include "main.h"
#include "pidVelSystem.hpp"
Motor flywheel(1);
double flywheelRatio = 15;
velPID pid(0.35, 0.05, 0.045, 0.9);
emaFilter rpmFilter(0.15);
double motorSlew = 0.7;
double targetRPM = 0;
@theol0403
theol0403 / JREPL.BAT
Created August 17, 2019 23:17
Vision Sensor signature conversion script
@if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment
@goto :Batch
::JREPL.BAT by Dave Benham
::/History
::
:: 2018-10-20 v7.15: Add a string literal syntax to the /INC and /EXC options.
:: 2018-10-15 v7.14: Bug fix - User defined variables declared in /JBEG named
:: str and/or obj were getting clobbered.
:: Bug fix - Internal variable xbytes was visibile to user
@theol0403
theol0403 / 7842FMain.cpp
Last active August 20, 2019 21:49
7842F Merged Competition Template
#include "main.h"
static bool isCompetition = false; //will be toggled when autonomous is run
/***
* _____ _ _ _ _ _
* |_ _| (_) | (_) | (_)
* | | _ __ _| |_ _ __ _| |_ _______
* | || '_ \| | __| |/ _` | | |_ / _ \
* _| || | | | | |_| | (_| | | |/ / __/
@theol0403
theol0403 / Graph.cpp
Last active June 14, 2019 03:12
LVGL Builder Example
#include "Graph.hpp"
Graph::Graph(lv_obj_t* parent) : Graph(parent, lv_obj_get_style(parent)->body.main_color) {}
Graph::Graph(lv_obj_t* parent, lv_color_t mainColor) :
graph(lv_chart_create(parent, NULL))
{
lv_obj_set_size(graph, lv_obj_get_width(parent), lv_obj_get_height(parent));
lv_obj_align(graph, NULL, LV_ALIGN_CENTER, 0, 0);
lv_chart_set_type(graph, LV_CHART_TYPE_LINE);
@theol0403
theol0403 / translateDirectory.sh
Last active February 4, 2019 16:26
Bash C Translator Script
shopt -s nullglob
TRANSLATEFILE=./TRANSLATE_ME.txt
for dir in $1 $2 $3 $4 $5
do
for file in `find $dir -type f -name "*.cpp" -o -name "*.hpp"`;
do
[ -f "$file" ] || break
echo "Translating \"$file\""
@theol0403
theol0403 / AutoHybridFunctions.c
Last active December 13, 2018 18:16
Async Auto System for RobotC
void AutoBaseWaitUntilComplete(int maxTime = 5000)
{
wait1Msec(AutoDriveBase.loopRate * 2);
int emergencyCount = 0;
while(!AutoDriveBase.isCompleted && emergencyCount < abs(maxTime))
{
emergencyCount += AutoDriveBase.loopRate;
@theol0403
theol0403 / WaitUntilDistance.c
Created December 13, 2018 16:24
WaitUntilDistance for RobotC AutonSystem
void AutoBaseWaitUntilTickCrossed(int wantedLeft, int wantedRight, int maxTime = 5000)
{
wait1Msec(AutoDriveBase.loopRate * 2);
bool leftDirection = (SensorValue[AutoDriveBase.leftEn] < wantedLeft);
bool rightDirection = (SensorValue[AutoDriveBase.leftEn] < wantedRight);
bool isLeftCompleted = false;
bool isRightCompleted = false;
bool isCompleted = false;