Motion

class ingeniamotion.motion.Motion(motion_controller)

Motion.

current_direct_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)

Given a target value and a time in seconds, changes the current direct set-point linearly following a ramp. This function is blocked until target reached.

Parameters
  • target_value (float) – target value of the ramp.

  • time_s (float) – duration of the ramp, in seconds.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • init_value (float) – initial value of the ramp. 0 by default.

  • interval (float) – time interval between register writes, in seconds. None by default, no interval.

current_quadrature_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)

Given a target value and a time in seconds, changes the current quadrature set-point linearly following a ramp. This function is blocked until target reached.

Parameters
  • target_value (float) – target value of the ramp.

  • time_s (float) – duration of the ramp, in seconds.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • init_value (float) – initial value of the ramp. 0 by default.

  • interval (float) – time interval between register writes, in seconds. None by default, no interval.

fault_reset(servo='default', axis=1)

Fault reset.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

get_actual_position(servo='default', axis=1)

Returns actual position register.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

Returns

actual position value

Return type

int

get_actual_velocity(servo='default', axis=1)

Returns actual velocity register.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

Returns

actual velocity value

Return type

int

get_operation_mode(servo='default', axis=1)

Return current operation mode.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

Returns

Return current operation mode.

Return type

OperationMode

internal_generator_constant_move(offset, servo='default', axis=1)

Move motor in internal generator configuration with generator mode constant.

Parameters
  • offset (int) – internal generator offset.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

internal_generator_saw_tooth_move(direction, cycles, frequency, servo='default', axis=1)

Move motor in internal generator configuration with generator mode saw tooth.

Parameters
  • direction (int) – 1 for positive direction and -1 for negative direction.

  • cycles (int) – movement cycles.

  • frequency (int) – cycles for second.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

motor_disable(servo='default', axis=1)

Disable motor.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

motor_enable(servo='default', axis=1)

Enable motor.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

move_to_position(position, servo='default', axis=1, target_latch=True, blocking=False)

Set position set point to a target servo and axis, in counts.

Parameters
  • position (int) – target position, in counts.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • target_latch (bool) – if True does target latch at the end. True by default.

  • blocking (bool) – if True, the function is blocked until the target position is reached. False by default.

set_current_direct(current, servo='default', axis=1)

Set direct current set point to a target servo and axis, in A.

Parameters
  • current (float) – target direct current, in A.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

set_current_quadrature(current, servo='default', axis=1)

Set quadrature current set point to a target servo and axis, in A.

Parameters
  • current (float) – target quadrature current, in A.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

set_internal_generator_configuration(op_mode, servo='default', axis=1)

Set internal generator configuration.

Note

This functions affects the following drive registers: motor pair poles, operation mode, phasing mode and commutation feedback. This is an advanced-user oriented method, you could lose your drive configuration, use it at your own risk.

Parameters
  • op_mode (OperationMode) – select Current or Voltage operation mode for internal generator configuration.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

set_operation_mode(operation_mode, servo='default', axis=1)

Set operation mode to a target servo and axis.

Parameters
  • operation_mode (OperationMode) – operation mode, any of OperationMode.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

set_velocity(velocity, servo='default', axis=1, target_latch=True, blocking=False)

Set velocity set point to a target servo and axis, in rev/s.

Parameters
  • velocity (float) – target velocity, in rev/s.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • target_latch (bool) – if True does target latch at the end. True by default.

  • blocking (bool) – if True, the function is blocked until the target position is reached. False by default.

set_voltage_direct(voltage, servo='default', axis=1)

Set direct voltage set point to a target servo and axis, in V.

Parameters
  • voltage (float) – target direct voltage, in V.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

set_voltage_quadrature(voltage, servo='default', axis=1)

Set quadrature voltage set point to a target servo and axis, in V.

Parameters
  • voltage (float) – target quadrature voltage, in V.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

target_latch(servo='default', axis=1)

Active target latch.

Parameters
  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

voltage_direct_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)

Given a target value and a time in seconds, changes the voltage direct set-point linearly following a ramp. This function is blocked until target reached.

Parameters
  • target_value (float) – target value of the ramp.

  • time_s (float) – duration of the ramp, in seconds.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • init_value (float) – initial value of the ramp. 0 by default.

  • interval (float) – time interval between register writes, in seconds. None by default, no interval.

voltage_quadrature_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)

Given a target value and a time in seconds, changes the voltage quadrature set-point linearly following a ramp. This function is blocked until target reached.

Parameters
  • target_value (float) – target value of the ramp.

  • time_s (float) – duration of the ramp, in seconds.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • init_value (float) – initial value of the ramp. 0 by default.

  • interval (float) – time interval between register writes, in seconds. None by default, no interval.

wait_for_position(position, servo='default', axis=1, error=20, timeout=None, interval=None)

Wait until actual position is equal to a target position, with an error.

Parameters
  • position (int) – target position, in counts.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • error (int) – allowed error between actual position and target position, in counts.

  • timeout (int) – how many seconds to wait for the servo to reach the target position, if None it will wait forever . None by default.

  • interval (float) – interval of time between actual position reads, in seconds. None by default.

wait_for_velocity(velocity, servo='default', axis=1, error=0.1, timeout=None, interval=None)

Wait until actual velocity is equal to a target velocity, with an error.

Parameters
  • velocity (float) – target velocity, in rev/s.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

  • error (int) – allowed error between actual velocity and target velocity, in counts.

  • timeout (int) – how many seconds to wait for the servo to reach the target velocity, if None it will wait forever. None by default.

  • interval (float) – interval of time between actual velocity reads, in seconds. None by default.