Skip to content

Commit

Permalink
include go_to_x_y to jump to given x,y coord; add convert_um_to_bits …
Browse files Browse the repository at this point in the history
…to do just that; convert um to bits within line, jump and arc.
  • Loading branch information
co2e14 committed Dec 18, 2024
1 parent 6a54097 commit 858ca1d
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/rtc6_fastcs/plan_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,33 @@
from dodal.common.beamlines.beamline_utils import device_factory
from bluesky.run_engine import call_in_bluesky_event_loop

def convert_um_to_bits(um_in: int) -> int:
"""RTC operates in bits. Convert um to bits for drawing"""
bits_per_um = 33 # estimated
return int(um_in * bits_per_um)

def line(rtc6: Rtc6Eth, x: int, y: int):
"""add an instruction to draw a line to x, y"""
x = convert_um_to_bits(x)
y = convert_um_to_bits(y)
yield from bps.abs_set(rtc6.list.add_line.x, x, wait=True)
yield from bps.abs_set(rtc6.list.add_line.y, y, wait=True)
yield from bps.trigger(rtc6.list.add_line.proc, wait=True)


def jump(rtc6: Rtc6Eth, x: int, y: int):
"""add an instruction to jump to x, y"""
x = convert_um_to_bits(x)
y = convert_um_to_bits(y)
yield from bps.abs_set(rtc6.list.add_jump.x, x, wait=True)
yield from bps.abs_set(rtc6.list.add_jump.y, y, wait=True)
yield from bps.trigger(rtc6.list.add_jump.proc, wait=True)


def arc(rtc6: Rtc6Eth, x: int, y: int, angle_deg: float):
"""add an instruction to jump to x, y"""
x = convert_um_to_bits(x)
y = convert_um_to_bits(y)
yield from bps.abs_set(rtc6.list.add_arc.x, x, wait=True)
yield from bps.abs_set(rtc6.list.add_arc.y, y, wait=True)
yield from bps.abs_set(rtc6.list.add_arc.angle_deg, angle_deg, wait=True)
Expand Down Expand Up @@ -82,18 +92,14 @@ def go_to_home(rtc6: Rtc6Eth):
yield from jump(rtc6, 0, 0)
yield from bps.trigger(rtc6)


# standard shapes


def omega_sphere_100um():
pass
# todo

@bpp.run_decorator()
def go_to_x_y(rtc6: Rtc6Eth, x: int, y: int):
yield from bps.stage(rtc6)
yield from jump(rtc6, x, y)
yield from bps.trigger(rtc6)

# For BlueAPI


@device_factory()
def create_rtc_device() -> Rtc6Eth:
r = Rtc6Eth()
Expand Down

0 comments on commit 858ca1d

Please sign in to comment.