Commit 95b8c7da authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by bliss administrator
Browse files

Emotion: refactor variables in Axis.prepare_move

parent 51934e36
...@@ -645,20 +645,19 @@ class Axis(object): ...@@ -645,20 +645,19 @@ class Axis(object):
def prepare_move(self, user_target_pos, relative=False): def prepare_move(self, user_target_pos, relative=False):
"""Prepare a motion. Internal usage only""" """Prepare a motion. Internal usage only"""
elog.debug("user_target_pos=%g, relative=%r" % (user_target_pos, relative)) elog.debug("user_target_pos=%g, relative=%r" % (user_target_pos, relative))
user_initial_dial_pos = self.dial() dial_initial_pos = self.dial()
hw_pos = self._read_dial_and_update() hw_pos = self._read_dial_and_update()
elog.debug("hw_position=%g user_initial_dial_pos=%g" % (hw_pos, user_initial_dial_pos)) elog.debug("hw_position=%g dial_initial_pos=%g" % (hw_pos, dial_initial_pos))
if abs(user_initial_dial_pos - hw_pos) > self.tolerance: if abs(dial_initial_pos - hw_pos) > self.tolerance:
raise RuntimeError( raise RuntimeError(
"%s: discrepancy between dial (%f) and controller position (%f), aborting" % ( "%s: discrepancy between dial (%f) and controller position (%f), aborting" % (, user_initial_dial_pos, hw_pos)), dial_initial_pos, hw_pos))
if relative: if relative:
user_target_pos += self._set_position() user_target_pos += self._set_position()
user_initial_pos = self.dial2user(user_initial_dial_pos) user_initial_pos = self.dial2user(dial_initial_pos)
dial_initial_pos = self.user2dial(user_initial_pos)
dial_target_pos = self.user2dial(user_target_pos) dial_target_pos = self.user2dial(user_target_pos)
self._set_position(user_target_pos) self._set_position(user_target_pos)
if abs(dial_target_pos - dial_initial_pos) < 1E-6: if abs(dial_target_pos - dial_initial_pos) < 1E-6:
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