Commit 78a6cee0 authored by Cyril Guilloud's avatar Cyril Guilloud

new comments

adapted velocity to new style
parent 270b38b8
......@@ -46,10 +46,10 @@ class FlexDC(Controller):
# ( 1 -> repetitive motion )
print self._flexdc_query("%sSM=0"%axis.channel)
# Defines smoothing 4
# Defines smoothing 4.
print self._flexdc_query("%sWW=4"%axis.channel)
# Check if closed loop parameters have been set
# Checks if closed loop parameters have been set.
_ans = self._flexdc_query("%sTT"%axis.channel)
if _ans == "0":
print "Missing closed loop param TT (Target Time)!!"
......@@ -65,8 +65,12 @@ class FlexDC(Controller):
return _pos
def read_velocity(self, axis):
_velocity = self._flexdc_query("%sSP"%axis.channel)
def velocity(self, axis, new_velocity=None):
if new_velocity:
self._flexdc_query("%sSP=%d"%(axis.channel, new_velocity))
else:
_velocity = self._flexdc_query("%sSP"%axis.channel)
return _velocity
......
......@@ -19,6 +19,8 @@ class Mockup(Controller):
self.axis_settings.add('init_count', int)
'''
'''
def initialize(self):
# hardware initialization
for axis_name, axis in self.axes.iteritems():
......@@ -27,6 +29,8 @@ class Mockup(Controller):
axis.settings.set('velocity', axis.config.get("velocity", float))
'''
'''
def initialize_axis(self, axis):
self._axis_moves[axis] = { "end_t": 0, "end_pos": random.randint(0,360) }
......@@ -34,6 +38,8 @@ class Mockup(Controller):
axis.settings.set('init_count', axis.settings.get('init_count')+1)
'''
'''
def start_move(self, axis, target_pos, delta):
t0 = time.time()
pos = self.read_position(axis)
......@@ -45,7 +51,8 @@ class Mockup(Controller):
"t0": t0 }
'''
'''
def read_position(self, axis, measured=False):
if self._axis_moves[axis]["end_t"]:
# motor is moving
......@@ -59,11 +66,18 @@ class Mockup(Controller):
return self._axis_moves[axis]["end_pos"]
'''
'''
def velocity(self, axis, new_velocity=None):
if new_velocity != None:
if new_velocity:
axis.settings.set('velocity', new_velocity)
# Always return velocity.
return axis.settings.get('velocity')
'''
'''
def read_state(self, axis):
if self._axis_moves[axis]["end_t"] > time.time():
return MOVING
......@@ -71,6 +85,11 @@ class Mockup(Controller):
self._axis_moves[axis]["end_t"]=0
return READY
'''
'''
def stop(self, axis):
self._axis_moves[axis]["end_pos"]=self.read_position(axis)
self._axis_moves[axis]["end_t"]=0
......@@ -44,7 +44,7 @@ class TestFlexDCController(unittest.TestCase):
fd = bliss.get_axis("fd")
print "FlexDC ID :", fd.controller._get_id(fd.channel)
def test_get_velocity(self):
def test_velocity(self):
fd = bliss.get_axis("fd")
print "FlexDC valocity :", fd.velocity()
......
Markdown is supported
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