Skip to content

Commit 950296c

Browse files
committed
added move action and increased tolerance for move failed exception
1 parent 7f95546 commit 950296c

3 files changed

Lines changed: 79 additions & 22 deletions

File tree

src/sciclops_driver.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ def move(self, R: float, Z: float, P: float, Y: float):
392392
position = self.get_current_position()
393393
if not all(
394394
[
395-
abs(position[0] - Z) < 1.0,
396-
abs(position[1] - R) < 1.0,
397-
abs(position[2] - Y) < 1.0,
398-
abs(position[3] - P) < 1.0,
395+
abs(position[0] - Z) < 5.0,
396+
abs(position[1] - R) < 5.0,
397+
abs(position[2] - Y) < 5.0,
398+
abs(position[3] - P) < 5.0,
399399
]
400400
):
401401
raise Exception(
@@ -487,12 +487,12 @@ def pick_plate_direct(
487487
self.gripper_close()
488488
self.jog("Z", -1000)
489489

490-
# Once top of plates is touched, jog up 10, open gripper, then move down to grab plate at the correct height.
491-
self.jog("Z", 50)
490+
# Once top of plates is touched, jog up 100, open gripper, then move down to grab plate at the correct height.
491+
self.jog("Z", 100)
492492
self.gripper_open()
493493

494494
# Jog down to grip location
495-
self.jog("Z", -(50 + z_jog_down_from_plate_top))
495+
self.jog("Z", -(100 + z_jog_down_from_plate_top))
496496

497497
# If the location is a Nest....
498498
elif source.location_type == "nest":

src/sciclops_rest_node.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,19 @@ def transfer(
401401
)
402402
return place_result
403403

404+
@action()
405+
def move(
406+
self,
407+
location: LocationArgument,
408+
) -> None:
409+
"""Moves the SciClops to a specified location."""
410+
411+
location.representation["name"] = location.location_name
412+
location = SciClopsLocation.model_validate(location.representation)
413+
414+
self.sciclops.move_loc(location)
415+
return None
416+
404417
@action()
405418
def remove_lid(
406419
self,
@@ -488,7 +501,6 @@ def remove_lid(
488501
)
489502

490503
# Is the target location clear?
491-
492504
target_resource_id = self.location_client.get_location_by_name(
493505
target.name
494506
).resource_id
@@ -601,10 +613,6 @@ def replace_lid(
601613
-1
602614
] # accounts for the source being a stack as well as a nest
603615

604-
# TESTING
605-
print("CHILD -1 RESOURCE!")
606-
print(f"{child_resource=}")
607-
608616
if "lid" in child_resource.attributes:
609617
if child_resource.attributes["lid"] is True:
610618
lid_resource = source_resource.children[

testing/test_sciclops.ipynb

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,61 @@
77
"outputs": [],
88
"source": [
99
"# from sciclops_interface_OLD import SCICLOPS\n",
10-
"from resource_helpers.sciclops_resource_defs import locations, plate_definitions\n",
10+
"from resource_helpers.resource_types import SciClopsLocation\n",
11+
"from resource_helpers.sciclops_resource_defs import plate_definitions\n",
1112
"from sciclops_driver import SCICLOPS\n",
1213
"\n",
14+
"locations = {\n",
15+
" \"Safe\": SciClopsLocation(\n",
16+
" name=\"Safe\",\n",
17+
" joint_angles={\"Z\": 23.5188, \"R\": 109.2741, \"Y\": 32.7484, \"P\": 98.2955},\n",
18+
" location_type=\"nest\",\n",
19+
" safe_approach_height=0,\n",
20+
" ),\n",
21+
" \"Stack1\": SciClopsLocation(\n",
22+
" name=\"Stack1\",\n",
23+
" joint_angles={\"Z\": -397.1688, \"R\": 137.1106, \"Y\": 173.0127, \"P\": 9.6875},\n",
24+
" location_type=\"stack\",\n",
25+
" safe_approach_height=0,\n",
26+
" ),\n",
27+
" \"Stack2\": SciClopsLocation(\n",
28+
" name=\"Stack2\",\n",
29+
" joint_angles={\"Z\": -397.2875, \"R\": 154.9712, \"Y\": 172.5352, \"P\": 9.6875},\n",
30+
" location_type=\"stack\",\n",
31+
" safe_approach_height=0,\n",
32+
" ),\n",
33+
" \"LidNest1\": SciClopsLocation(\n",
34+
" name=\"LidNest1\",\n",
35+
" joint_angles={\"Z\": -386.8563, \"R\": 173.1300, \"Y\": 26.1751, \"P\": 10.3409},\n",
36+
" location_type=\"nest\",\n",
37+
" safe_approach_height=0,\n",
38+
" ),\n",
39+
" \"Home\": SciClopsLocation(\n",
40+
" name=\"Home\",\n",
41+
" joint_angles={\"Z\": -1.0188, \"R\": 0.0, \"Y\": 0.0, \"P\": -0.0284},\n",
42+
" location_type=\"stack\",\n",
43+
" safe_approach_height=0,\n",
44+
" ),\n",
45+
" \"Exchange\": SciClopsLocation(\n",
46+
" name=\"Exchange\",\n",
47+
" joint_angles={\n",
48+
" \"Z\": -414.6188,\n",
49+
" \"R\": 298.0041,\n",
50+
" \"Y\": 195.3245,\n",
51+
" \"P\": 17.6136,\n",
52+
" },\n",
53+
" location_type=\"nest\",\n",
54+
" safe_approach_height=0,\n",
55+
" ),\n",
56+
"}\n",
57+
"\n",
1358
"# locations\n",
1459
"home_location = locations[\"Home\"]\n",
1560
"safe_location = locations[\"Safe\"]\n",
1661
"stack1_location = locations[\"Stack1\"]\n",
1762
"stack2_location = locations[\"Stack2\"]\n",
1863
"lid_nest_1_location = locations[\"LidNest1\"]\n",
64+
"exchange_location = locations[\"Exchange\"]\n",
1965
"\n",
2066
"# plate types\n",
2167
"flat_plate = plate_definitions[\"flat_bottom_96well\"]\n",
@@ -64,7 +110,7 @@
64110
"metadata": {},
65111
"outputs": [],
66112
"source": [
67-
"s.move_above_loc(lid_nest_1_location)"
113+
"s.move_above_loc(exchange_location)"
68114
]
69115
},
70116
{
@@ -100,7 +146,7 @@
100146
"metadata": {},
101147
"outputs": [],
102148
"source": [
103-
"s.jog(\"Y\", -200)"
149+
"s.jog(\"Z\", 200)"
104150
]
105151
},
106152
{
@@ -109,14 +155,17 @@
109155
"metadata": {},
110156
"outputs": [],
111157
"source": [
112-
"s.pick_plate_direct(\n",
113-
" source=lid_nest_1_location,\n",
114-
" plate_type=flat_plate,\n",
115-
" has_lid=True,\n",
116-
")\n",
158+
"# s.pick_plate_direct(\n",
159+
"# source=stack1_location,\n",
160+
"# plate_type=flat_plate,\n",
161+
"# has_lid=True,\n",
162+
"# is_lid=False,\n",
163+
"# )\n",
117164
"\n",
118165
"s.place_plate_direct(\n",
119-
" target=stack1_location,\n",
166+
" is_lid=False,\n",
167+
" replacing_lid=False,\n",
168+
" target=exchange_location,\n",
120169
" plate_type=flat_plate,\n",
121170
")"
122171
]
@@ -127,7 +176,7 @@
127176
"metadata": {},
128177
"outputs": [],
129178
"source": [
130-
"s.limp(True)"
179+
"s.limp(False)"
131180
]
132181
},
133182
{

0 commit comments

Comments
 (0)