Arm moves only along checked poses; any marker name of the active map
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-13
@@ -1,7 +1,7 @@
|
||||
"""Run a Cobo π program on the arm over the controller's TCP command port 10001 (no SDK).
|
||||
"""The arm controller's TCP command port 10001 (JSON, no SDK): commands, Cobo π programs.
|
||||
Programs are started through manipulation/arm_route.py (only from `look`).
|
||||
|
||||
python robot/arm.py # state
|
||||
python robot/arm.py run # play hand_shaking.jks once and wait
|
||||
python robot/arm.py stop
|
||||
"""
|
||||
import json
|
||||
@@ -10,7 +10,6 @@ import sys
|
||||
import time
|
||||
|
||||
CONTROLLER = ("192.168.10.90", 10001)
|
||||
WAVE = "hand_shaking.jks"
|
||||
# The controller now and then closes the connection without a reply (seen on get_data, get_program_state,
|
||||
# kine_inverse, stop_program, moveL, set_digital_output). Commands that only read are asked again, and so are those
|
||||
# that set an absolute value: moves to an absolute target (relFlag 0) and setting an output; sent twice they do the
|
||||
@@ -59,7 +58,7 @@ def program_state():
|
||||
return cmd("get_program_state").get("programState")
|
||||
|
||||
|
||||
def start(program=WAVE):
|
||||
def start(program):
|
||||
"""Load (if needed) and start a program; returns at once."""
|
||||
if (cmd("get_loaded_program").get("programName") or "").lower() != program.lower():
|
||||
if cmd("load_program", programName=program).get("errorCode") != "0":
|
||||
@@ -74,15 +73,7 @@ def stop():
|
||||
|
||||
if __name__ == "__main__":
|
||||
what = sys.argv[1] if len(sys.argv) > 1 else "state"
|
||||
if what == "run":
|
||||
if not ready():
|
||||
sys.exit("arm not ready (power/enable off, or a program is running)")
|
||||
start()
|
||||
time.sleep(0.5)
|
||||
while program_state() != "idle":
|
||||
time.sleep(0.3)
|
||||
print("done")
|
||||
elif what == "stop":
|
||||
if what == "stop":
|
||||
print(stop())
|
||||
else:
|
||||
print(cmd("get_robot_state"), program_state(), cmd("get_loaded_program").get("programName"))
|
||||
|
||||
Reference in New Issue
Block a user