Skip to content

Instantly share code, notes, and snippets.

View stmobo's full-sized avatar

Sebastian Mobo stmobo

View GitHub Profile
@stmobo
stmobo / countdown.py
Last active March 11, 2016 14:15
Simple Tkinter countdown program
#!/usr/bin/python3
import tkinter as tk;
import datetime
competitionDay = datetime.date(year = 2016, month = 3, day = 11)
competitionTimes = [
datetime.time(hour = 9, minute = 00, second = 0),
datetime.time(hour = 10, minute = 51, second = 0),
datetime.time(hour = 11, minute = 50, second = 0),
struct pidControlState {
/* Controller parameters */
float kp;
float ti;
float td;
/* Loop parameter */
float setpoint;
float output;
@stmobo
stmobo / grid_test.js
Last active February 10, 2023 14:18
Occupancy Grid Mapping (in JS)
var canvas_actual = document.getElementById('canvas_actual');
var canvas_occ = document.getElementById('canvas_occupancy');
var ctx_actual = canvas_actual.getContext('2d');
var ctx_occ = canvas_occ.getContext('2d');
var map_scale = 10; // cm per grid square side
var beam_dist_grid = 400; // 400 grid squares long
var beam_dist_actual = beam_dist_grid * map_scale; // ... in cm
var base_point = {x:300, y:300}
@stmobo
stmobo / ArkRoyal.c
Last active November 17, 2017 22:40
3631Z Replay-ized
struct controlState {
signed char leftDrive; /* Raw Ch3 from stick */
signed char rightDrive; /* Raw Ch2 from stick */
bool linSysUp; /* Button 7U */
bool linSysDown; /* Button 7D */
bool armUp; /* Button 6U */
bool armDown; /* Button 6D */
import math
import numpy as np
import tensorflow as tf
import keras
import keras.backend as K
from keras.models import Sequential
from keras.initializers import lecun_normal
from keras.layers import Dense, AlphaDropout
import gym
@stmobo
stmobo / rplidar.py
Last active December 4, 2022 13:44
RPLIDAR python driver
import math
def print_response_data(data):
for frame in range(0, len(data), 8):
s = ''
for b in data[frame:frame+8]:
s += '{:02x} '.format(b)
print('{:02x}: {}'.format(frame, s))
# Commands that can be sent to RPLIDARs.
@stmobo
stmobo / robotc_uart.c
Created February 15, 2018 21:26
Experimental UART-based remote control code
#pragma config(Sensor, dgtl1, quad1, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, quad2, sensorQuadEncoder)
#pragma config(Motor, port2, m1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, m2, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
signed char readUART(TUARTs port) {
signed char val;
while((val = getChar(port)) == -1) {
sleep(1);
import pygame
import numpy as np
import math
import sys
import random
pygame.init()
bullets = pygame.sprite.Group()
player_group = pygame.sprite.Group()
@stmobo
stmobo / uartDrive.c
Last active February 28, 2018 23:05
#pragma config(UART_Usage, UART1, uartUserControl, baudRate9600, IOPins, None, None)
#pragma config(UART_Usage, UART2, uartUserControl, baudRate9600, IOPins, None, None)
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1, enc1, sensorQuadEncoderOnI2CPort, , AutoAssign )
#pragma config(Sensor, I2C_2, enc2, sensorQuadEncoderOnI2CPort, , AutoAssign )
#pragma config(Motor, port1, motor2, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port10, motor1, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
short waitForChar(short port) {
@stmobo
stmobo / how_to_port_kkl.txt
Created September 27, 2018 07:12
Tips on porting KisekaeLocal using JPEXS and the AIRSDK.
For future reference, this is how I updated KKL using the previous KKL version (v68) and the latest Kisekae from online:
- Grab k_kisekae2.swf and all of the other swfs loaded by it first. Each file you'll need to grab corresponds to an entry in Main.loadName or Main.loadItemName within k_kisekae2.swf.
(All of the subordinate swf files can be found under http://pochi.lix.jp/k_kisekae2_swf/ -- you can simply wget them or similar. They'll go into a local k_kisekae2_swf directory.)
- Take a copy of the previous KKL version and replace its version of k_kisekae2.swf with the latest version, then open it and kkl.swf up in JPEXS.
- Start by updating Main.version, Main.loadName, and Main.loadItemName in kkl.swf to match k_kisekae2.swf.
(This should just involve simple copy-pasting of P-code from k_kisekae2.swf to kkl.swf.)
- From there, it's a cycle of: attempt to run KKL > see what causes errors > fix said errors > repeat
- The AIRSDK includes a tool called `adl`. It'll allow you to run KKL in debugging