Compare commits
74 Commits
b84b05e475
...
ffmpeg-pip
| Author | SHA1 | Date | |
|---|---|---|---|
| 1968799404 | |||
| 0bc1af6c3a | |||
| 608af373e6 | |||
| 282f929d70 | |||
| 3403d3e494 | |||
| ec174ae445 | |||
| 05015113f9 | |||
| 000385da79 | |||
| 76837ded9b | |||
| ea5978f4e4 | |||
| 942809c95a | |||
| c2695e1971 | |||
| af4c8f978b | |||
| 046c1f7846 | |||
| 6fbb53b6bd | |||
| f6bb087799 | |||
| 21330c945d | |||
| b5ba5f6f9e | |||
| 32bd0f5b55 | |||
| 13eb27b9c3 | |||
| f34cb81c7a | |||
| 209e15d41f | |||
| de214dfc6b | |||
| 8f7e12ec90 | |||
| 03564ed485 | |||
| 19acde6d43 | |||
| d2f85f6aad | |||
| 6f1e5af90f | |||
| 2ee6bbef90 | |||
| 941b5ac4e8 | |||
| 779127ff73 | |||
| 9e58b2b1af | |||
| 227815ac32 | |||
| 83a33cc202 | |||
| aa575f67a3 | |||
| b902f8a500 | |||
| f38f1ab8ba | |||
| e092a570d1 | |||
| 67daffd667 | |||
| acc5bffb71 | |||
| c0b5d40653 | |||
| db52dbff47 | |||
| 6a74fcb472 | |||
| e8dd3c3fe9 | |||
| 9f0fb82831 | |||
| 049b1a7c5c | |||
| d12c7b64ed | |||
| 8fede6107b | |||
| 75cb115330 | |||
| c2439c8fa1 | |||
| 7cc49a0406 | |||
| f1696dd006 | |||
| 6fd0c249a0 | |||
| 66dfa763d2 | |||
| 3bde28770c | |||
| 4dcb454067 | |||
| 218626d316 | |||
| f9a47e8891 | |||
| c0ec0d141e | |||
| e414f63425 | |||
| 513fe74228 | |||
| 1e98970dc3 | |||
| d13b74ed47 | |||
| 8dcbaded2d | |||
| fe1c4cf389 | |||
| 3ce68231eb | |||
| c33d4c0350 | |||
| 81c442f656 | |||
| f9c7676c92 | |||
| d6e481866a | |||
| 87ec24a074 | |||
| a948335e65 | |||
| 1f0221f5bd | |||
| ba2ef204c9 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -5,3 +5,8 @@ __pycache__
|
||||
*.stl
|
||||
*.FCStd1
|
||||
|
||||
# Artifacts
|
||||
*.png
|
||||
*.jpg
|
||||
*.wav
|
||||
*.pdf
|
||||
|
||||
Binary file not shown.
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# To install on robot
|
||||
|
||||
```
|
||||
git clone <url>
|
||||
cd lewis-crawler/crawler_software/raspberry_pi
|
||||
make install?
|
||||
```
|
||||
|
||||
# Getting started with the CAD
|
||||
|
||||
```
|
||||
git clone https://kitsunehosting.net/gitea/Kenwood/lewis-crawler
|
||||
git checkout crawler-cad
|
||||
```
|
||||
find cad under `lewis-crawler/crawler-cad`
|
||||
12
companion_software/Pipfile
Normal file
12
companion_software/Pipfile
Normal file
@@ -0,0 +1,12 @@
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
Pillow = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.9"
|
||||
68
companion_software/Pipfile.lock
generated
Normal file
68
companion_software/Pipfile.lock
generated
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "a2ebd6d3c633cc5dec90d7752d4757fc614d58ce4dc35d0d5796ce6b9148c5f4"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.9"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"pillow": {
|
||||
"hashes": [
|
||||
"sha256:066f3999cb3b070a95c3652712cffa1a748cd02d60ad7b4e485c3748a04d9d76",
|
||||
"sha256:0a0956fdc5defc34462bb1c765ee88d933239f9a94bc37d132004775241a7585",
|
||||
"sha256:0b052a619a8bfcf26bd8b3f48f45283f9e977890263e4571f2393ed8898d331b",
|
||||
"sha256:1394a6ad5abc838c5cd8a92c5a07535648cdf6d09e8e2d6df916dfa9ea86ead8",
|
||||
"sha256:1bc723b434fbc4ab50bb68e11e93ce5fb69866ad621e3c2c9bdb0cd70e345f55",
|
||||
"sha256:244cf3b97802c34c41905d22810846802a3329ddcb93ccc432870243211c79fc",
|
||||
"sha256:25a49dc2e2f74e65efaa32b153527fc5ac98508d502fa46e74fa4fd678ed6645",
|
||||
"sha256:2e4440b8f00f504ee4b53fe30f4e381aae30b0568193be305256b1462216feff",
|
||||
"sha256:3862b7256046fcd950618ed22d1d60b842e3a40a48236a5498746f21189afbbc",
|
||||
"sha256:3eb1ce5f65908556c2d8685a8f0a6e989d887ec4057326f6c22b24e8a172c66b",
|
||||
"sha256:3f97cfb1e5a392d75dd8b9fd274d205404729923840ca94ca45a0af57e13dbe6",
|
||||
"sha256:493cb4e415f44cd601fcec11c99836f707bb714ab03f5ed46ac25713baf0ff20",
|
||||
"sha256:4acc0985ddf39d1bc969a9220b51d94ed51695d455c228d8ac29fcdb25810e6e",
|
||||
"sha256:5503c86916d27c2e101b7f71c2ae2cddba01a2cf55b8395b0255fd33fa4d1f1a",
|
||||
"sha256:5b7bb9de00197fb4261825c15551adf7605cf14a80badf1761d61e59da347779",
|
||||
"sha256:5e9ac5f66616b87d4da618a20ab0a38324dbe88d8a39b55be8964eb520021e02",
|
||||
"sha256:620582db2a85b2df5f8a82ddeb52116560d7e5e6b055095f04ad828d1b0baa39",
|
||||
"sha256:62cc1afda735a8d109007164714e73771b499768b9bb5afcbbee9d0ff374b43f",
|
||||
"sha256:70ad9e5c6cb9b8487280a02c0ad8a51581dcbbe8484ce058477692a27c151c0a",
|
||||
"sha256:72b9e656e340447f827885b8d7a15fc8c4e68d410dc2297ef6787eec0f0ea409",
|
||||
"sha256:72cbcfd54df6caf85cc35264c77ede902452d6df41166010262374155947460c",
|
||||
"sha256:792e5c12376594bfcb986ebf3855aa4b7c225754e9a9521298e460e92fb4a488",
|
||||
"sha256:7b7017b61bbcdd7f6363aeceb881e23c46583739cb69a3ab39cb384f6ec82e5b",
|
||||
"sha256:81f8d5c81e483a9442d72d182e1fb6dcb9723f289a57e8030811bac9ea3fef8d",
|
||||
"sha256:82aafa8d5eb68c8463b6e9baeb4f19043bb31fefc03eb7b216b51e6a9981ae09",
|
||||
"sha256:84c471a734240653a0ec91dec0996696eea227eafe72a33bd06c92697728046b",
|
||||
"sha256:8c803ac3c28bbc53763e6825746f05cc407b20e4a69d0122e526a582e3b5e153",
|
||||
"sha256:93ce9e955cc95959df98505e4608ad98281fff037350d8c2671c9aa86bcf10a9",
|
||||
"sha256:9a3e5ddc44c14042f0844b8cf7d2cd455f6cc80fd7f5eefbe657292cf601d9ad",
|
||||
"sha256:a4901622493f88b1a29bd30ec1a2f683782e57c3c16a2dbc7f2595ba01f639df",
|
||||
"sha256:a5a4532a12314149d8b4e4ad8ff09dde7427731fcfa5917ff16d0291f13609df",
|
||||
"sha256:b8831cb7332eda5dc89b21a7bce7ef6ad305548820595033a4b03cf3091235ed",
|
||||
"sha256:b8e2f83c56e141920c39464b852de3719dfbfb6e3c99a2d8da0edf4fb33176ed",
|
||||
"sha256:c70e94281588ef053ae8998039610dbd71bc509e4acbc77ab59d7d2937b10698",
|
||||
"sha256:c8a17b5d948f4ceeceb66384727dde11b240736fddeda54ca740b9b8b1556b29",
|
||||
"sha256:d82cdb63100ef5eedb8391732375e6d05993b765f72cb34311fab92103314649",
|
||||
"sha256:d89363f02658e253dbd171f7c3716a5d340a24ee82d38aab9183f7fdf0cdca49",
|
||||
"sha256:d99ec152570e4196772e7a8e4ba5320d2d27bf22fdf11743dd882936ed64305b",
|
||||
"sha256:ddc4d832a0f0b4c52fff973a0d44b6c99839a9d016fe4e6a1cb8f3eea96479c2",
|
||||
"sha256:e3dacecfbeec9a33e932f00c6cd7996e62f53ad46fbe677577394aaa90ee419a",
|
||||
"sha256:eb9fc393f3c61f9054e1ed26e6fe912c7321af2f41ff49d3f83d05bacf22cc78"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==8.4.0"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
1
companion_software/requirements.txt
Normal file
1
companion_software/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
Pillow
|
||||
31
companion_software/superpipe.py
Normal file
31
companion_software/superpipe.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
|
||||
fnt = ImageFont.truetype('/usr/share/fonts/noto/NotoSans-Regular.ttf', 40)
|
||||
|
||||
my_ffmpeg_process = subprocess.Popen("ffmpeg -y -i pipe: -r 30 -pix_fmt yuv420p video.webm".split(), stdin=subprocess.PIPE)
|
||||
|
||||
for i in range(100):
|
||||
img = Image.new('RGB', (1280, 720), color=(73, 109, 137))
|
||||
|
||||
d = ImageDraw.Draw(img)
|
||||
d.text((10, 10), str(i), font=fnt, fill=(255, 255, 0))
|
||||
|
||||
img.save(my_ffmpeg_process.stdin, format='png')
|
||||
|
||||
print(i)
|
||||
|
||||
for i in range(100):
|
||||
img = Image.new('RGB', (1280, 720), color=(73, 109, 137))
|
||||
|
||||
d = ImageDraw.Draw(img)
|
||||
d.text((10, 10), str("Done with python!"), font=fnt, fill=(255, 255, 0))
|
||||
|
||||
img.save(my_ffmpeg_process.stdin, format='png')
|
||||
|
||||
print(i)
|
||||
|
||||
#time.sleep(1)
|
||||
BIN
companion_software/video.webm
Normal file
BIN
companion_software/video.webm
Normal file
Binary file not shown.
BIN
crawler_cad/components/digi-adapter/Digi Case Base.FCStd
Normal file
BIN
crawler_cad/components/digi-adapter/Digi Case Base.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/components/digi-adapter/Digi Case Lid.FCStd
Normal file
BIN
crawler_cad/components/digi-adapter/Digi Case Lid.FCStd
Normal file
Binary file not shown.
Binary file not shown.
BIN
crawler_cad/frame/Frame.FCStd
Normal file
BIN
crawler_cad/frame/Frame.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/lewis-crawler.FCStd
Normal file
BIN
crawler_cad/lewis-crawler.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/mast/9gServo.FCStd
Normal file
BIN
crawler_cad/mast/9gServo.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/mast/MastCamFace.FCStd
Normal file
BIN
crawler_cad/mast/MastCamFace.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/mast/MastCamMount.FCStd
Normal file
BIN
crawler_cad/mast/MastCamMount.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/mast/MastCamRear.FCStd
Normal file
BIN
crawler_cad/mast/MastCamRear.FCStd
Normal file
Binary file not shown.
BIN
crawler_cad/mast/Window Wiper.FCStd
Normal file
BIN
crawler_cad/mast/Window Wiper.FCStd
Normal file
Binary file not shown.
70
crawler_software/arduino/crawler_slave/Makefile
Normal file
70
crawler_software/arduino/crawler_slave/Makefile
Normal file
@@ -0,0 +1,70 @@
|
||||
### DISCLAIMER
|
||||
### This is an example Makefile and it MUST be configured to suit your needs.
|
||||
### For detailed explanations about all the available options,
|
||||
### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
|
||||
|
||||
### PROJECT_DIR
|
||||
### This is the path to where you have created/cloned your project
|
||||
PROJECT_DIR = $(shell dirname $(shell pwd))
|
||||
|
||||
### ARDMK_DIR
|
||||
### Path to the Arduino-Makefile directory.
|
||||
ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
|
||||
|
||||
### ARDUINO_DIR
|
||||
### Path to the Arduino application and resources directory.
|
||||
ARDUINO_DIR = /usr/share/arduino
|
||||
|
||||
### USER_LIB_PATH
|
||||
### Path to where the your project's libraries are stored.
|
||||
USER_LIB_PATH := $(realpath $(PROJECT_DIR)/lib)
|
||||
|
||||
### BOARD_TAG & BOARD_SUB
|
||||
### 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
|
||||
### The port your board is connected to. Using an '*' tries all the ports and finds the right one. Choose one of the two.
|
||||
MONITOR_PORT = /dev/ttyUSB*
|
||||
# MONITOR_PORT = /dev/ttyACM*
|
||||
|
||||
### MONITOR_BAUDRATE
|
||||
### It must be set to Serial baudrate value you are using.
|
||||
MONITOR_BAUDRATE = 115200
|
||||
|
||||
### AVR_TOOLS_DIR
|
||||
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
|
||||
AVR_TOOLS_DIR = /usr
|
||||
|
||||
### 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
|
||||
63
crawler_software/arduino/crawler_slave/crawler_slave.ino
Normal file
63
crawler_software/arduino/crawler_slave/crawler_slave.ino
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Crawler Slave
|
||||
*
|
||||
* This code runs on the crawler i2c network
|
||||
* and provides a cleaner, less CPU intensive control over PWM devices.
|
||||
*/
|
||||
|
||||
#include <Wire.h>
|
||||
#include <Servo.h>
|
||||
|
||||
// This servo is used to wipe and clean the camera lens
|
||||
Servo windowWiperServo;
|
||||
|
||||
// Variables populated over i2c from master
|
||||
int id;
|
||||
int val;
|
||||
|
||||
void setup() {
|
||||
// For debugging
|
||||
//Serial.begin(115200);
|
||||
|
||||
// Attach the wiper servo to pin 9
|
||||
windowWiperServo.attach(9);
|
||||
|
||||
// This is the address the pi will speak to us at
|
||||
Wire.begin(0x4);
|
||||
|
||||
// Call receiveEvent when data received
|
||||
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.
|
||||
void loop() {
|
||||
delay(50);
|
||||
}
|
||||
|
||||
// This method runs when we receive a message
|
||||
void receiveEvent(int n) {
|
||||
Wire.read(); // Remove smbus trash
|
||||
if (true) { // Dont do anything if this is not true
|
||||
id = Wire.read(); // ID of the servo/device to access
|
||||
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();
|
||||
}
|
||||
}
|
||||
5
crawler_software/raspberry_pi/config/hardware.yaml
Normal file
5
crawler_software/raspberry_pi/config/hardware.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
wiper_servo:
|
||||
pin: 17
|
||||
min_pulse: 0.000544
|
||||
max_pulse: 0.0024
|
||||
|
||||
11
crawler_software/raspberry_pi/crawler.service
Normal file
11
crawler_software/raspberry_pi/crawler.service
Normal file
@@ -0,0 +1,11 @@
|
||||
[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
|
||||
2
crawler_software/raspberry_pi/requirements.txt
Normal file
2
crawler_software/raspberry_pi/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
PySSTV
|
||||
picamera
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,9 +1,15 @@
|
||||
from shutil import copyfile
|
||||
from PIL import Image, ImageFont, ImageDraw
|
||||
from pysstv import color
|
||||
from picamera import PiCamera
|
||||
|
||||
import logging as log
|
||||
|
||||
try:
|
||||
from picamera import PiCamera
|
||||
except ModuleNotFoundError:
|
||||
log.info("Running in simulator mode")
|
||||
|
||||
|
||||
def take_photo():
|
||||
# This def is meant to take a photograph from the robot,
|
||||
# it should include all steps and error checking to raise the mast
|
||||
@@ -16,9 +22,12 @@ def take_photo():
|
||||
# Software to take the photo should be here
|
||||
#copyfile('photos/camera_latest.jpg', 'working/working.jpg')
|
||||
log.debug('Initalizing camera.')
|
||||
camera = PiCamera()
|
||||
log.info('Saving photo.')
|
||||
camera.capture('working/working.jpg')
|
||||
try:
|
||||
camera = PiCamera()
|
||||
log.info('Saving photo.')
|
||||
camera.capture('working/working.jpg')
|
||||
except NameError:
|
||||
log.info("Running in simulator mode, not replacing test pattern")
|
||||
|
||||
def mark_photo():
|
||||
log.info('Opening photo for viewing.')
|
||||
73
crawler_software/raspberry_pi/tests/discordbot.py
Normal file
73
crawler_software/raspberry_pi/tests/discordbot.py
Normal file
@@ -0,0 +1,73 @@
|
||||
from discord_webhook import DiscordWebhook
|
||||
from picamera import PiCamera
|
||||
from time import sleep
|
||||
from gps import *
|
||||
from smbus import SMBus
|
||||
import time
|
||||
|
||||
addr = 0x4 # bus address
|
||||
bus = SMBus(1) # indicates /dev/ic2-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:
|
||||
for _x in range (0, 2):
|
||||
for i in range(78, 130):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 78, -1):
|
||||
writeData("WIPE-" + str(i))
|
||||
time.sleep(0.02)
|
||||
except OSError:
|
||||
print("Could not speak to ardujmemo")
|
||||
|
||||
def get_uptime():
|
||||
with open('/proc/uptime', 'r') as f:
|
||||
uptime_seconds = float(f.readline().split()[0])
|
||||
|
||||
return uptime_seconds
|
||||
|
||||
def getPositionData(gps):
|
||||
location = [None]
|
||||
while(location[0] == None):
|
||||
print("Trying again")
|
||||
nx = gpsd.next()
|
||||
# For a list of all supported classes and fields refer to:
|
||||
# https://gpsd.gitlab.io/gpsd/gpsd_json.html
|
||||
if nx['class'] == 'TPV':
|
||||
latitude = getattr(nx,'lat', "Unknown")
|
||||
longitude = getattr(nx,'lon', "Unknown")
|
||||
#print "Your position: lon = " + str(longitude) + ", lat = " + str(latitude)
|
||||
location = [latitude, longitude]
|
||||
return location
|
||||
|
||||
gpsd = gps(mode=WATCH_ENABLE|WATCH_NEWSTYLE)
|
||||
|
||||
loc = getPositionData(gpsd)
|
||||
|
||||
webhookURL = "https://discord.com/api/webhooks/856609966404534272/TR9tnLq2sIGZoOeADNswmGRNlzBcqM5aKihfU6snVTP9WhSSoVVvi7nT6i-ZfZS7Hcqm"
|
||||
|
||||
print(loc[0])
|
||||
print(loc[1])
|
||||
webhook = DiscordWebhook(url=webhookURL, content="Uptime: " + str( round( ((get_uptime() / 60) / 60 ), 2 )) + " hours. Lat is " + str(loc[0]) + ", long is " + str(loc[1]))
|
||||
|
||||
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
|
||||
|
||||
19
crawler_software/raspberry_pi/tests/servo_test.py
Normal file
19
crawler_software/raspberry_pi/tests/servo_test.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
servoPIN = 17
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(servoPIN, GPIO.OUT)
|
||||
|
||||
p = GPIO.PWM(servoPIN, 50) # GPIO 17 for PWM with 50Hz
|
||||
p.start(2.5) # Initialization
|
||||
try:
|
||||
while True:
|
||||
p.ChangeDutyCycle(10)
|
||||
time.sleep(2)
|
||||
p.ChangeDutyCycle(2.5)
|
||||
time.sleep(2)
|
||||
except KeyboardInterrupt:
|
||||
p.stop()
|
||||
GPIO.cleanup()
|
||||
|
||||
20
crawler_software/raspberry_pi/tests/stack_overflow.py
Normal file
20
crawler_software/raspberry_pi/tests/stack_overflow.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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")
|
||||
35
crawler_software/raspberry_pi/tests/test_i2c.py
Normal file
35
crawler_software/raspberry_pi/tests/test_i2c.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Raspberry Pi Master for Arduino Slave
|
||||
# i2c_master_pi.py
|
||||
# Connects to Arduino via I2C
|
||||
|
||||
# DroneBot Workshop 2019
|
||||
# https://dronebotworkshop.com
|
||||
|
||||
from smbus import SMBus
|
||||
import time
|
||||
|
||||
addr = 0x8 # bus address
|
||||
bus = SMBus(1) # indicates /dev/ic2-1
|
||||
|
||||
numb = 1
|
||||
|
||||
print ("Enter num")
|
||||
|
||||
for _x in range (0, 4):
|
||||
for i in range(76, 130):
|
||||
bus.write_byte(addr, i)
|
||||
time.sleep(0.02)
|
||||
for i in range(130, 76, -1):
|
||||
bus.write_byte(addr, i)
|
||||
time.sleep(0.02)
|
||||
|
||||
#while numb == 1:
|
||||
#
|
||||
# ledstate = input(">>>> ")
|
||||
#
|
||||
# if ledstate == "1":
|
||||
# bus.write_byte(addr, 0x1) # switch it on
|
||||
# elif ledstate == "0":
|
||||
# bus.write_byte(addr, 0x0) # switch it on
|
||||
# else:
|
||||
# numb = 0
|
||||
12
crawler_software/raspberry_pi/tests/test_tx.py
Normal file
12
crawler_software/raspberry_pi/tests/test_tx.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
|
||||
from time import sleep # Import the sleep function from the time module
|
||||
|
||||
GPIO.setwarnings(False) # Ignore warning for now
|
||||
GPIO.setmode(GPIO.BOARD) # Use physical pin numbering
|
||||
GPIO.setup(12, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and set initial value to low (off)
|
||||
|
||||
while True: # Run forever
|
||||
GPIO.output(12, GPIO.HIGH) # Turn on
|
||||
sleep(1) # Sleep for 1 second
|
||||
GPIO.output(12, GPIO.LOW) # Turn off
|
||||
sleep(1) # Sleep for 1 second
|
||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 86 KiB |
@@ -1,2 +0,0 @@
|
||||
PySSTV
|
||||
picamera
|
||||
Reference in New Issue
Block a user