Skip to content

Commit

Permalink
remove UpdatingAttrRW
Browse files Browse the repository at this point in the history
  • Loading branch information
co2e14 committed Dec 10, 2024
1 parent 11d1e9d commit 6ac6fd6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
41 changes: 8 additions & 33 deletions src/rtc6_fastcs/controller/rtc_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@
LOGGER = logging.getLogger(__name__)


class UpdatingAttrRW(AttrRW):
"""This is only necessary due to https://github.com/DiamondLightSource/FastCS/issues/101 and should be removed when the correct solution it known"""

def __init__(
self,
datatype: DataType,
access_mode=AttrMode.READ_WRITE,
group: str | None = None,
handler: Handler | None = None,
initial_value: Any | None = None,
allowed_values: list | None = None,
description: str | None = None,
) -> None:
super().__init__(
datatype,
access_mode,
group,
handler,
initial_value,
allowed_values,
description,
)
self.set_process_callback(self.set)


class ConnectedSubController(SubController):
def __init__(self, conn: RtcConnection) -> None:
super().__init__()
Expand Down Expand Up @@ -144,7 +119,7 @@ def correct_xy(self, x: int, y: int) -> tuple[int, int]:
"""Correct for transformations in the laser / oav optics"""
print(f"Correcting {(x,y)} by {self.coordinate_correction_matrix}")
corrected = np.matmul(self.coordinate_correction_matrix, [x, y])
as_ints = (int(corrected[0]), int(corrected[1]))
as_ints = (int(corrected[0]), int(corrected[1]))
print(f"Result: {corrected} => {as_ints}")
return as_ints

Expand All @@ -153,8 +128,8 @@ class RtcListOperations(XYCorrectedConnectedSubController):
list_pointer_position = AttrR(Int(), group="ListInfo")

class AddJump(XYCorrectedConnectedSubController):
x = UpdatingAttrRW(Int(), group="ListOps")
y = UpdatingAttrRW(Int(), group="ListOps")
x = AttrRW(Int(), group="ListOps")
y = AttrRW(Int(), group="ListOps")

@command(group="ListOps")
async def proc(self):
Expand All @@ -163,9 +138,9 @@ async def proc(self):
bindings.add_jump_to(x, y)

class AddArc(XYCorrectedConnectedSubController):
x = UpdatingAttrRW(Int(), group="ListOps")
y = UpdatingAttrRW(Int(), group="ListOps")
angle = UpdatingAttrRW(Float(), group="ListOps")
x = AttrRW(Int(), group="ListOps")
y = AttrRW(Int(), group="ListOps")
angle = AttrRW(Float(), group="ListOps")

@command()
async def proc(self):
Expand All @@ -174,8 +149,8 @@ async def proc(self):
bindings.add_arc_to(x, y, self.angle.get())

class AddLine(XYCorrectedConnectedSubController):
x = UpdatingAttrRW(Int(), group="ListOps")
y = UpdatingAttrRW(Int(), group="ListOps")
x = AttrRW(Int(), group="ListOps")
y = AttrRW(Int(), group="ListOps")

@command()
async def proc(self):
Expand Down
2 changes: 0 additions & 2 deletions src/rtc6_fastcs/plan_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def draw_polygon(rtc6: Rtc6Eth, points: list[LineInput]):
yield from bps.trigger(rtc6)



@bpp.run_decorator
def draw_polygon_with_arcs(rtc6: Rtc6Eth, points: list[LineInput | ArcInput]):
yield from bps.stage(rtc6)
Expand All @@ -67,4 +66,3 @@ def draw_polygon_with_arcs(rtc6: Rtc6Eth, points: list[LineInput | ArcInput]):
else:
yield from arc(rtc6, *point)
yield from bps.trigger(rtc6)

0 comments on commit 6ac6fd6

Please sign in to comment.