bsh90 / smarpod-ophyd Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
There are only really two requirements from Bluesky for the devices that it interacts with.
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()
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.
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:
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:
prefix
which will be added to the start of all PV'sdone
which is asserted when any move is requested, even if no move is performed, and then goes to 0 when the move is completemoveImmediately
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.startMove
which if moveImmediately
== 0 will start a move taking the values of the setpoints of all of the axes.status
which will hold string messages reporting a problem if the reqested pose is not reachablestartHome
which when asserted performs a home/alignment procedure. the done
PV should be set to 0 and then 1 when the motion is completestop
which when assertstatus
PVThe 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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.