|
|
@@ -7,6 +7,13 @@ from robot_control.src.utils.config import RobotConfig, GRBLConfig, MovementConf
|
|
|
|
|
|
from robot_control.src.api.gpio import PiGPIO
|
|
|
|
|
|
+"""
|
|
|
+This is a test script for the robot movement system.
|
|
|
+It initializes the GRBL handler and the robot movement system,
|
|
|
+and performs a series of simple A->B movements to test the system.
|
|
|
+Can also use GPIO pins to control pump and valve.
|
|
|
+"""
|
|
|
+
|
|
|
# grbl_config = GRBLConfig(port="debug", baudrate=115200)
|
|
|
grbl_config = GRBLConfig(port="/dev/ttyACM0", baudrate=115200)
|
|
|
test_config = MovementConfig(
|
|
|
@@ -28,14 +35,26 @@ gpio = PiGPIO([pump_pin, valve_pin], [])
|
|
|
|
|
|
y_offset = 130
|
|
|
|
|
|
+# Real positions
|
|
|
+# positions = [
|
|
|
+# (453, 1028 - y_offset, 0),
|
|
|
+# (453, 1028 - y_offset, 107),
|
|
|
+# (453, 1028 - y_offset, 0),
|
|
|
+# (170, 760 - y_offset, 0),
|
|
|
+# (170, 760 - y_offset, 40),
|
|
|
+# (170, 760 - y_offset, 0),
|
|
|
+# (453, 600 - y_offset, 0), # neutral pos
|
|
|
+# ]
|
|
|
+
|
|
|
+# Test positions
|
|
|
positions = [
|
|
|
- (453, 1028 - y_offset, 0),
|
|
|
- (453, 1028 - y_offset, 107),
|
|
|
- (453, 1028 - y_offset, 0),
|
|
|
- (170, 760 - y_offset, 0),
|
|
|
- (170, 760 - y_offset, 40),
|
|
|
- (170, 760 - y_offset, 0),
|
|
|
- (453, 600 - y_offset, 0), # neutral pos
|
|
|
+ (100, 100, 0),
|
|
|
+ (100, 100, 107),
|
|
|
+ (100, 100, 0),
|
|
|
+ (150, 150, 0),
|
|
|
+ (150, 150, 40),
|
|
|
+ (150, 150, 0),
|
|
|
+ (100, 150, 0), # neutral pos
|
|
|
]
|
|
|
|
|
|
async def wait_for_enter():
|
|
|
@@ -56,7 +75,7 @@ async def perform_movement_sequence():
|
|
|
print(f"Moving to position {pos}...")
|
|
|
if idx == 1:
|
|
|
gpio.set_pin(pump_pin, 1)
|
|
|
- await asyncio.sleep(5)
|
|
|
+ await asyncio.sleep(4)
|
|
|
gpio.set_pin(pump_pin, 0)
|
|
|
if idx == 2:
|
|
|
gpio.set_pin(valve_pin, 1)
|
|
|
@@ -68,7 +87,6 @@ async def perform_movement_sequence():
|
|
|
|
|
|
async def test_movement():
|
|
|
await grbl_handler.connect()
|
|
|
- await movement.perform_homing()
|
|
|
|
|
|
print("Press Enter to start movement sequence (or Ctrl+C to exit)...")
|
|
|
while True:
|