Compare commits
9 Commits
crawler-so
...
598e84603f
| Author | SHA1 | Date | |
|---|---|---|---|
| 598e84603f | |||
| 3c0ecdd98c | |||
| 041bde458c | |||
| 218626d316 | |||
| f9a47e8891 | |||
| e414f63425 | |||
| 513fe74228 | |||
| 1e98970dc3 | |||
| d13b74ed47 |
Binary file not shown.
Binary file not shown.
BIN
CAD/MastCam/MastCamRear.FCStd
Normal file
BIN
CAD/MastCam/MastCamRear.FCStd
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
# To install on robot
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone <url>
|
|
||||||
cd lewis-crawler/crawler_software/raspberry_pi
|
|
||||||
make install?
|
|
||||||
```
|
|
||||||
23
companion_software/BasicBot.py
Normal file
23
companion_software/BasicBot.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from discord_webhook import DiscordWebhook
|
||||||
|
from picamera import PiCamera
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
def get_uptime():
|
||||||
|
with open('/proc/uptime', 'r') as f:
|
||||||
|
uptime_seconds = float(f.readline().split()[0])
|
||||||
|
|
||||||
|
return uptime_seconds
|
||||||
|
|
||||||
|
webhookURL = "https://discord.com/api/webhooks/856609966404534272/TR9tnLq2sIGZoOeADNswmGRNlzBcqM5aKihfU6snVTP9WhSSoVVvi7nT6i-ZfZS7Hcqm"
|
||||||
|
|
||||||
|
webhook = DiscordWebhook(url=webhookURL, content="Uptime: " + str( round( ((get_uptime() / 60) / 60 ), 2 )) + " hours")
|
||||||
|
|
||||||
|
camera = PiCamera()
|
||||||
|
sleep(3) # let iso settle out
|
||||||
|
camera.capture('still.jpg')
|
||||||
|
|
||||||
|
with open("still.jpg", "rb") as f:
|
||||||
|
webhook.add_file(file=f.read(), filename='still.jpg')
|
||||||
|
response = webhook.execute() # Hit send
|
||||||
|
|
||||||
38
crawler_software/arduino/crawler_slave/Makefile
Normal file
38
crawler_software/arduino/crawler_slave/Makefile
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# A makefile for building the robot's slave software
|
||||||
|
# Uses arduino-cli
|
||||||
|
#
|
||||||
|
# Kitsune Scientific 2021
|
||||||
|
|
||||||
|
# What board to build for and its core
|
||||||
|
CORE ?= arduino:avr
|
||||||
|
FQBN ?= arduino:avr:nano
|
||||||
|
|
||||||
|
# What port to build on
|
||||||
|
ifndef SERIAL_DEV
|
||||||
|
ifneq (,$(wildcard /dev/ttyUSB0))
|
||||||
|
SERIAL_DEV = /dev/ttyUSB0
|
||||||
|
else ifneq (,$(wildcard /dev/ttyACM0))
|
||||||
|
SERIAL_DEV = /dev/ttyACM0
|
||||||
|
else
|
||||||
|
SERIAL_DEV = unknown
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: requirements build upload
|
||||||
|
|
||||||
|
build: crawler_slave.ino
|
||||||
|
arduino-cli core install $(CORE)
|
||||||
|
|
||||||
|
arduino-cli compile -b $(FQBN) crawler_slave
|
||||||
|
|
||||||
|
upload:
|
||||||
|
echo "Would install to $(SERIAL_DEV)"
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
@if [ -e requirements.txt ]; \
|
||||||
|
then while read -r i ; do echo ; \
|
||||||
|
echo "---> Installing " '"'$$i'"' ; \
|
||||||
|
arduino-cli lib install "$$i" ; \
|
||||||
|
done < requirements.txt ; \
|
||||||
|
else echo "---> MISSING requirements.txt file"; \
|
||||||
|
fi
|
||||||
@@ -10,28 +10,16 @@
|
|||||||
// This servo is used to wipe and clean the camera lens
|
// This servo is used to wipe and clean the camera lens
|
||||||
Servo windowWiperServo;
|
Servo windowWiperServo;
|
||||||
|
|
||||||
// Variables populated over i2c from master
|
|
||||||
int id;
|
|
||||||
int val;
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// For debugging
|
|
||||||
//Serial.begin(115200);
|
|
||||||
|
|
||||||
// Attach the wiper servo to pin 9
|
// Attach the wiper servo to pin 9
|
||||||
windowWiperServo.attach(9);
|
windowWiperServo.attach(9);
|
||||||
|
|
||||||
// This is the address the pi will speak to us at
|
// This is the address the pi will speak to us at
|
||||||
Wire.begin(0x4);
|
Wire.begin(0x8);
|
||||||
|
|
||||||
// Call receiveEvent when data received
|
// Call receiveEvent when data received
|
||||||
Wire.onReceive(receiveEvent);
|
Wire.onReceive(receiveEvent);
|
||||||
|
|
||||||
// Setup LED
|
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
|
||||||
digitalWrite(LED_BUILTIN, LOW);
|
|
||||||
|
|
||||||
//Serial.println("Started");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just loop to keep the running code alive, and wait for events to happen.
|
// Just loop to keep the running code alive, and wait for events to happen.
|
||||||
@@ -40,24 +28,9 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method runs when we receive a message
|
// This method runs when we receive a message
|
||||||
void receiveEvent(int n) {
|
void receiveEvent(int howMany) {
|
||||||
Wire.read(); // Remove smbus trash
|
while (Wire.available()) { // loop through all but the last
|
||||||
if (true) { // Dont do anything if this is not true
|
int pos = Wire.read(); // receive byte as a int
|
||||||
id = Wire.read(); // ID of the servo/device to access
|
windowWiperServo.write(pos);
|
||||||
val = Wire.read(); // Value to assign
|
|
||||||
|
|
||||||
//Serial.println(id);
|
|
||||||
//Serial.println(val);
|
|
||||||
|
|
||||||
switch(id) {
|
|
||||||
case 1:
|
|
||||||
windowWiperServo.write(val);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevents a bug where if bytes are left in buffer, arduino crashes.
|
|
||||||
while (Wire.available()) {
|
|
||||||
Wire.read();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
crawler_software/arduino/crawler_slave/requirements.txt
Normal file
1
crawler_software/arduino/crawler_slave/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Servo
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Crawler service overseer, manages running main crawler software
|
|
||||||
After=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Restart=always
|
|
||||||
ExecStart=/usr/bin/python /srv/crawler/crawler.py
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
PySSTV
|
PySSTV
|
||||||
picamera
|
picamera
|
||||||
@@ -5,30 +5,18 @@ from gps import *
|
|||||||
from smbus import SMBus
|
from smbus import SMBus
|
||||||
import time
|
import time
|
||||||
|
|
||||||
addr = 0x4 # bus address
|
addr = 0x8 # bus address
|
||||||
bus = SMBus(1) # indicates /dev/ic2-1
|
bus = SMBus(1) # indicates /dev/ic2-1
|
||||||
|
|
||||||
numb = 1
|
numb = 1
|
||||||
|
|
||||||
def writeData(value):
|
|
||||||
byteValue = StringToBytes(value)
|
|
||||||
bus.write_i2c_block_data(addr,0x00,byteValue) #first byte is 0=command byte.. just is.
|
|
||||||
return -1
|
|
||||||
|
|
||||||
|
|
||||||
def StringToBytes(val):
|
|
||||||
retVal = []
|
|
||||||
for c in val:
|
|
||||||
retVal.append(ord(c))
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for _x in range (0, 2):
|
for _x in range (0, 2):
|
||||||
for i in range(78, 130):
|
for i in range(70, 130):
|
||||||
writeData("WIPE-" + str(i))
|
bus.write_byte(addr, i)
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
for i in range(130, 78, -1):
|
for i in range(130, 70, -1):
|
||||||
writeData("WIPE-" + str(i))
|
bus.write_byte(addr, i)
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
except OSError:
|
except OSError:
|
||||||
print("Could not speak to ardujmemo")
|
print("Could not speak to ardujmemo")
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import smbus
|
|
||||||
import time
|
|
||||||
import struct
|
|
||||||
|
|
||||||
# for RPI version 1, use bus = smbus.SMBus(0)
|
|
||||||
bus = smbus.SMBus(1)
|
|
||||||
|
|
||||||
# This is the address we setup in the Arduino Program
|
|
||||||
address = 0x04
|
|
||||||
|
|
||||||
try:
|
|
||||||
for _x in range (0, 2):
|
|
||||||
for i in range(78, 130):
|
|
||||||
bus.write_i2c_block_data(address, 0, [1, i])
|
|
||||||
time.sleep(0.02)
|
|
||||||
for i in range(130, 78, -1):
|
|
||||||
bus.write_i2c_block_data(address, 0, [1, i])
|
|
||||||
time.sleep(0.02)
|
|
||||||
except OSError:
|
|
||||||
print("Could not speak to ardujmemo")
|
|
||||||
Reference in New Issue
Block a user