Commit 585f099a authored by Михеев Никита Глебович's avatar Михеев Никита Глебович
Browse files

Dynamic step resolution added.

parent e180d996
Showing with 8 additions and 6 deletions
+8 -6
......@@ -10,12 +10,6 @@ class Actuator():
self._device_id = None
self._unit_converter = None
# one rotation = 200 steps = 360 degrees
step_to_degr_conversion_coeff = 360.0/200
self._unit_converter = ximc.calibration_t()
self._unit_converter.MicrostepMode = ximc.MicrostepMode.MICROSTEP_MODE_FRAC_256
self._unit_converter.A = step_to_degr_conversion_coeff
def connect(self):
self._device_id = ximc.lib.open_device(self._device_uri.encode())
......@@ -24,6 +18,14 @@ class Actuator():
else:
raise RuntimeError("Failed to open device with URI", self._device_uri)
# One turn = 200 steps = 360 degrees
engine_settings = ximc.engine_settings_t()
ximc.lib.get_engine_settings(self._device_id, byref(engine_settings))
step_to_degr_conversion_coeff = 360.0 / engine_settings.StepsPerRev
self._unit_converter = ximc.calibration_t()
self._unit_converter.MicrostepMode = ximc.MicrostepMode.MICROSTEP_MODE_FRAC_256
self._unit_converter.A = step_to_degr_conversion_coeff
def disconnect(self):
ximc.lib.close_device(byref(c_int(self._device_id)))
......
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