MotionGroupConfig
- class bapsf_motion.actors.motion_group_.MotionGroupConfig(config: str | Dict[str, Any], logger: Logger = None)
Bases:
UserDictA dictionary containing the full configuration for a motion group.
At instantiation the class will take either a TOML-like string or dictionary defining a motion group configuration. The class will validate this input configuration, convert it to a viable dictionary configuration, and poses it as
self.- Parameters:
config (
strordict) – A TOML like string or dictionary defining the motion group configuration. See examples section below for additional details.
Examples
The following example shows how a typical XY probe drive on an East port of the LaPD could be configured using either a TOML-like string or a dictionary. Note, values used are not necessarily appropriate for a real world setup.
[motion_group] name = "P32 XY-drive" # unique name of motion group [motion_group.drive] # define the makeup of the probe drive name = "XY-drive" # name of probe drive # # setup first axis axes.0.name = "X" # name of axis axes.0.ip = "192.168.6.103" # ip address of motor axes.0.units = "cm" # unit type used for axis axes.0.units_per_rev = 0.254 # thread pitch of rod # # setup second axis axes.1.name = "Y" axes.1.ip = "192.168.6.104" axes.1.units = "cm" axes.1.units_per_rev = 0.254 [motion_group.motion_builder] # configuration for the motion builder # # 'space' defines the motion space # - motion space is the "volume" in which the motion will # occur in # - these axes correspond to the same 0 and 1 axes of the # motion_group.drive.axes configuration space.0.label = "X" space.0.range = [-55, 55] space.0.num = 221 space.1.label = "Y" space.1.range = [-55, 55] space.1.num = 221 # # exclusion defines regions in space where a probe can NOT go # - exclusion entries should be numbered starting with 0 since # complex exclusions can be construction from multiple # exclusion layers # - an exclusion always requires the 'type' parameter, but # the subsequent required parameters depend on that type # - See online documentation for available exclusion layers. exclusions.0.type = "lapd_xy" exclusions.0.port_location = "E" exclusions.0.cone_full_angle = 60 # # layers define the points where a probe should move to # - the example given defines a grid of points with 11 # locations along the 1st axis from 0 to 30, and 21 # locations along the 2nd axis from -30 to 30 # - layer entries should be numbered starting with 0 since # complex point layers can be construction from multiple # point layers # - a layer always requires the 'type' parameter, but # the subsequent required parameters depend on that type # - See online documentation for available point layers. layers.0.type = "grid" layers.0.limits = [[0, 30], [-30, 30]] layers.0.steps = [11, 21] [motion_group.transform] # define the coordinate transformation between the physical # coordinate system, a.k.a. motion space, (e.g. the LaPD) and # the probe drive axes # - a transform always requires the 'type' parameter, but # the subsequent required parameters depend on that type # - See online documentation for available point layers. type = "lapd_xy" pivot_to_center = 57.7 pivot_to_drive = 125 porbe_axis_offset = 6
# Look to the TOML tab for descriptions of each entry config = { "name": "P32 XY-Drive", "drive": { "name": "XY-Drive", "axes": { 0: { "name": "X", "ip": "192.168.6.103", "units": "cm", "units_per_rev": .254, }, 1: { "name": "Y", "ip": "192.168.6.104", "units": "cm", "units_per_rev": .254, }, }, }, "motion_builder": { "space", { 0: { "label": "X", "range": [-55, 55], "num:: 221, }, 1: { "label": "X", "range": [-55, 55], "num:: 221, }, }, "exclusion": { "0": { "type": "lapd_xy", "port_location": "E", "cone_full_angle": 60, }, }, "layer": { "0": { "type": "grid", "limits": [[0, 30], [-30, 30]], "steps": [11, 21], }, }, }, "transform": { "type": "lapd_xy", "pivot_to_center": 57.7, "pivot_to_drive": 125, "porbe_axis_offset": 6, }, }
Attributes Summary
A real dictionary used to store the contents of
MotionGroupConfig.Methods Summary
clear()copy()fromkeys(iterable[, value])get(k[,d])items()keys()link_drive(drive)Link the 'drive' configuration component to an instance of
Drive.Link the 'motion_builder' configuration component to an instance of
MotionBuilder.link_transform(tr)Link the 'transform' configuration component to an instance of a subclass of
BaseTransform.pop(k[,d])value.
popitem()as a 2-tuple; but raise KeyError if D is empty.
setdefault(k[,d])Unlink the 'drive' configuration component from the linked instance of
Drive.update([E, ]**F)If E present and has a .keys() method, does:
values()Attributes Documentation
- as_toml_string
- data
A real dictionary used to store the contents of
MotionGroupConfig.
Methods Documentation
- clear() None. Remove all items from D.
- copy()
- classmethod fromkeys(iterable, value=None)
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- link_drive(drive: Drive)
Link the ‘drive’ configuration component to an instance of
Drive. The ‘drive’ configuration component will now be pulled from theconfigproperty ofDrive.
- link_motion_builder(mb: MotionBuilder)
Link the ‘motion_builder’ configuration component to an instance of
MotionBuilder. The ‘motion_builder’ configuration component will now be pulled from theconfigproperty ofMotionBuilder.
- link_transform(tr: BaseTransform)
Link the ‘transform’ configuration component to an instance of a subclass of
BaseTransform. The ‘transform’ configuration component will now be pulled from theconfigproperty of that transform instance.
- pop(k[, d]) v, remove specified key and return the corresponding
value. If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- unlink_drive()
Unlink the ‘drive’ configuration component from the linked instance of
Drive. The configuration component is now an emptydict.
- unlink_motion_builder()
- unlink_transform()
- update([E, ]**F) None. Update D from mapping/iterable E and F.
- If E present and has a .keys() method, does:
for k in E.keys(): D[k] = E[k]
- If E present and lacks .keys() method, does:
for (k, v) in E: D[k] = v
- In either case, this is followed by:
for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values