← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-04-25 10:15:50 +0200
committerEdvin <[email protected]>2025-04-25 10:15:50 +0200
commit864bb8edacb3a34e98ca804bc439b7188c397c5b (patch)
tree66a20e0c0f5ebcb5a90759a0864a042f301917d2 /main.py
parentca0fe916886eb935cd8936ea47c812e92fcd4f3f (diff)
Added some test for the LCD and fixed paths to programs to be absolute.
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/main.py b/main.py
index 811e982..4f690dc 100755
--- a/main.py
+++ b/main.py
@@ -4,10 +4,14 @@ import signal
import serial
import select
from time import sleep
+# import I2C_LCD_driver as LCD
-BluetoothProcess = subprocess.Popen(["python", "-u", "bt.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, text=True)
+# AGVlcd = LCD.lcd()
+
+BluetoothProcess = subprocess.Popen(["python", "-u", "/home/pi/TNE107-RPI/bt.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, text=True)
# Waiting on connection
+# AGVlcd.lcd_display_string("Waiting for Bluetooth connection...", 1)
print(BluetoothProcess.stdout.readline().strip())
# Connected?
@@ -15,26 +19,32 @@ print(BluetoothProcess.stdout.readline().strip())
bto = BluetoothProcess.stdout.readline().strip()
print(bto)
+
newCommand = False
-rightTurnIndex = 5
+rightTurnIndex = 50
rightTurn = 0
-leftTurnIndex = 2
+leftTurnIndex = 20
leftTurn = 0
if bto.find("Connected") != -1:
+ # AGVlcd.lcd_clear()
+ # AGVlcd.lcd_display_string(bto)
+
# Open serial port to Arduino Nano
NANO = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
# LIDAR Process Code
- LIDARProcess = subprocess.Popen(["./LIDARProg", "--channel", "--serial", "/dev/ttyUSB1", "460800"], stdout=open(os.devnull, 'wb'))
+ LIDARProcess = subprocess.Popen(["./home/pi/TNE107-RPI/LIDARProg", "--channel", "--serial", "/dev/ttyUSB1", "460800"], stdout=open(os.devnull, 'wb'))
print(f"LIDAR PID: {LIDARProcess.pid}")
# DWM Process Code
- DWMProcess = subprocess.Popen(["python", "DWM.py"], stdout=open(os.devnull, 'wb'))
+ DWMProcess = subprocess.Popen(["python", "/home/pi/TNE107-RPI/DWM.py"], stdout=open(os.devnull, 'wb'))
print(f"DWM PID: {DWMProcess.pid}")
+ # sleep(3)
+
while bto != "1000":
- ready, _, _ = select.select([BluetoothProcess.stdout], [], [], 0.01)
+ ready, _, _ = select.select([BluetoothProcess.stdout], [], [], 0.001)
if ready:
bto = BluetoothProcess.stdout.readline().strip()
@@ -71,6 +81,8 @@ if bto.find("Connected") != -1:
elif bto == "0":
NANO.write(b"Stop\n")
+ # Print current status (current command, heading? position? Could we include a cool progress bar? TO MISSION COMPLETEION?????)
+
print("Terminating Serial port to Arduino Nano")
NANO.write(b"Stop\n")