Motion
- class ingeniamotion.motion.Motion(motion_controller)
Bases:
objectMotion.
- CONTROL_WORD_REGISTER = 'DRV_STATE_CONTROL'
- OPERATION_MODE_REGISTER = 'DRV_OP_CMD'
- OPERATION_MODE_DISPLAY_REGISTER = 'DRV_OP_VALUE'
- POSITION_SET_POINT_REGISTER = 'CL_POS_SET_POINT_VALUE'
- VELOCITY_SET_POINT_REGISTER = 'CL_VEL_SET_POINT_VALUE'
- CURRENT_QUADRATURE_SET_POINT_REGISTER = 'CL_CUR_Q_SET_POINT'
- CURRENT_DIRECT_SET_POINT_REGISTER = 'CL_CUR_D_SET_POINT'
- VOLTAGE_QUADRATURE_SET_POINT_REGISTER = 'CL_VOL_Q_SET_POINT'
- VOLTAGE_DIRECT_SET_POINT_REGISTER = 'CL_VOL_D_SET_POINT'
- ACTUAL_POSITION_REGISTER = 'CL_POS_FBK_VALUE'
- ACTUAL_VELOCITY_REGISTER = 'CL_VEL_FBK_VALUE'
- ACTUAL_DIRECT_CURRENT_REGISTER = 'CL_CUR_D_VALUE'
- ACTUAL_QUADRATURE_CURRENT_REGISTER = 'CL_CUR_Q_VALUE'
- GENERATOR_FREQUENCY_REGISTER = 'FBK_GEN_FREQ'
- GENERATOR_GAIN_REGISTER = 'FBK_GEN_GAIN'
- GENERATOR_OFFSET_REGISTER = 'FBK_GEN_OFFSET'
- GENERATOR_CYCLE_NUMBER_REGISTER = 'FBK_GEN_CYCLES'
- GENERATOR_REARM_REGISTER = 'FBK_GEN_REARM'
- STATUS_WORD_TARGET_REACHED_BIT = 2048
- CONTROL_WORD_TARGET_LATCH_BIT = 512
- target_latch(servo='default', axis=1)
Active target latch.
- set_operation_mode(operation_mode, servo='default', axis=1)
Set operation mode to a target servo and axis.
- get_operation_mode(servo='default', axis=1)
Return current operation mode.
- motor_enable(servo='default', axis=1, error_timeout=6)
Enable motor.
- Parameters:
- Raises:
ingenialink.exceptions.ILError – If the servo cannot enable the motor.
ingenialink.exceptions.ILTimeoutError – If the error was not raised in time.
- Return type:
- motor_disable(servo='default', axis=1)
Disable motor.
- fault_reset(servo='default', axis=1)
Fault reset.
- move_to_position(position, servo='default', axis=1, target_latch=True, blocking=False, error=20, timeout=None, interval=None)
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.defaultby default.axis (
int) – servo axis.1by default.target_latch (
bool) – ifTruedoes target latch at the end.Trueby default.blocking (
bool) – ifTrue, the function is blocked until the target position is reached.Falseby default.error (
int) – If blocking is enabled, allowed error between actual position and target position, in counts.timeout (
Optional[float]) – If blocking is enabled, how many seconds to wait for the servo to reach the target position, ifNoneit will wait forever.Noneby default.interval (
Optional[float]) – If blocking is enabled, interval of time between actual position reads, in seconds.Noneby default.
- Raises:
TypeError – If position is not an int.
IMTimeoutError – If the target position is not reached in time.
- Return type:
- set_velocity(velocity, servo='default', axis=1, target_latch=True, blocking=False, error=0.1, timeout=None, interval=None)
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.defaultby default.axis (
int) – servo axis.1by default.target_latch (
bool) – ifTruedoes target latch at the end.Trueby default.blocking (
bool) – ifTrue, the function is blocked until the target position is reached.Falseby default.error (
float) – If blocking is enabled, allowed error between actual velocity and target velocity, in rev/s.timeout (
Optional[float]) – If blocking is enabled, how many seconds to wait for the servo to reach the target velocity, ifNoneit will wait forever.Noneby default.interval (
Optional[float]) – If blocking is enabled, interval of time between actual velocity reads, in seconds.Noneby default.
- Raises:
TypeError – If velocity is not a float.
IMTimeoutError – If the target velocity is not reached in time.
- Return type:
- set_current_quadrature(current, servo='default', axis=1)
Set quadrature current set point to a target servo and axis, in A.
- set_current_direct(current, servo='default', axis=1)
Set direct current set point to a target servo and axis, in A.
- set_voltage_quadrature(voltage, servo='default', axis=1)
Set quadrature voltage set point to a target servo and axis, in V.
- set_voltage_direct(voltage, servo='default', axis=1)
Set direct voltage set point to a target servo and axis, in V.
- current_quadrature_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)
Generate a current quadrature ramp.
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.defaultby default.axis (
int) – servo axis.1by default.init_value (
float) – initial value of the ramp.0by default.interval (
Optional[float]) – time interval between register writes, in seconds.Noneby default, no interval.
- Raises:
TypeError – If target_value or time_s is not a float.
- Return type:
- current_direct_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)
Generate a current direct ramp.
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.defaultby default.axis (
int) – servo axis.1by default.init_value (
float) – initial value of the ramp.0by default.interval (
Optional[float]) – time interval between register writes, in seconds.Noneby default, no interval.
- Raises:
TypeError – If target_value or time_s is not a float.
- Return type:
- voltage_quadrature_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)
Generate a voltage quadrature ramp.
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.defaultby default.axis (
int) – servo axis.1by default.init_value (
float) – initial value of the ramp.0by default.interval (
Optional[float]) – time interval between register writes, in seconds.Noneby default, no interval.
- Raises:
TypeError – If target_value or time_s is not a float.
- Return type:
- voltage_direct_ramp(target_value, time_s, servo='default', axis=1, init_value=0, interval=None)
Generate a voltage direct ramp.
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.defaultby default.axis (
int) – servo axis.1by default.init_value (
float) – initial value of the ramp.0by default.interval (
Optional[float]) – time interval between register writes, in seconds.Noneby default, no interval.
- Raises:
TypeError – If target_value or time_s is not a float.
- Return type:
- static ramp_generator(init_v, final_v, total_t, interval=None)
Generate a ramp.
- get_actual_position(servo='default', axis=1)
Returns actual position register.
- get_actual_velocity(servo='default', axis=1)
Returns actual velocity register.
- get_actual_current_direct(servo='default', axis=1)
Returns actual direct current register.
- get_actual_current_quadrature(servo='default', axis=1)
Returns actual quadrature current register.
- 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.defaultby default.axis (
int) – servo axis.1by default.error (
int) – allowed error between actual position and target position, in counts.timeout (
Optional[float]) – how many seconds to wait for the servo to reach the target position, ifNoneit will wait forever .Noneby default.interval (
Optional[float]) – interval of time between actual position reads, in seconds.Noneby default.
- Raises:
IMTimeoutError – If the target position is not reached in time.
- Return type:
- 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.defaultby default.axis (
int) – servo axis.1by default.error (
float) – allowed error between actual velocity and target velocity, in rev/s.timeout (
Optional[float]) – how many seconds to wait for the servo to reach the target velocity, ifNoneit will wait forever.Noneby default.interval (
Optional[float]) – interval of time between actual velocity reads, in seconds.Noneby default.
- Raises:
IMTimeoutError – If the target velocity is not reached in time.
- Return type:
- set_internal_generator_configuration(op_mode, servo='default', axis=1, pair_poles=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.defaultby default.axis (
int) – servo axis.1by default.pair_poles (
int) – motor poles pair.1by default.
- Raises:
ValueError – If operation mode is not set to Current or Voltage.
- Return type:
- internal_generator_saw_tooth_move(direction, cycles, frequency, gain=1.0, servo='default', axis=1)
Move motor in internal generator configuration with generator mode saw tooth.
- Parameters:
- Raises:
TypeError – If direction, cycles or frequency is not of the correct type.
ValueError – If gain is not positive.
- Return type:
- internal_generator_constant_move(offset, servo='default', axis=1)
Move motor in internal generator configuration with generator mode constant.