Compare commits

..

37 Commits

Author SHA1 Message Date
Kenwood 61d77870a0 Fix merge 2021-07-14 19:45:58 -04:00
Kenwood ea5978f4e4 Merge branch 'crawler-cad' 2021-07-14 19:40:27 -04:00
Kenwood 942809c95a Send final updates to fab 2021-07-14 19:40:19 -04:00
Kenwood c2695e1971 Fix bad merge ver 2021-07-04 23:08:13 -04:00
Kenwood af4c8f978b Merge branch 'crawler-software' 2021-07-04 23:06:20 -04:00
Kenwood 046c1f7846 Merge cad into master 2021-07-04 23:06:16 -04:00
Kenwood 6fbb53b6bd Fix a bug where arduino would crash on incorrectly sized i2c payload 2021-07-04 22:10:05 -04:00
Kenwood f6bb087799 Merge branch 'crawler-software' of https://kitsunehosting.net/gitea/Kenwood/lewis-crawler into crawler-software 2021-07-04 21:38:39 -04:00
Kenwood 21330c945d Finalize (mostly) new and improved slavecode 2021-07-04 21:37:58 -04:00
Kenwood b5ba5f6f9e Add stack overflow working pycode! 2021-07-05 02:37:18 +01:00
Kenwood 32bd0f5b55 Add sanity check 2021-07-04 20:36:13 -04:00
Kenwood 13eb27b9c3 Remove unnecicary loop 2021-07-04 20:34:15 -04:00
Kenwood f34cb81c7a Update new sorting/recv mechanism 2021-07-04 20:32:04 -04:00
Kenwood 209e15d41f Merge branch 'crawler-software' of https://kitsunehosting.net/gitea/Kenwood/lewis-crawler into crawler-software 2021-07-05 01:03:53 +01:00
Kenwood de214dfc6b Edit servo extent 2021-07-05 01:03:33 +01:00
Kenwood 8f7e12ec90 Create readme.md with basic install docs. 2021-07-04 18:39:08 -04:00
Kenwood 03564ed485 Shrink hat-holes 2021-07-04 15:31:06 -04:00
Kenwood 19acde6d43 Add 'hat flanges' to midsection 2021-07-04 15:28:54 -04:00
Kenwood d2f85f6aad Fix rename 2021-07-04 15:25:18 -04:00
Kenwood 6f1e5af90f Cleanup requirements.txt 2021-07-04 12:22:21 -04:00
Kenwood 2ee6bbef90 Modify crawler service file. 2021-07-04 12:18:43 -04:00
Kenwood 941b5ac4e8 Create crawler service file. 2021-07-04 12:16:41 -04:00
Kenwood 779127ff73 Rename CAD 2021-07-04 12:07:31 -04:00
Kenwood 9e58b2b1af The CAD as of now is up to date, and everything is printed. 2021-07-04 12:03:19 -04:00
Kenwood 227815ac32 Everything moves a lot smoother without serial: todo jump speed? 2021-07-04 00:07:36 -04:00
Kenwood 83a33cc202 Finalize better reading of full string over i2c and splitting 2021-07-03 23:57:17 -04:00
Kenwood aa575f67a3 Create/modify read string code 2021-07-03 22:54:50 -04:00
Kenwood b902f8a500 Fix wrong gps depth. 2021-07-03 16:06:47 -04:00
Kenwood f38f1ab8ba Finalize rear cam mount 2021-07-02 12:16:11 -04:00
Kenwood e092a570d1 Cleanupcam mount 2021-07-01 22:06:57 -04:00
Kenwood db52dbff47 Update mastcam 2021-06-29 22:45:03 -04:00
Kenwood 9f0fb82831 Create half of the rear mast post, and make drawing object for frame. 2021-06-29 19:35:21 -04:00
Kenwood 049b1a7c5c Add second flange to midsection of mastcam 2021-06-28 12:30:57 -04:00
Kenwood d12c7b64ed Create proto for window wiper blade 2021-06-28 12:25:04 -04:00
Kenwood f1696dd006 Update case and lid 2021-06-27 22:56:41 -04:00
Kenwood 6fd0c249a0 Create lid for digi components 2021-06-25 23:42:01 -04:00
Kenwood 66dfa763d2 Create base for digi components 2021-06-25 23:14:09 -04:00
17 changed files with 90 additions and 12 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ __pycache__
*.png
*.jpg
*.wav
*.pdf

Binary file not shown.

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# To install on robot
```
git clone <url>
cd lewis-crawler/crawler_software/raspberry_pi
make install?
```

Binary file not shown.

Binary file not shown.

BIN
crawler_cad/Frame.FCStd Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,16 +10,28 @@
// 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(0x8);
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.
@ -28,9 +40,24 @@ void loop() {
}
// This method runs when we receive a message
void receiveEvent(int howMany) {
while (Wire.available()) { // loop through all but the last
int pos = Wire.read(); // receive byte as a int
windowWiperServo.write(pos);
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();
}
}

View 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

View File

@ -5,18 +5,30 @@ from gps import *
from smbus import SMBus
import time
addr = 0x8 # bus address
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(70, 130):
bus.write_byte(addr, i)
for i in range(78, 130):
writeData("WIPE-" + str(i))
time.sleep(0.02)
for i in range(130, 70, -1):
bus.write_byte(addr, i)
for i in range(130, 78, -1):
writeData("WIPE-" + str(i))
time.sleep(0.02)
except OSError:
print("Could not speak to ardujmemo")

View 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")