Skip to content

Instantly share code, notes, and snippets.

Robert Lucian Chiriac RobertLucian

View GitHub Profile
@RobertLucian
RobertLucian / gigglebot_lidar_remote.py
Created Apr 8, 2019
Remote Controlled LIDAR-based GiggleBot - Remote Code
View gigglebot_lidar_remote.py
from microbit import sleep, display, button_a, button_b
import ustruct
import radio
import math
radio.on()
rotate_steps = 10
rotate_span = 160 # in degrees
rotate_step = rotate_span / rotate_steps
max_distance = 50 # in centimeters
@RobertLucian
RobertLucian / gigglebot_lidar_robot.py
Created Apr 8, 2019
Remote Controlled LIDAR-based GiggleBot
View gigglebot_lidar_robot.py
from gigglebot import *
from distance_sensor import DistanceSensor
from microbit import sleep
from utime import ticks_us, sleep_us
import ustruct
import radio
# stop the robot if it's already moving
stop()
# enable radio
@RobertLucian
RobertLucian / gigglebot_light_follower.py
Last active Mar 24, 2019
GiggleBot Light Follower w/ Proportional Controller & LPF
View gigglebot_light_follower.py
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
motor_speed = 100
update_rate = 70
setpoint = 0.5
Kp = 65.0
integral = 0.0
@RobertLucian
RobertLucian / gigglebot_tuned_line_follower.py
Last active Mar 24, 2019
GiggleBot PID Line Follower - Tuned w/ NeoPixels
View gigglebot_tuned_line_follower.py
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
import ustruct
# initialize GB neopixels
neo = init()
# timing
update_rate = 50
@RobertLucian
RobertLucian / gigglebot_line_follower_configurator.py
Created Mar 15, 2019
GiggleBot Remote PID Line Follower Tuner (requires the other part) - xjfls23
View gigglebot_line_follower_configurator.py
from microbit import *
from utime import sleep_ms
import radio
import ustruct
# 1st element is the Kp gain
# 2nd element is the Ki gain
# 3rd element is the Kd gain
# 4th element is the trigger_point for motors to lower down the speed (0 -> 1)
# 5th element is the min speed for motors as expressed in percentages (0 -> 1)
@RobertLucian
RobertLucian / gigglebot_line_follower_tuner.py
Last active Mar 24, 2019
GiggleBot PID Line Follower Tuner (requires a remote to tune it) - xjfls23
View gigglebot_line_follower_tuner.py
from microbit import *
from gigglebot import *
from utime import sleep_ms, ticks_us
import radio
import ustruct
# initialize radio and GB neopixels
radio.on()
neo = init()
@RobertLucian
RobertLucian / pid_tuner.py
Last active Feb 28, 2019
PID tuner for the GoPiGo3 and the Line Follower
View pid_tuner.py
from curtsies import Input
from easygopigo3 import EasyGoPiGo3
from di_sensors.easy_line_follower import EasyLineFollower
from threading import Thread, Event
import signal
from time import sleep, time
def drawLogo():
print(" _____ _____ _ _____ ____ ")
@RobertLucian
RobertLucian / construct_call_graph.py
Created Sep 17, 2018
Call graph generator for python scripts (only python 2.x version)
View construct_call_graph.py
#!/usr/bin/env python
'''
generates call graph of given python code file
in dot format input for graphviz.
limitations:
* statically tried to figure out functions calls
* does not understand classes
* algorithm is naive and may not statically find
@RobertLucian
RobertLucian / pppd-creator.sh
Created Aug 29, 2018
pppd basic creator for EC25-E 4G module
View pppd-creator.sh
#!/bin/bash
echo "creating directories"
mkdir -p /etc/chatscripts
mkdir -p /etc/ppp/peers
echo "creating script file : /etc/chatscripts/quectel-chat-connect"
echo "
ABORT \"BUSY\"
@RobertLucian
RobertLucian / test.js
Created Aug 15, 2018
Just an async mapping function in JS
View test.js
const asyncMap = (array, fn, callback) => {
var output = []; output.length = array.length;
var counter = 0
array.forEach((element, index, array) => {
fn(element, (na, number) => {
output[index] = number
counter++
if (output.length == counter) {
You can’t perform that action at this time.