Skip to content

Instantly share code, notes, and snippets.

View dmalawey's full-sized avatar
💭
performing kaizen

David dmalawey

💭
performing kaizen
View GitHub Profile
@dmalawey
dmalawey / findValidScanPoints.py
Created November 10, 2019 01:03
reconditioning of lidar readings and practice with numPy
# the Lidar returns some error values when it can't get a measurement.
# any value below 16mm indicates a bad reading or other problem.
# this code is practice for trimming the bad readings out of the array
# containing distances & angles.
import numpy as np
np.set_printoptions(suppress=True)
# create an array with some distances which returned invalid (ie 0, 0.002)
scan= np.array([ \
@dmalawey
dmalawey / copy_of_button.py
Created November 19, 2019 22:21
direct copy of button.py on the beaglebone blue image.
#!/usr/bin/env python
# Reads the PAUSE button using interupts and sets the LED
# Pin table at https://github.com/beagleboard/beaglebone-blue/blob/master/BeagleBone_Blue_Pin_Table.csv
# Import PyBBIO library:
import Adafruit_BBIO.GPIO as GPIO
import time
button="P8_9" # PAUSE=P8_9, MODE=P8_10
LED ="USR3"
@dmalawey
dmalawey / .asoundrc
Created November 22, 2019 19:13
alsamixer configuration file for home directory on beaglebone
pcm.!default {
type plug
slave {
pcm "hw:1,0"
}
}
ctl.!default {
type hw
card 1
}
@dmalawey
dmalawey / adafruit_pwm_scuttle.py
Last active November 26, 2019 23:26
remo mods for Scuttle Robot
# This is the SCUTTLE replacement for the adafruit_pwm.py file
# Use this program to overwrite the original adafruit_pwm.py contents.
def setup(robot_config): # setup is a required function for the selected hardware program
return
# A function for sending command to a file in the temporary folder
def tmpFile(value): # this function takes a 2-element array called val
txt = open("/tmp/commandFile.txt",'w+') # file with specified name
txt.write(str(value))
@dmalawey
dmalawey / L2_displacement.py
Last active May 28, 2020 02:03
code for continuous counting of scuttle displacement
# l2_displacement.py
# This program takes the encoder values from encoders, computes wheel movement
# calculates the chassis displacement and continuously adds up the displacement
# to indicate how much the robot has advanced, in meters.
import L1_encoder as enc # local library for encoders
import numpy as np # library for math operations
import time # library for time access
@dmalawey
dmalawey / robot_DM.PY
Last active June 26, 2020 00:18
change driving method to curve towards each waypoint. code in progress for robot.py
import time
import math
import logging
import numpy as np
from scuttlepy import gpio
from scuttlepy import wheels
from scuttlepy import mpu
# Create and configure logger
logging.basicConfig(filename="robotTest.log", format='%(asctime)s %(message)s', filemode='w')
@dmalawey
dmalawey / flow_mqtt_csv_2
Last active September 4, 2020 02:29
nodered receive mqtt message and save in csv
[{"id":"22de6241.99d99e","type":"tab","label":"ReceiveMQTT","disabled":false,"info":""},{"id":"fa9bfea5.972ee","type":"mqtt in","z":"22de6241.99d99e","name":"","topic":"SCUTTLE/pi/cmd","qos":"2","datatype":"auto","broker":"1cc0cc73.690154","x":120,"y":80,"wires":[["721e0737.c93978","8d8ca943.671f88"]]},{"id":"721e0737.c93978","type":"csv","z":"22de6241.99d99e","name":"","sep":",","hdrin":false,"hdrout":"all","multi":"one","ret":"\\n","temp":"fieldA, fieldB","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":180,"y":180,"wires":[["cc5a197f.041b88","5895d1cf.f5221"]]},{"id":"cc5a197f.041b88","type":"file","z":"22de6241.99d99e","name":"","filename":"/home/pi/piScuttle/data3.csv","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":350,"y":240,"wires":[[]]},{"id":"5895d1cf.f5221","type":"debug","z":"22de6241.99d99e","name":"debug3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","sta
@dmalawey
dmalawey / flow_mqtt_csv_1
Created September 3, 2020 06:45
nodered flow for retrieving csv info and sending mqtt message
[{"id":"22de6241.99d99e","type":"tab","label":"GamePad","disabled":false,"info":""},{"id":"3f6df30c.f1a0bc","type":"csv","z":"22de6241.99d99e","name":"","sep":"\\t","hdrin":true,"hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":370,"y":280,"wires":[["51721a8b.c03934","6003e56b.07b51c"]]},{"id":"d4cc4cd7.6b652","type":"file in","z":"22de6241.99d99e","name":"","filename":"/home/pi/piScuttle/data2.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":260,"y":200,"wires":[["3f6df30c.f1a0bc"]]},{"id":"ab78c8b0.7a8e18","type":"inject","z":"22de6241.99d99e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":120,"wires":[["d4cc4cd7.6b652"]]},{"id":"51721a8b.c03934","type":"mqtt out","z":"22de6241.99d99e","name":"","topic":"SCUTTLE/pi/gp2","qos":"2","retain":"","broker":"1cc0cc73.690154","x":470,
@dmalawey
dmalawey / flow_gamepad_axis_plot
Last active September 6, 2020 14:30
nodered flow for plotting single axis of gamepad on SCUTTLE Robot
[{"id":"4a052b50.075214","type":"tab","label":"PlotGP","disabled":false,"info":""},{"id":"dc90d6ca.9573c8","type":"ui_chart","z":"4a052b50.075214","name":"GamePad axis0 Chart","group":"341ef7b5.bb9218","order":6,"width":0,"height":0,"label":"Gamepad Axis0 Chart","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"Waiting for Data...","dot":false,"ymin":"-100","ymax":"100","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":240,"y":260,"wires":[[]]},{"id":"350633a1.11bc9c","type":"ui_gauge","z":"4a052b50.075214","name":"","group":"341ef7b5.bb9218","order":1,"width":0,"height":0,"gtype":"gage","title":"Gamepad Axis0 Value","label":"percent","format":"{{value}}","min":"-100","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":240,"y":220,"wires":[]},{"id":"1cbd
@dmalawey
dmalawey / vscode_config_SFTP.json
Created September 9, 2020 06:38
vscode configuration for pi SFTP over wifi
{
"name": "SCUTTLE",
"host": "192.168.1.8",
"protocol": "sftp",
"port": 22,
"username": "pi",
"password": "raspberry"
"remotePath": "/home",
"uploadOnSave": true
}