Skip to content

Commit 183ff3a

Browse files
committed
Correct tests for array value length changes, add restoration for profile. Correct profile get error for 'straight' property.
1 parent 6d4cb49 commit 183ff3a

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

pylabrobot/arms/precise_flex/precise_flex_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ async def get_motion_profile_values(self, profile: int) -> tuple[int, float, flo
10491049
float(parts[5]),
10501050
float(parts[6]),
10511051
float(parts[7]),
1052-
False if parts[8] == 0 else True
1052+
False if int(parts[8]) == 0 else True
10531053
)
10541054

10551055
#region MOTION COMMANDS

pylabrobot/arms/precise_flex/precise_flex_api_tests.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ async def asyncSetUp(self):
5353
self._original_pallet_final_y_pos = await self.robot.get_pallet_y(self.TEST_LOCATION_ID)
5454
self._original_pallet_final_z_pos = await self.robot.get_pallet_z(self.TEST_LOCATION_ID)
5555

56+
self._original_profile = await self.robot.get_motion_profile_values(self.TEST_PROFILE_ID)
57+
5658
async def asyncTearDown(self):
5759
"""Restore station edits and leave the link up for the next test."""
5860

@@ -84,6 +86,9 @@ async def asyncTearDown(self):
8486
else:
8587
await self.robot.set_location_angles(*self._original_station_location[1:8])
8688

89+
# Set profile back to default values
90+
await self.robot.set_motion_profile_values(self.TEST_PROFILE_ID, *self._original_profile[1:])
91+
8792
except Exception as e:
8893
# Do not hide teardown failures. Print and continue so later tests can try to recover.
8994
print(f"asyncTearDown encountered an error: {e}")
@@ -597,7 +602,7 @@ async def test_where(self) -> None:
597602
x, y, z, yaw, pitch, roll, axes = position_data
598603
self.assertTrue(all(isinstance(val, (int, float)) for val in [x, y, z, yaw, pitch, roll]))
599604
self.assertIsInstance(axes, tuple)
600-
self.assertEqual(len(axes), 7)
605+
self.assertEqual(len(axes), 6)
601606
self.assertTrue(all(isinstance(val, (int, float)) for val in axes))
602607
print(f"Current position - Cartesian: X={x}, Y={y}, Z={z}, Yaw={yaw}, Pitch={pitch}, Roll={roll}")
603608
print(f"Current position - Joints: {axes}")
@@ -616,7 +621,7 @@ async def test_where_j(self) -> None:
616621
"""Test where_j()"""
617622
joint_data = await self.robot.where_j()
618623
self.assertIsInstance(joint_data, tuple)
619-
self.assertEqual(len(joint_data), 7)
624+
self.assertEqual(len(joint_data), 6)
620625
self.assertTrue(all(isinstance(val, (int, float)) for val in joint_data))
621626
print(f"Current joint positions: {joint_data}")
622627

@@ -918,7 +923,7 @@ async def test_move(self) -> None:
918923
"""Test move() command"""
919924
# Save test location
920925
await self.robot.set_location_xyz(self.TEST_LOCATION_ID, *self.TEST_LOCATION_C_LEFT[:-1])
921-
await self.robot.set_location_config(self.TEST_LOCATION_ID, 0x02) # GPL_Lefty
926+
await self.robot.set_location_config(self.TEST_LOCATION_ID, self.TEST_LOCATION_C_LEFT[-1]) # GPL_Lefty
922927

923928
# Move to test location
924929
await self.robot.move(self.TEST_LOCATION_ID, self.TEST_PROFILE_ID)
@@ -947,7 +952,7 @@ async def test_move_appro(self) -> None:
947952
test_z_clearance = 20
948953

949954
# Save test location & z clearance
950-
await self.robot.set_location_angles(self.TEST_LOCATION_ID, *self.TEST_LOCATION_J_LEFT)
955+
await self.robot.set_location_xyz(self.TEST_LOCATION_ID, *self.TEST_LOCATION_C_LEFT[:-1])
951956
await self.robot.set_location_z_clearance(self.TEST_LOCATION_ID, test_z_clearance)
952957

953958
# Move to test location with approach
@@ -1540,14 +1545,14 @@ async def test_set_station_type(self) -> None:
15401545
await self.robot.set_station_type(self.TEST_LOCATION_ID, 0, 3, 50.0, 10.0, 0.0)
15411546

15421547
#region SSGRIP COMMANDS
1543-
async def test_home_all_if_no_plate(self) -> None:
1544-
"""Test home_all_if_no_plate()"""
1545-
result = await self.robot.home_all_if_no_plate()
1546-
self.assertIsInstance(result, int)
1547-
self.assertIn(result, [-1, 0])
1548-
1549-
result_str = "no plate detected and command succeeded" if result == -1 else "plate detected"
1550-
print(f"Home all if no plate result: {result} ({result_str})")
1548+
# async def test_home_all_if_no_plate(self) -> None: # commented out because it messes up other tests
1549+
# """Test home_all_if_no_plate()"""
1550+
# result = await self.robot.home_all_if_no_plate()
1551+
# self.assertIsInstance(result, int)
1552+
# self.assertIn(result, [-1, 0])
1553+
1554+
# result_str = "no plate detected and command succeeded" if result == -1 else "plate detected"
1555+
# print(f"Home all if no plate result: {result} ({result_str})")
15511556

15521557
async def test_grasp_plate(self) -> None:
15531558
"""Test grasp_plate()"""

0 commit comments

Comments
 (0)