Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.8 kB
12
Indexable
Never
#odrv0.erase_configuration()
odrv0.config.enable_brake_resistor = True
odrv0.config.brake_resistance = 2
odrv0.axis0.motor.config.current_lim = 25
odrv0.axis0.controller.config.vel_limit = 10
odrv0.axis0.motor.config.calibration_current = 15
odrv0.axis0.motor.config.pole_pairs = 7
odrv0.axis0.motor.config.torque_constant = (8.27 / 270)
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.encoder.config.cpr = 8192
odrv0.axis0.encoder.config.use_index =True
odrv0.save_configuration()

odrv0.axis0.controller.config.vel_gain=0.32/2 #[Nm/(turn/s)]
odrv0.axis0.controller.config.vel_integrator_gain  = (0.5 * 10 * 0.32/2 ) #[Nm/((turn/s) * s)]
odrv0.axis0.controller.config.pos_gain=15  #[(turn/s) / turn]

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION

odrv0.axis0.encoder.config.pre_calibrated = True
odrv0.axis0.encoder.config.use_index = True
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.config.startup_encoder_index_search = True
odrv0.axis0.config.calibration_lockin.vel = -odrv0.axis0.config.calibration_lockin.vel
odrv0.axis0.config.calibration_lockin.accel = -odrv0.axis0.config.calibration_lockin.accel
odrv0.axis0.config.calibration_lockin.ramp_distance = -odrv0.axis0.config.calibration_lockin.ramp_distance

odrv0.save_configuration()

odrv0.axis1.motor.config.current_lim = 25
odrv0.axis1.controller.config.vel_limit = 10
odrv0.axis1.motor.config.calibration_current = 15
odrv0.axis1.motor.config.pole_pairs = 7
odrv0.axis1.motor.config.torque_constant = (8.27 / 270)
odrv0.axis1.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis1.encoder.config.cpr = 8192
odrv0.axis1.encoder.config.use_index =True
odrv0.save_configuration()

odrv0.axis1.controller.config.vel_gain=0.32/2 #[Nm/(turn/s)]
odrv0.axis1.controller.config.vel_integrator_gain  = (0.5 * 10 * 0.32/2 ) #[Nm/((turn/s) * s)]
odrv0.axis1.controller.config.pos_gain=15  #[(turn/s) / turn]

odrv0.axis1.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

odrv0.axis1.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH

odrv0.axis1.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION

odrv0.axis1.encoder.config.pre_calibrated = True
odrv0.axis1.encoder.config.use_index = True
odrv0.axis1.motor.config.pre_calibrated = True
odrv0.axis1.config.startup_encoder_index_search = True
odrv0.axis1.config.calibration_lockin.vel = -odrv0.axis1.config.calibration_lockin.vel
odrv0.axis1.config.calibration_lockin.accel = -odrv0.axis1.config.calibration_lockin.accel
odrv0.axis1.config.calibration_lockin.ramp_distance = -odrv0.axis1.config.calibration_lockin.ramp_distance
odrv0.save_configuration()