Controller API reference
Controller
- Base API for all controller types
MotorController
- Motor controller API
CounterTimerController
- Counter/Timer controller API
ZeroDController
- 0D controller API
PseudoMotorController
- PseudoMotor controller API
PseudoCounterController
- PseudoCounter controller API
TriggerGateController
- Trigger/Gate controller API
IORegisterController
- IORegister controller API
Data Type definition
When writing a new controller you may need to specify extra attributes (per
controller or/and per axis) as well as extra properties. This chapter describes
how to describe the data type for each of this additional members.
Controller data type definition has the following equivalences. This means you
can use any of the given possibilities to describe a field data type. The
possibilities are ordered by preference (example: usage of int
is
preferred to “int” or “PyTango.DevLong”):
- for 0D data types:
integer:
int
|DataType.Integer
| “int” | “integer” | “long” |long
| [ “PyTango.” ] “DevLong”double:
float
|DataType.Double
| “double” | “float” | [ “PyTango.” ] “DevDouble”string:
str
|DataType.String
| “str” | “string” | [ “PyTango.” ] “DevString”boolean:
bool
|DataType.Boolean
| “bool” | “boolean” | [ “PyTango.” ] “DevBoolean”
- for 1D data types:
integer: (
int
,) | (DataType.Integer
,) | (“int”,) | (“integer”,) | (long
,) | (“long”,) | [ “PyTango.” ] “DevVarLongArray” | ([ “PyTango.” ] “DevLong”,)double: (
float
,) | (DataType.Double
,) | (“double”,) | (“float”,) | [ “PyTango.” ] “DevVarDoubleArray” | ([ “PyTango.” ] “DevDouble”,)string: (
str
,) | (DataType.String
,) | (“str”,) | (“string”,) | [ “PyTango.” ] “DevVarStringArray” | ([ “PyTango.” ] “DevString”,)boolean: (
bool
,) | (DataType.Boolean
,) | (“bool”,) | (“boolean”,) | [ “PyTango.” ] “DevVarBooleanArray” | ([ “PyTango.” ] “DevBoolean”,)
Deprecated since version 1.0: [ “PyTango.” ] “Dev”<concrete type string> types are considered deprecated.
Note
when string, types are case insensitive. This means “long” is the same as “LONG”
Here is an example on how to define extra attributes per axis:
EncoderSource: a scalar r/w string
ReflectionMatrix: a 2D readable float with customized getter method
from sardana import State, DataAccess
from sardana.pool.controller import MotorController, \
Type, Description, DefaultValue, Access, FGet, FSet
class MyMotorCtrl(MotorController):
axis_attributes = \
{
'EncoderSource' : { Type : str,
Description : 'motor encoder source', },
'ReflectionMatrix' : { Type : ( (float,), ),
Access : DataAccess.ReadOnly,
FGet : 'getReflectionMatrix', },
}
def getAxisExtraPar(self, axis, name):
name = name.lower()
if name == 'encodersource':
return self._encodersource[axis]
def setAxisPar(self, axis, name, value):
name = name.lower()
if name == 'encodersource':
self._encodersource[axis] = value
def getReflectionMatrix(self, axis):
return ( (1.0, 0.0), (0.0, 1.0) )