Commit b2dee87d authored by Cyril Guilloud's avatar Cyril Guilloud
Browse files

tab2 calc controller + schema

tab2 is derived from tabsup
parent 9da5a158
"""
2 legs table
* 2 legs : back & front
* 2 degrees of freedom : rotation and translation
Configuration parameters:
* <back> : alias for real back leg axis
* <front> : alias for real front leg axis
* <ttrans> : Y-axis translation calculated axis alias
* <trot> : Z-axis rotation calculated axis alias (in degrees)
* <d1> : distance from front leg to sample
* [<d2> : distance from sample to back leg]
See sphinx documentation for a nice schema.
tests ??
"""
from bliss.controllers.motor import CalcController
import math
class tabsup(CalcController):
def __init__(self, *args, **kwargs):
CalcController.__init__(self, *args, **kwargs)
self.d1 = self.config.get("d1", float)
try:
self.d2 = self.config.get("d2", float)
except KeyError:
self.d2 = self.d1
def calc_from_real(self, positions_dict):
tyf = float(positions_dict["front"])
tyb = float(positions_dict["back"])
return {"ttrans": (self.d1 * tyb + self.d2 * tyf) / (self.d1 + self.d2),
"trot": math.degrees(math.atan((tyf - tyb) / (self.d1 + self.d2)))}
def calc_to_real(self, positions_dict):
ttrans = positions_dict["ttrans"]
trot = positions_dict["trot"]
return {"back": ttrans + self.d2*math.tan(math.radians(trot)),
"front": ttrans - self.d1*math.tan(math.radians(trot))}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment