WIP: Examine develop branch #9

Closed
Kenwood wants to merge 18 commits from develop into master
19 changed files with 5150 additions and 67 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
# Python # Python
__pycache__ __pycache__
Pipfile
Pipfile.lock
# CAD # CAD
*.stl *.stl

View File

@ -1,7 +1,19 @@
# To install on robot # To install on robot
``` ```
git clone <url> git clone https://kitsunehosting.net/gitea/Kenwood/lewis-crawler /srv/crawler
cd lewis-crawler/crawler_software/raspberry_pi cd /srv/crawler/crawler_software/raspberry_pi
make install? make install
``` ```
# Updating
```
cd /srv/crawler
git pull
```
# Notes
[Uart Stuff](https://www.reddit.com/r/raspberry_pi/comments/833qux/binary_file_tranfer_via_uart/)

5031
crawler_cad/External/Bed_moto.obj vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
crawler_cad/External/bed_Moto.FCStd vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,70 +1,38 @@
### DISCLAIMER # A makefile for building the robot's slave software
### This is an example Makefile and it MUST be configured to suit your needs. # Uses arduino-cli
### For detailed explanations about all the available options, #
### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md # Kitsune Scientific 2021
### PROJECT_DIR # What board to build for and its core
### This is the path to where you have created/cloned your project CORE ?= arduino:avr
PROJECT_DIR = $(shell dirname $(shell pwd)) FQBN ?= arduino:avr:nano:cpu=atmega328old
### ARDMK_DIR # What port to build on
### Path to the Arduino-Makefile directory. ifndef SERIAL_DEV
ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile ifneq (,$(wildcard /dev/ttyUSB0))
SERIAL_DEV = /dev/ttyUSB0
else ifneq (,$(wildcard /dev/ttyACM0))
SERIAL_DEV = /dev/ttyACM0
else
SERIAL_DEV = unknown
endif
endif
### ARDUINO_DIR all: requirements build upload
### Path to the Arduino application and resources directory.
ARDUINO_DIR = /usr/share/arduino
### USER_LIB_PATH build: requirements crawler_slave.ino
### Path to where the your project's libraries are stored. arduino-cli core install $(CORE)
USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
### BOARD_TAG & BOARD_SUB arduino-cli compile -b $(FQBN) crawler_slave
### For Arduino IDE 1.0.x
### Only BOARD_TAG is needed. It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
# BOARD_TAG = mega2560
### For Arduino IDE 1.6.x
### Both BOARD_TAG and BOARD_SUB are needed. They must be set to the board you are currently using. (i.e BOARD_TAG = uno, mega, etc. & BOARD_SUB = atmega2560, etc.)
### Note: for the Arduino Uno, only BOARD_TAG is mandatory and BOARD_SUB can be equal to anything
BOARD_TAG = mega
BOARD_SUB = atmega2560
### MONITOR_PORT upload: requirements crawler_slave.ino
### The port your board is connected to. Using an '*' tries all the ports and finds the right one. Choose one of the two. arduino-cli upload -b $(FQBN) crawler_slave -p $(SERIAL_DEV)
MONITOR_PORT = /dev/ttyUSB*
# MONITOR_PORT = /dev/ttyACM*
### MONITOR_BAUDRATE requirements:
### It must be set to Serial baudrate value you are using. @if [ -e requirements.txt ]; \
MONITOR_BAUDRATE = 115200 then while read -r i ; do echo ; \
echo "---> Installing " '"'$$i'"' ; \
### AVR_TOOLS_DIR arduino-cli lib install "$$i" ; \
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc. done < requirements.txt ; \
AVR_TOOLS_DIR = /usr else echo "---> MISSING requirements.txt file"; \
fi
### AVRDUDE
### Path to avrdude directory.
AVRDUDE = /usr/bin/avrdude
### CFLAGS_STD
CFLAGS_STD = -std=gnu11
### CXXFLAGS_STD
### You can choose wich ever you like
# CXXFLAGS_STD = -std=gnu++11
CXXFLAGS_STD = -std=gnu++17
### CPPFLAGS
### Flags you might want to set for debugging purpose. Comment to stop.
CXXFLAGS += -pedantic -Wall -Wextra
LDFLAGS += -fdiagnostics-color
### OBJDIR
### Don't touch this!
### This is were you put the binaries you just compile using 'make'
CURRENT_DIR = $(shell basename $(CURDIR))
OBJDIR = $(PROJECT_DIR)/build/$(CURRENT_DIR)/$(BOARD_TAG)
### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
include $(ARDMK_DIR)/Arduino.mk

View File

@ -51,7 +51,9 @@ void receiveEvent(int n) {
switch(id) { switch(id) {
case 1: case 1:
windowWiperServo.write(val); windowWiperServo.write(val); // Set a val
delay(5); // pause for a moment
windowWiperServo.detach(); // Detach (stop moving) the servo
break; break;
} }
} }

View File

@ -0,0 +1 @@
Servo

View File

@ -0,0 +1,18 @@
# A makefile for installing the robot's python
# software and setting it up.
#
# Requires sudo
#
# Kitsune Scientific 2021
all: install
upload: crawler.service
sudo cp crawler.service /etc/systemd/system/crawler.service
sudo systemctl daemon-reload
sudo systemctl enable crawler.service
sudo systemctl start crawler.service
sudo systemctl status crawler

View File

@ -0,0 +1,16 @@
from PIL import Image
import base64
im = Image.open('still.jpg')
# using Image.ADAPTIVE to avoid dithering
for i in range(8, 0, -1):
out = im.convert('P', palette=Image.ADAPTIVE, colors=i)
out.save(f'out_{i}_bits.png')
with open(f'out_{i}_bits.png', 'rb') as image_file:
encoded_string = base64.a85encode(image_file.read())
with open(f'out_{i}_bits.txt', 'w') as f:
f.write(encoded_string.decode('UTF-8'))

View File

@ -0,0 +1 @@
M,6r;%14!\!!!!.8Ou6I!!!)I!!!&X#Qk&,!4s2MScA`m!)Q?g7AGd(zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz!.5pZZiC(+%V8a6Akbu".KBGK#QOi)zdSl>0!!-\'6pXdsSF+-I!<<*"_P$QtD$r"izzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz!!!"D(e?.W!V_LqE<#t=!(fUS7'8jaJc

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,25 @@
from random import randrange
import time, pyotp, datetime
hotp = pyotp.HOTP(pyotp.random_base32())
success = 0
num_tries = 20
for i in range(0,num_tries):
epoch = int(time.time())
code = hotp.at(epoch)
print('------------------------')
print(f'Made a code {code} at {epoch}, sending a simualted instruction')
waittime = randrange(5)
print(f'Instuction will take {waittime} seconds to receive or be recieved')
time.sleep(waittime)
if hotp.verify(code, epoch):
print(f'code:{code} verified')
success += 1
else:
print(f'code:{code} expired')
print(f'Succeded {success} out of {num_tries} tries')