Skip to content

Commit

Permalink
Gripper wait for stabilization and throw errors properly
Browse files Browse the repository at this point in the history
  • Loading branch information
danr authored and Pharmbio committed Nov 8, 2023
1 parent 4aadeb2 commit f3fd3c7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
17 changes: 13 additions & 4 deletions cellpainter/cellpainter/gripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,30 @@ def GripperMove(pos, soft=False):
GripperSend("~m_p_op", "Parameter successfully set")
end
last = GripperPos()
# wait for stabilization
while 1:
sleep(0.4)
p = GripperPos()
if p == -1:
textmsg("log retrying GripperPos, p:", p)
textmsg("log retrying GripperPos, p: ", p)
continue
end
if p != last:
textmsg("log not stable yet, keep checking, diff: ", last - p)
last = p
continue
end
if close and p <= 91:
if 1:
sleep(0.15)
sleep(0.4)
p = GripperPos()
if p > 0 and p <= 80:
if p > 0 and p <= 81:
msg = str_cat("Gripper closed more than expected: ", p) + "mm"
textmsg("fatal: ", msg)
popup(msg, "fatal", error=False, blocking=True)
else:
textmsg("log gripper close finished at p: ", p)
end
end
break
Expand Down
4 changes: 2 additions & 2 deletions cellpainter/cellpainter/ur_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def MoveLin(x, y, z, r, p, yaw, slow=False):
def MoveRel(x, y, z, r, p, yaw, slow=False):
if not last_lin:
textmsg("log fail MoveRel without preceding linear move")
popup("MoveRel without preceding linear move", error=True)
textmsg("log fatal MoveRel without preceding linear move")
# popup("MoveRel without preceding linear move", error=True)
halt
end
MoveLin(
Expand Down
36 changes: 18 additions & 18 deletions cellpainter/movelists/lid-B19.jsonl
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{"type":"Section","section":"lid-B19 put"}
{"type":"MoveJoint","joints":[94.88,-110.59,90.31,19.45,95.29,179.84],"name":"B neu"}
{"type":"MoveLin","xyz":[196.5,-567.4,831],"rpy":[0.4,1.9,90.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[196.5,-567.3,817.4],"rpy":[0.4,1.8,90.6],"name":"B21 pick","slow":true}
{"type":"MoveLin","xyz":[199.7,-566.9,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[199.7,-566.9,821.9],"rpy":[0.0,0.7,89.6],"name":"B21 pick","slow":true}
{"type":"GripperMove","pos":255}
{"type":"MoveLin","xyz":[196.5,-567.3,825.9],"rpy":[0.4,1.9,90.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[196.7,-421.8,834.2],"rpy":[0.4,1.5,90.6],"name":"B21 entrance"}
{"type":"MoveLin","xyz":[196.7,-421.8,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[196.6,-567.4,751.1],"rpy":[0.4,1.9,90.6],"tag":"19/21","name":"B19 neu"}
{"type":"MoveLin","xyz":[196.6,-567.4,738.4],"rpy":[0.4,1.8,90.6],"tag":"19/21","name":"B19 drop","slow":true}
{"type":"MoveLin","xyz":[199.7,-566.9,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[199.7,-421.7,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 entrance"}
{"type":"MoveLin","xyz":[199.7,-421.8,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[199.7,-567.4,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 neu"}
{"type":"MoveLin","xyz":[199.7,-567.4,742.6],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 drop","slow":true}
{"type":"GripperMove","pos":88}
{"type":"MoveLin","xyz":[196.6,-567.4,751.1],"rpy":[0.4,1.9,90.6],"tag":"19/21","name":"B19 neu"}
{"type":"MoveLin","xyz":[196.7,-421.8,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[199.7,-567.4,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 neu"}
{"type":"MoveLin","xyz":[199.7,-421.8,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[199.7,-421.7,834.2],"rpy":[0.0,0.8,89.6],"name":"B neu"}
{"type":"Section","section":"lid-B19 get"}
{"type":"MoveJoint","joints":[94.88,-110.59,90.31,19.45,95.29,179.84],"name":"B neu"}
{"type":"MoveLin","xyz":[196.7,-421.8,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[196.7,-567.4,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 pick neu"}
{"type":"MoveLin","xyz":[196.7,-567.4,741.1],"rpy":[0.4,1.3,90.6],"tag":"19/21","name":"B19 pick","slow":true}
{"type":"MoveLin","xyz":[199.7,-421.8,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[199.7,-567.4,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 pick neu"}
{"type":"MoveLin","xyz":[199.7,-567.4,742.6],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 pick","slow":true}
{"type":"GripperMove","pos":255}
{"type":"MoveLin","xyz":[196.7,-567.4,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 pick neu"}
{"type":"MoveLin","xyz":[196.7,-421.8,751.1],"rpy":[0.4,1.5,90.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[196.7,-421.8,834.2],"rpy":[0.4,1.5,90.6],"name":"B21 entrance"}
{"type":"MoveLin","xyz":[196.6,-566.9,831.1],"rpy":[0.4,1.5,90.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[196.7,-566.9,820.1],"rpy":[0.4,1.5,90.6],"name":"B21 drop","slow":true}
{"type":"MoveLin","xyz":[199.7,-567.4,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 pick neu"}
{"type":"MoveLin","xyz":[199.7,-421.8,751.1],"rpy":[0.0,0.7,89.6],"tag":"19/21","name":"B19 entrance"}
{"type":"MoveLin","xyz":[199.7,-421.7,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 entrance"}
{"type":"MoveLin","xyz":[199.7,-566.9,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[199.7,-566.9,822.2],"rpy":[0.0,0.7,89.6],"name":"B21 drop","slow":true}
{"type":"GripperMove","pos":88}
{"type":"MoveLin","xyz":[196.7,-567.4,831],"rpy":[0.4,1.5,90.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[199.7,-566.9,834.2],"rpy":[0.0,0.7,89.6],"name":"B21 neu"}
{"type":"MoveLin","xyz":[199.7,-421.7,834.2],"rpy":[0.0,0.8,89.6],"name":"B neu"}

0 comments on commit f3fd3c7

Please sign in to comment.