Skip to content

Commit c57a324

Browse files
committed
scara
1 parent 8abf182 commit c57a324

File tree

8 files changed

+97
-155
lines changed

8 files changed

+97
-155
lines changed

pylabrobot/arms/arm.py

Lines changed: 0 additions & 89 deletions
This file was deleted.

pylabrobot/arms/backend.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from dataclasses import dataclass
33
from typing import List, Optional, Union
44

5-
from pylabrobot.arms.precise_flex.coords import CartesianCoords
5+
from pylabrobot.arms.precise_flex.coords import PreciseFlexCartesianCoords
66
from pylabrobot.arms.standard import JointCoords
77
from pylabrobot.machines.backend import MachineBackend
88

@@ -55,7 +55,7 @@ class HorizontalAccess:
5555
AccessPattern = Union[VerticalAccess, HorizontalAccess]
5656

5757

58-
class ArmBackend(MachineBackend, metaclass=ABCMeta):
58+
class SCARABackend(MachineBackend, metaclass=ABCMeta):
5959
"""Backend for a robotic arm"""
6060

6161
@abstractmethod
@@ -90,7 +90,9 @@ async def move_to_safe(self):
9090

9191
@abstractmethod
9292
async def approach(
93-
self, position: Union[CartesianCoords, JointCoords], access: Optional[AccessPattern] = None
93+
self,
94+
position: Union[PreciseFlexCartesianCoords, JointCoords],
95+
access: Optional[AccessPattern] = None,
9496
):
9597
"""Move the arm to an approach position (offset from target).
9698
@@ -103,7 +105,9 @@ async def approach(
103105

104106
@abstractmethod
105107
async def pick_plate(
106-
self, position: Union[CartesianCoords, JointCoords], access: Optional[AccessPattern] = None
108+
self,
109+
position: Union[PreciseFlexCartesianCoords, JointCoords],
110+
access: Optional[AccessPattern] = None,
107111
):
108112
"""Pick a plate from the specified position.
109113
@@ -116,7 +120,9 @@ async def pick_plate(
116120

117121
@abstractmethod
118122
async def place_plate(
119-
self, position: Union[CartesianCoords, JointCoords], access: Optional[AccessPattern] = None
123+
self,
124+
position: Union[PreciseFlexCartesianCoords, JointCoords],
125+
access: Optional[AccessPattern] = None,
120126
):
121127
"""Place a plate at the specified position.
122128
@@ -128,7 +134,7 @@ async def place_plate(
128134
...
129135

130136
@abstractmethod
131-
async def move_to(self, position: Union[CartesianCoords, JointCoords]):
137+
async def move_to(self, position: Union[PreciseFlexCartesianCoords, JointCoords]):
132138
"""Move the arm to a specified position in 3D space."""
133139
...
134140

@@ -138,6 +144,6 @@ async def get_joint_position(self) -> JointCoords:
138144
...
139145

140146
@abstractmethod
141-
async def get_cartesian_position(self) -> CartesianCoords:
147+
async def get_cartesian_position(self) -> PreciseFlexCartesianCoords:
142148
"""Get the current position of the arm in 3D space."""
143149
...

pylabrobot/arms/precise_flex/coords.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from enum import Enum
33
from typing import Optional
44

5-
from pylabrobot.resources import Coordinate, Rotation
5+
from pylabrobot.arms.standard import CartesianCoords
66

77

88
class ElbowOrientation(Enum):
@@ -11,7 +11,5 @@ class ElbowOrientation(Enum):
1111

1212

1313
@dataclass
14-
class CartesianCoords:
15-
location: Coordinate
16-
rotation: Rotation
14+
class PreciseFlexCartesianCoords(CartesianCoords):
1715
orientation: Optional[ElbowOrientation] = None

pylabrobot/arms/precise_flex/pf_3400.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@ def convert_to_joint_space(self, position: List[float]) -> PreciseFlexJointCoord
1515
if len(position) != 6:
1616
raise ValueError("Position must be a tuple of 6 joint angles.")
1717
return PreciseFlexJointCoords(
18-
0, position[0], position[1], position[2], position[3], position[4]
18+
rail=0,
19+
base=position[0],
20+
shoulder=position[1],
21+
elbow=position[2],
22+
wrist=position[3],
23+
gripper=position[4],
1924
)
2025

21-
def convert_to_joints_array(self, position: PreciseFlexJointCoords) -> List[float]:
22-
"""Convert a JointSpace object to a list of joint angles."""
23-
return [
24-
position.base,
25-
position.shoulder,
26-
position.elbow,
27-
position.wrist,
28-
position.gripper,
29-
0,
30-
] # PF400 has 5 joints, last is fixed
26+
# def convert_to_joints_array(self, position: PreciseFlexJointCoords) -> List[float]:
27+
# """Convert a JointSpace object to a list of joint angles."""
28+
# return [
29+
# 0,
30+
# position.base,
31+
# position.shoulder,
32+
# position.elbow,
33+
# position.wrist,
34+
# position.gripper,
35+
# ] # PF400 has 5 joints, last is fixed

pylabrobot/arms/precise_flex/pf_400.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ def convert_to_joint_space(self, position: List[float]) -> PreciseFlexJointCoord
1414
"""Convert a list of joint angles to a PreciseFlexJointCoords object."""
1515
if len(position) != 6:
1616
raise ValueError("Position must be a list of 6 joint angles.")
17-
return PreciseFlexJointCoords(0, position[0], position[1], position[2], position[3], 0)
17+
return PreciseFlexJointCoords(
18+
rail=0,
19+
base=position[0],
20+
shoulder=position[1],
21+
elbow=position[2],
22+
wrist=position[3],
23+
gripper=0,
24+
)
1825

19-
def convert_to_joints_array(self, position: PreciseFlexJointCoords) -> List[float]:
20-
"""Convert a PreciseFlexJointCoords object to a list of joint angles."""
21-
return [
22-
position.base,
23-
position.shoulder,
24-
position.elbow,
25-
position.wrist,
26-
0,
27-
0,
28-
] # PF400 has 4 joints, last two are fixed
26+
# def convert_to_joints_array(self, position: PreciseFlexJointCoords) -> List[float]:
27+
# """Convert a PreciseFlexJointCoords object to a list of joint angles."""
28+
# return [
29+
# 0,
30+
# position.base,
31+
# position.shoulder,
32+
# position.elbow,
33+
# position.wrist,
34+
# 0,
35+
# ] # PF400 has 4 joints, last two are fixed

0 commit comments

Comments
 (0)