merci,cela fonctionne en revanche j’ai un autre soucis je debute completement voici le code il controle correctement 1 moteur avec la telecomande et j’aimerais qu’il en commande 2 . le gpio 3, fera avancer ou reculer .et sur le gpio 4 1 moteur avance et le deuxieme recule.
Connected to ODrive v3.6 205B305F594D (firmware v0.5.1) as odrv0
In [1]: odrv0.erase_configuration()
Oh no odrv0 disappeared
Reconnected to ODrive v3.6 205B305F594D (firmware v0.5.1) as odrv0
In [2]: odrv0.config.brake_resistance = True
In [3]: odrv0.config.dc_max_positive_current = 30
In [4]: odrv0.config.dc_max_negative_current = -2.0
In [5]: odrv0.config.max_regen_current = 0
In [6]: odrv0.save_configuration()
In [7]: odrv0.axis0.motor.config.pole_pairs = 15
In [8]: odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
In [9]: odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
In [10]: odrv0.axis0.motor.config.calibration_current = 10
In [11]: odrv0.axis0.motor.config.current_lim = 20
In [12]: odrv0.axis0.motor.config.requested_current_range = 25
In [13]: odrv0.save_configuration()
In [14]: odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
In [15]: odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
In [16]: odrv0.axis0.encoder.config.cpr = 90
In [17]: odrv0.axis0.controller.config.pos_gain = 20
In [18]: odrv0.axis0.controller.config.vel_gain = 0.02
In [19]: odrv0.axis0.controller.config.vel_integrator_gain = 0.1
In [20]: odrv0.axis0.controller.config.vel_limit = 100
In [21]: odrv0.save_configuration()
In [22]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
In [23]: odrv0.axis0.motor
Out[23]:
DC_calib_phB: -3.044856309890747 (float)
DC_calib_phC: -1.3685325384140015 (float)
armed_state: 0 (int32)
config:
acim_autoflux_attack_gain: 10.0 (float)
acim_autoflux_decay_gain: 1.0 (float)
acim_autoflux_enable: False (bool)
acim_autoflux_min_Id: 10.0 (float)
acim_gain_min_flux: 10.0 (float)
acim_slip_velocity: 14.706000328063965 (float)
calibration_current: 10.0 (float)
current_control_bandwidth: 1000.0 (float)
current_lim: 20.0 (float)
current_lim_margin: 8.0 (float)
direction: 0 (int32)
inverter_temp_limit_lower: 100.0 (float)
inverter_temp_limit_upper: 120.0 (float)
motor_type: 0 (int32)
phase_inductance: 0.0005604586913250387 (float)
phase_resistance: 0.39337942004203796 (float)
pole_pairs: 15 (int32)
pre_calibrated: False (bool)
requested_current_range: 25.0 (float)
resistance_calib_max_voltage: 4.0 (float)
torque_constant: 0.03999999910593033 (float)
torque_lim: inf (float)
current_control:
I_measured_report_filter_k: 1.0 (float)
Ibus: 0.0 (float)
Id_measured: 0.0 (float)
Id_setpoint: 0.0 (float)
Iq_measured: 0.0 (float)
Iq_setpoint: 0.0 (float)
acim_rotor_flux: 0.0 (float)
async_phase_offset: 0.0 (float)
async_phase_vel: 0.0 (float)
final_v_alpha: 0.0 (float)
final_v_beta: 0.0 (float)
i_gain: 393.37945556640625 (float)
max_allowed_current: 60.75 (float)
overcurrent_trip_level: 67.5 (float)
p_gain: 0.5604587197303772 (float)
v_current_control_integral_d: 0.0 (float)
v_current_control_integral_q: 0.0 (float)
current_meas_phB: 0.10371589660644531 (float)
current_meas_phC: 0.038558244705200195 (float)
effective_current_lim: 10.0 (float)
error: 0 (int32)
gate_driver:
drv_fault: 0 (int32)
is_calibrated: True (bool)
phase_current_rev_gain: 0.02500000037252903 (float)
timing_log:
adc_cb_dc: 12850 (uint16)
adc_cb_i: 2622 (uint16)
enc_calib: 55657 (uint16)
foc_current: 50612 (uint16)
foc_voltage: 7754 (uint16)
general: 19717 (uint16)
idx_search: 19076 (uint16)
meas_l: 7790 (uint16)
meas_r: 7706 (uint16)
sample_now: 25048 (uint16)
spi_end: 28598 (uint16)
spi_start: 11627 (uint16)
In [24]: odrv0.axis0.motor.config.pre_calibrated = True
In [25]: odrv0.axis0.encoder.config.calib_range = 0.05
In [26]: odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
In [27]: odrv0.axis0.encoder
Out[27]:
calib_scan_response: 1537.0 (float)
config:
abs_spi_cs_gpio_pin: 1 (uint16)
bandwidth: 1000.0 (float)
calib_range: 0.05000000074505806 (float)
calib_scan_distance: 50.26548385620117 (float)
calib_scan_omega: 12.566370964050293 (float)
cpr: 90 (int32)
enable_phase_interpolation: True (bool)
find_idx_on_lockin_only: False (bool)
idx_search_unidirectional: False (bool)
ignore_illegal_hall_state: False (bool)
mode: 1 (int32)
offset: 0 (int32)
offset_float: 0.0 (float)
pre_calibrated: False (bool)
sincos_gpio_pin_cos: 4 (uint16)
sincos_gpio_pin_sin: 3 (uint16)
use_index: False (bool)
zero_count_on_find_idx: True (bool)
count_in_cpr: 81 (int32)
error: 2 (int32)
hall_state: 2 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: False (bool)
phase: -2.6179845333099365 (float)
pos_abs: 0 (int32)
pos_circular: 0.9027752876281738 (float)
pos_cpr: 0.9027776122093201 (float)
pos_cpr_counts: 81.24998474121094 (float)
pos_estimate: -17.100000381469727 (float)
pos_estimate_counts: -1539.0 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: -1539 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (float)
In [28]: odrv0.reboot()
Oh no odrv0 disappeared
Reconnected to ODrive v3.6 205B305F594D (firmware v0.5.1) as odrv0
In [29]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
In [30]: odrv0.axis0.motor.config.pre_calibrated = True
In [31]: odrv0.axis0.encoder.config.calib_range = 0.05
In [32]: odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
In [33]: odrv0.axis0.encoder
Out[33]:
calib_scan_response: 48.0 (float)
config:
abs_spi_cs_gpio_pin: 1 (uint16)
bandwidth: 1000.0 (float)
calib_range: 0.05000000074505806 (float)
calib_scan_distance: 50.26548385620117 (float)
calib_scan_omega: 12.566370964050293 (float)
cpr: 90 (int32)
enable_phase_interpolation: True (bool)
find_idx_on_lockin_only: False (bool)
idx_search_unidirectional: False (bool)
ignore_illegal_hall_state: False (bool)
mode: 1 (int32)
offset: -21 (int32)
offset_float: -0.48596876859664917 (float)
pre_calibrated: False (bool)
sincos_gpio_pin_cos: 4 (uint16)
sincos_gpio_pin_sin: 3 (uint16)
use_index: False (bool)
zero_count_on_find_idx: True (bool)
count_in_cpr: 2 (int32)
error: 0 (int32)
hall_state: 2 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: True (bool)
phase: -0.014689207077026367 (float)
pos_abs: 0 (int32)
pos_circular: 0.030557870864868164 (float)
pos_cpr: 0.03055555932223797 (float)
pos_cpr_counts: 2.750000238418579 (float)
pos_estimate: 0.03333329036831856 (float)
pos_estimate_counts: 2.9999961853027344 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: 2 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (float)
In [34]: odrv0.axis0.encoder.config.pre_calibrated = True
In [35]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
In [36]: odrv0.axis0.config.startup_closed_loop_control = True
In [37]: odrv0.save_configuration()
In [38]: odrv0.reboot()
Oh no odrv0 disappeared
Reconnected to ODrive v3.6 205B305F594D (firmware v0.5.1) as odrv0
In [39]: odrv0.axis0.controller.input_vel = 5
In [40]: odrv0.axis0.controller.input_vel = 0
In [41]: odrv0.config.gpio3_pwm_mapping.min = -20
In [42]: odrv0.config.gpio3_pwm_mapping.max = 20
In [43]: odrv0.config.gpio3_pwm_mapping.endpoint = odrv0.axis0.controller._input_vel_property
In [44]: odrv0.save_configuration()
In [45]: odrv0.reboot()
O