Giter Site home page Giter Site logo

smarpod-ophyd's People

Contributors

bsh90 avatar whs92 avatar

Watchers

 avatar  avatar

smarpod-ophyd's Issues

Ensure that the device is "Readable"

There are only really two requirements from Bluesky for the devices that it interacts with.

  1. That they are readable
  2. Optionally that if we want to set them that they are settable

In this issue we will work on the first point that it is readable. Most of this is already achieved by using either the Device or Signal base classes.

You should check that you can call the following methods on the device you create and that they perform as stipulated in the definition of readable

hexapod_ro = SmarSignalRO(name='hexapod')

#Return an OrderedDict with exactly the same keys as the read method, here mapped to metadata about each field.
hexapod_ro.describe()

#Same API as describe, but corresponding to the keys in read_configuration.
hexapod_ro.describe_configuration

#Return an OrderedDict mapping field name(s) to values and timestamps.
hexapod_ro.read()

#In our case same as above
hexapod_ro.read_configuration()

#Should immediately return a status object that is done
hexapod_ro.trigger()

Device should connect on instantiation

When we instantiate a signal it should make the connection to the physical device and then maintain that connection.

For example connecting to a simluatled axis:

from ophyd.sim import SynAxis
sim_motor_axis = SynAxis(name='m1' )

or a real axis:

from ophyd import EpicsMotor
epics_motor_axis = EpicsMotor('PREFIX', name='m1' )

We can then use these instantiated devices repeatedly later in the application. We might do something like:

epics_motor_axis.move(10)
epics_motor_axis.read()

Using with constrains the context of the device to the with statement. I can see (I think) why you have used it because it allows you to kind of seperate out each test.

Aim/Requirement

We need to be able to make repeated calls to the set() and get() methods outisde of the context of a with statement.

Suggested change

I am not 100% sure but I think you need to put the connection stuff into __init__ maybe like:

class SmarSignalRO(Signal):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.smarpod_object = SmarPod()
        self.handle = self.smarpod_object.set_up()

    def get(self):
        pose = smarpod.GetPose(self.handle)
        return self.smarpod_object.pose_to_double_list(pose)

#instantiate
 hexapod_ro = SmarSignalRO(name='hexapod')

#run a number of times:
 for i in range(10):
    print(hexapod_ro.get())

Without __enter__ and __exit__ we are not going to call teardown() but that's ok because teardown just releases the connection to the device. The only time we want to do that is when we exit the program. The connection should be made once at the start and maintained throughout the measurement session.

Allow axes to be controlled independently, but not simultaneously

During commissioning we might want to scan a single axis to find the optimal position. To do that we will want to be able to set the position of just one axes, and not a Pose object.

ideally we would create a device with components of the axes, but individual axes are also sufficient.

We can restrict ourselves to only ever either:

  1. Move one axes at any one time
  2. Move all the axes (set a pose)

EPICS Control: Create class that exposes control of smarpod over EPICS

I would like to be able to control the hexapod over channel access. I propose to use https://dls-controls.github.io/pythonSoftIOC/master/index.html to achieve this.

I would like a class which:

  • takes an argument of prefix which will be added to the start of all PV's
  • creates PV's for readback and setpoint of each of the 6 axes in the hexapod
  • creates a PV for done which is asserted when any move is requested, even if no move is performed, and then goes to 0 when the move is complete
  • creates a PV called moveImmediately which if asserted will move the hexapod to a new pose as soon as a single axis setpoint is changed. The new pose should be formed from the new value of the requested axis, plus the existing setpoints of all other axes.
  • creates a PV called startMove which if moveImmediately == 0 will start a move taking the values of the setpoints of all of the axes.
  • creates a PV called status which will hold string messages reporting a problem if the reqested pose is not reachable
  • creates a PV called startHome which when asserted performs a home/alignment procedure. the done PV should be set to 0 and then 1 when the motion is complete
  • creates a PV called stop which when assert
  • Opens a connection to the smarpod when class is instantiated. Connection should be maintained while instance of class exists.
  • Reads the position of the hexapod every 0.1 seconds and updates the readback PV's of each axis
  • Checks whether a particular requested pose is reachable. If not, write to status PV
  • If pose is reachable performs move and updates done PV accordingly.

hexapod

hexapod_flow

Ensure that the device is "Settable"

The second part of #2 is to confirm that the device is settable

The documentation states that there should be a parameter called position but I am not sure this is really important. The important part is that you confirm that the device returns a status object that changes to done when it's finished moving.

You have already implemented and tested this for your device, but I wanted to write the issue so you better understood where the requirement came from.

Additionally you will need to check that any furture implementation conforms to this requirement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.