top of page

Forum Posts

snibnib
Jul 18, 2024
In Questions
Hello everyone, First off, congratulations on the project. I am currently trying to program the AR4 arm with Python, I read that we can control it over serial commands so I am generating those commands with the AR4 Software and "mapping" them to Python functions. I am having a problem with the gripper though, my code looks like this: def send_command(command, board): """Send a command to the specified board and wait for a response.""" if board == "teensy": ser = teensy_ser elif board == "arduino": ser = arduino_ser ser.write((command + '\n').encode()) # Ensure the command ends with a newline character print(f"Sent command {command}") response = "" start_time = time.time() while response == "": response = ser.readline().decode('utf-8').strip() if time.time() - start_time > 60: # Timeout after 10 seconds raise TimeoutError("No response from robot arm within the expected time frame.") return response def open_grip(): command = "ONX8" board = "arduino" response = send_command(command, board) if response: # Check if a valid response is received print("OK") else: print(f"No response or invalid response from {board}, retrying...") def close_grip(): command = "OFX8" board = "arduino" response = send_command(command, board) if response: # Check if a valid response is received print("OK") else: print(f"No response or invalid response from {board}, retrying...") The close_grip command makes the grip open and close fast but obviously that is not what is wanted, open_grip doesnt really react. I dont understand what is the issue here. Could anyone help? Thank you
0
1
83

snibnib

More actions
bottom of page