Hi,I’m trying to use Odrive board to control my gimbal motor--------- Tmotor MN5212 340KV by following the documentation steps.But I get some problem in Position controling of M0, when I type ‘odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE’ ,the motor didn’t work as expected, it just turn to a specific location fastly and stopped without “a beep and turning slowly in one direction for a few seconds, then back in the other direction”.
My Odrive board is 24V version 3.5 , motor--------- Tmotor MN5212 340KV
encoder----------AS5047D, cpr=2000, No changes to firmware.
Connected to ODrive 205C339B344D as odrv0
In [2]: odrv0
Out[2]:
vbus_voltage = 22.72294807434082 (float)
serial_number = 205C339B344D (int)
hw_version_major = 3 (int)
hw_version_minor = 5 (int)
hw_version_variant = 24 (int)
fw_version_major = 0 (int)
fw_version_minor = 0 (int)
fw_version_revision = 0 (int)
fw_version_unreleased = 1 (int)
user_config_loaded = True (bool)
brake_resistor_armed = True (bool)
system_stats:
uptime = 63911 (int)
min_heap_space = 18264 (int)
min_stack_space_axis0 = 7868 (int)
min_stack_space_axis1 = 7868 (int)
min_stack_space_comms = 4564 (int)
min_stack_space_usb = 1308 (int)
min_stack_space_uart = 3932 (int)
min_stack_space_usb_irq = 1828 (int)
min_stack_space_startup = 564 (int)
usb: ...
i2c: ...
config:
brake_resistance = 0.4699999988079071 (float)
enable_uart = True (bool)
enable_i2c_instead_of_can = False (bool)
enable_ascii_protocol_on_usb = True (bool)
dc_bus_undervoltage_trip_level = 8.0 (float)
dc_bus_overvoltage_trip_level = 25.920001983642578 (float)
axis0:
error = 0x0000 (int)
enable_step_dir = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 513831 (int)
config: ...
motor: ...
controller: ...
encoder: ...
sensorless_estimator: ...
axis1:
error = 0x0000 (int)
enable_step_dir = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 513858 (int)
config: ...
motor: ...
controller: ...
encoder: ...
sensorless_estimator: ...
can:
node_id = 0 (int)
TxMailboxCompleteCallbackCnt = 0 (int)
TxMailboxAbortCallbackCnt = 0 (int)
received_msg_cnt = 0 (int)
received_ack = 0 (int)
unexpected_errors = 0 (int)
unhandled_messages = 0 (int)
test_property = 0 (int)
test_function(delta: int)
get_oscilloscope_val(index: int)
get_adc_voltage(gpio: int)
save_configuration()
erase_configuration()
reboot()
enter_dfu_mode()
In [4]: odrv0.axis0
Out[4]:
error = 0x0000 (int)
enable_step_dir = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 989935 (int)
config:
startup_motor_calibration = False (bool)
startup_encoder_index_search = False (bool)
startup_encoder_offset_calibration = False (bool)
startup_closed_loop_control = False (bool)
startup_sensorless_control = False (bool)
enable_step_dir = False (bool)
counts_per_step = 2.0 (float)
ramp_up_time = 0.4000000059604645 (float)
ramp_up_distance = 12.566370964050293 (float)
spin_up_current = 10.0 (float)
spin_up_acceleration = 400.0 (float)
spin_up_target_vel = 400.0 (float)
motor:
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = False (bool)
current_meas_phB = -0.11118018627166748 (float)
current_meas_phC = -0.02141427993774414 (float)
DC_calib_phB = -0.9764583110809326 (float)
DC_calib_phC = -2.2342236042022705 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
current_control: ...
gate_driver: ...
timing_log: ...
config: ...
controller:
pos_setpoint = 0.0 (float)
vel_setpoint = 0.0 (float)
vel_integrator_current = 0.0 (float)
current_setpoint = 0.0 (float)
theta_setpoint = 0.0 (float)
gamma_setpoint = 1.5707963705062866 (float)
x_setpoint = 0.0 (float)
y_setpoint = 0.12999999523162842 (float)
force_x = 0.0 (float)
force_y = 0.0 (float)
x_pos = 0.0 (float)
y_pos = 0.0 (float)
tau_theta = 0.0 (float)
tau_gamma = 0.0 (float)
J00 = 0.0 (float)
J01 = 0.0 (float)
J10 = 0.0 (float)
J11 = 0.0 (float)
theta = 0.0 (float)
gamma = 1.5700000524520874 (float)
config: ...
set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_fo
rward: float)
set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
set_current_setpoint(current_setpoint: float)
set_coupled_setpoints(theta_setpoint: float, gamma_setpoint: float)
set_xy_setpoints(x_setpoint: float, y_setpoint: float)
set_xy_gains(kp_x: float, kd_x: float, kp_y: float, kd_y: float)
start_anticogging_calibration()
encoder:
error = 0x0000 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
offset = 0 (int)
interpolation = 0.5 (float)
phase = 0.0172787606716156 (float)
pos_estimate = 0.0 (float)
pos_cpr = 0.0 (float)
hall_state = 2 (int)
pll_vel = 0.0 (float)
pll_kp = 2000.0 (float)
pll_ki = 1000000.0 (float)
config: ...
sensorless_estimator:
error = 0x0000 (int)
phase = nan (float)
pll_pos = nan (float)
pll_vel = nan (float)
pll_kp = 2000.0 (float)
pll_ki = 1000000.0 (float)
In [5]: odrv0.axis0.encoder
Out[5]:
error = 0x0000 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
offset = 0 (int)
interpolation = 0.5 (float)
phase = 0.0172787606716156 (float)
pos_estimate = 0.0 (float)
pos_cpr = 0.0 (float)
hall_state = 2 (int)
pll_vel = 0.0 (float)
pll_kp = 2000.0 (float)
pll_ki = 1000000.0 (float)
config:
mode = 0 (int)
use_index = False (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
cpr = 2000 (int)
offset = 0 (int)
offset_float = 0.0 (float)
calib_range = 0.019999999552965164 (float)
In [6]: odrv0.axis0.motor
Out[6]:
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = False (bool)
current_meas_phB = 0.04302489757537842 (float)
current_meas_phC = -0.05692267417907715 (float)
DC_calib_phB = -0.9694373607635498 (float)
DC_calib_phC = -2.2390358448028564 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
current_control:
p_gain = 0.0 (float)
i_gain = nan (float)
v_current_control_integral_d = 0.0 (float)
v_current_control_integral_q = 0.0 (float)
Ibus = 0.0 (float)
final_v_alpha = 0.0 (float)
final_v_beta = 0.0 (float)
Iq_setpoint = 0.0 (float)
Iq_measured = 0.0 (float)
max_allowed_current = 71.99999237060547 (float)
gate_driver:
drv_fault = 0 (int)
timing_log:
TIMING_LOG_GENERAL = 0 (int)
TIMING_LOG_ADC_CB_I = 961 (int)
TIMING_LOG_ADC_CB_DC = 11297 (int)
TIMING_LOG_MEAS_R = 0 (int)
TIMING_LOG_MEAS_L = 0 (int)
TIMING_LOG_ENC_CALIB = 0 (int)
TIMING_LOG_IDX_SEARCH = 0 (int)
TIMING_LOG_FOC_VOLTAGE = 0 (int)
TIMING_LOG_FOC_CURRENT = 0 (int)
config:
pre_calibrated = False (bool)
pole_pairs = 11 (int)
calibration_current = 10.0 (float)
resistance_calib_max_voltage = 1.0 (float)
phase_inductance = 0.0 (float)
phase_resistance = 0.0 (float)
direction = 1 (int)
motor_type = 2 (int)
current_lim = 10.0 (float)
requested_current_range = 70.0 (float)
In [7]: odrv0.axis0.controller
Out[7]:
pos_setpoint = 0.0 (float)
vel_setpoint = 0.0 (float)
vel_integrator_current = 0.0 (float)
current_setpoint = 0.0 (float)
theta_setpoint = 0.0 (float)
gamma_setpoint = 1.5707963705062866 (float)
x_setpoint = 0.0 (float)
y_setpoint = 0.12999999523162842 (float)
force_x = 0.0 (float)
force_y = 0.0 (float)
x_pos = 0.0 (float)
y_pos = 0.0 (float)
tau_theta = 0.0 (float)
tau_gamma = 0.0 (float)
J00 = 0.0 (float)
J01 = 0.0 (float)
J10 = 0.0 (float)
J11 = 0.0 (float)
theta = 0.0 (float)
gamma = 1.5700000524520874 (float)
config:
control_mode = 3 (int)
pos_gain = 0.009999999776482582 (float)
vel_gain = 0.0005000000237487257 (float)
vel_integrator_gain = 0.0010000000474974513 (float)
vel_limit = 2300.0 (float)
kp_theta = 38.19718551635742 (float)
kd_theta = 0.47746485471725464 (float)
kp_gamma = 9.549296379089355 (float)
kd_gamma = 0.47746485471725464 (float)
kp_x = 0.0 (float)
kd_x = 0.0 (float)
kp_y = 0.0 (float)
kd_y = 0.0 (float)
set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_forw
ard: float)
set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
set_current_setpoint(current_setpoint: float)
set_coupled_setpoints(theta_setpoint: float, gamma_setpoint: float)
set_xy_setpoints(x_setpoint: float, y_setpoint: float)
set_xy_gains(kp_x: float, kd_x: float, kp_y: float, kd_y: float)
start_anticogging_calibration()
In [24]: dump_errors(odrv0)
axis0
axis: no error
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error
and my parameters are as follows:
odrv0.axis0.motor.config.current_lim=10
odrv0.axis0.controller.config.vel_limit=2300
odrv0.axis0.motor.config.calibration_current=10
odrv0.config.brake_resistance=0.47
odrv0.axis0.motor.config.pole_pairs=11
odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_GIMBAL
odrv0.axis0.encoder.config.cpr=2000
odrv0.save_configuration()
Thanks in advance