ODrive Tunning Parameter
시간이 제법 흘러서.. odrive 예전 버전을 쓰는 사람이 있을지 모르겠다..
odrive 3.6 56v fw0.4.11 버전 당시에 파라메터를 조사하면서 썻던 글들을 정리해본다.
ODrive Tunning Parameter
|
|||
motor.current_control
|
p_gain
|
전류제어기 P 게인
|
|
i_gain
|
전류제어기 P 게인
|
|
|
Iq_setpoint
|
모터의 목표 전류[A]
|
|
|
Iq_measured
|
측정된 모터의 전류[A]
|
|
|
motor.config
|
current_lim
|
ODrive의 전체 전류 제한값[A]
|
|
requested_current_range
|
전류를 측정하기위한 DRV 앰프게인
|
ex) current_lim이 60[A] 이상이면, 이 게인을 90[A]로 조정하여 DRV IC내부의 전류측정 범위용으로 사용하는 앰프게인을 변경
|
|
current_control_bandwidth
|
전류제어기의 대역폭 제어
|
전류제어기의 빠른 반응을 원하면 약간 올릴 것
안정성 감소없이, vel_gain을 올리는 margin을 좀 더 줄 수 있다.
단, 증폭된 전류측정노이즈에서 acoustic noise를 증가시킨다.
값이 커질경우 진동을 동반하며 2000 이상하지말 것
|
|
controller
|
pos_setpoint
|
위치제어기 목표 위치값[count]
|
|
vel_setpoint
|
속도제어기 목표 속도값[count/s]
|
|
|
vel_integrator_current
|
속도 적분기 전류값 상태
|
state of the integrator
(사용자가 건들지 말것)
|
|
current_setpoint
|
전류제어기 목표 전류값[A]
|
|
|
controller.config
|
pos_gain
|
위치제어기용 P 게인
|
|
vel_gain
|
속도제어기용 P 게인
|
|
|
vel_integrator_gain
|
속도제어기용 I 게인
|
|
|
vel_limit
|
최대 속도 제한[count/s]
|
|
|
encoder.config
|
bandwidth
|
속도 추정 필터의 대역폭
|
내부에서 shadow_count를 pos_estiamator로 추정하는 필터
필터의 대역폭을 조절함. 대역폭이 낮으면 노이즈는 적지만 응답은 느려지므로 실제로 전체 제어를 악화시킬 수 있음.
|
추가 설명(190722 참고)
제어기들은 8khz로 update가 동시에 이루어지지만, 각각의 제어 bandwidth가 다르다.
1. 속도제어기(controller.cpp)
1) 전류 리밋값은 둘 중에 하나에서 결정된다.
axis_->motor_.config_.current_lim
axis_->motor_.current_control_.max_allowed_current(사용자가 건들필요 없음)
2) 사용자는 딱 3개만 건드리면 된다.
vel_gain
vel_integrator_gain
set_vel_setpoint(float vel_setpoint, float current_feed_forward) 함수를 통한 current_feed_forward 전류[A]
=> vel_integrator_current_ : 적분 i 게인 상태값. 건드리면 안된다.
2. 전류제어기(motor.cpp)
motor.cpp안에서 전류제어기 작업이 수행되고, DRV 및 FOC 제어가 이루어진다.
1) current controller의 p,i 게인은 current_control_bandwidth, phase resistance, inductance 3개값에 의해 초기 결정된다.
2) current_control_bandwidth 변수는 전류제어기의 p게인을 제어하고, p게인은 i게인에 영향을 미친다.
3) current_control_bandwidth 값을 변경할때마다 current controller의 p,i 게인값이 변경된다.
3. resistance_calib_max_voltage & motor.config.calibration_current
resistance_calib_max_voltage
You may need to increase this if this voltage isn't sufficient to drive calibration_current through the motor.
모터 calibration 시에 calibration 전류로 모터를 구동하기에 부족하면 resistance_calib_max_voltage를 증가시켜라.
calibration_current
If your motor has problems reaching the index location due to the mechanical load, you can increase `<axis>.motor.config.calibration_current`.
기계 하중으로 인해서 index를 찾지못하면 더 늘려라
resistance_calib_max_voltage > calibration_current * phase_resistance
resistance_calib_max_voltage < 0.5 * vbus_voltage
코드에서 살펴보면 motor calibration시에만 사용되며, Phase resistance, inductance를 측정하는데 사용됨.
=> 60kg 하중의 로봇의 경우 카펫에서 두 파라메터를 10으로 했을때, 안정적으로 calibration 수행됨.
4. encoder.config.bandwidth
bandwidth를 조정하면 encoder pll 계산시 pll_kp, pll_kd 게인이 변화됨.
(특정버전부터 외부에서 사용할수 없게되었음)
대역폭: 어떻게 이득을 선택하는가?
tradeoff : 지연(lag)와 smoothness
encoder와 application에 따라 다름
높은 bandwidth 제어는 높은 대역폭의 상태추정기를 요구함. sharp한 반응
고해상도 엔코더는 계단에서의 펄스크기가 작다는 것을 의미하므로, 덜 날카로운 반응을 가진다.
그러므로 시스템의 동일한 노이즈와 신호음에 대해서 대역폭을 높일수 있다.
요약 (대략적)
엔코더는 계단식으로 읽음.
계단과 계단사이도 보간해서 위치값을 smooth하게 읽을 수 있음.
state estimator를 사용하는데 위치값과 속도값으로 위치추정값을 찾아냄.
그런데 위치값을 예측하는데 있어서 pi 루프를 도입함.
제어공학의 2차 시스템. 2차 시스템 안정도를 높이기 위해서 게인들을 조정
pole을 left half plane으로 옮기고, 오실레이션이 없도록 하기위한 게인 조정.
real part는 특정 값으로, imaginary 값은 0로 놓아서 안정하게 하려는 것으로 보임.
대략적으로는 이해하였지만, bandwidth를 조정해서 pole이 어떻게 조정되는지를 알 길이 없다.
5. brake_resistance
low_level.cpp
Sums up the Ibus contribution of each motor and updates the brake resistor PWM accordingly.
float Ibus_sum = 0.0f;
for (size_t i = 0; i < AXIS_COUNT; ++i) {
if (axes[i]->motor_.armed_state_ == Motor::ARMED_STATE_ARMED) {
Ibus_sum += axes[i]->motor_.current_control_.Ibus;
}}
float brake_current = -Ibus_sum;
// Clip negative values to 0.0f
if (brake_current < 0.0f) brake_current = 0.0f;
float brake_duty = brake_current * board_config.brake_resistance / vbus_voltage;
각 axis에서 측정된 전류값을 더해서 전체 전류로 계산하고 그대로 역전류로 설정
brake_current = -전체전류 (그대로 역으로 브레이크하기위한 전류)
브레이크 해야하는 듀티 = (브레이크 전류 * 저항) / 공급 전압 ( 0~ 0.9)
6. startup calibration을 회피할 수 있는 방법이 있는 것인지?
=> 읽어보니 현재로서는 방법이 없다. 미래 계획에는 있지만, 현재로서는 엔코더를 달면 무조건 calibration 하는 과정이 필요하다.
그 이유는...
odrive는 field oriented control을 사용한다. 이 제어 방법은 odrive가 정확하게 고정자 와인딩을 기준으로 로터가 어디에 있는지 알아야만한다. 이 정보가 없다면 토크가 생성되지 않는다. 왜냐하면 odrive는 rotor를 기준으로 어느 각도에 전류를 흘릴지 모르기 때문이다. 보정스텝을 get around 하는 유일한 방법은 power cycling을 통해서 절대 reference를 유지하는 것 뿐이다. 이것은 일반적으로 절대식 엔코더에서 사용된다.아마 너는 sensorless 제어를 사용할 수 있다. 그런데 그건 저속에서 매우 좋은 토크를 낼 수 없다. 이건 odrive에만 국한된 상황이 아니다. synchronous 모터를 다루는 상황에서 생기는 일반적인 문제이다.. 절대식 엔코더는 odrive에서 현재 지원하지 않는다.
Motor Tunning
Hoverboard 튜닝(https://docs.odriverobotics.com/hoverboard)
Odrive 홈페이지 튜닝방법(https://docs.odriverobotics.com/commands)
-
Set the integrator gain to 0
-
Make sure you have a stable system. If it is not, decrease all gains until you have one.
-
Increase vel_gain by around 30% per iteration until the motor exhibits some vibration.
-
Back down vel_gain to 50% of the vibrating value.
-
Increase pos_gain by around 30% per iteration until you see some overshoot. -
Back down pos_gain until you do not have overshoot anymore. -
The integrator can be set to 0.5 * bandwidth * vel_gain, where bandwidth is the overall resulting tracking bandwidth of your system. Say your tuning made it track commands with a settling time of 100ms: this means the bandwidth was 1/100ms or 10. In this case you should set the vel_integrator_gain = 0.5 * 10 * vel_gain.
i 게인 0으로 잡고 진동할떄까지 30%씩 vel_gain 게인 증가시킴
진동하는 값의 vel_gain값을 50%로 줄임.
원하는 트랙킹bandwidth를 잡고(100ms 안에 도달 목표) => 1/ 100ms = 10 = bandwidth
vel_intergrator_gain = 0.5 * bandwidh * vel_gain 으로 해서 잡아라.
Wetmelon 방법
1)전류제어기
모터에 하중을 가함.
모터에 전류 제어기를 테스트해서 전류 setpoint와 측정치를 출력해볼 것. step 커맨드값을 잘 추종하는지 확인하고 ramp와 sinusoid 파형을 해볼것.
전류측정에서 약간 노이즈가 있다.
2)속도제어기
일단 전류제어기를 성능을 만족시키고나서 속도제어모드를 한다.
vel_integrator_gain=0, vel_gain=0으로 잡고 매우 느리게 vel_gain을 증가시켜나가봐라. (0.0005 부터 작게) 모터가 noisy 하게 될때까지,
vel_gain을 줄이고, vel_intergrator_gain을 증가시켜라.
overshoot,settling time, rising이 만족될때까지 조절.속도추정치가 너무 많은 노이즈를 보일 경우, 인코더 대역폭을 조정해라.
3)위치제어기
속도제어기가 만족되면 위치 p게인 조절 시작.
반응형
'Motor > ODrive' 카테고리의 다른 글
ODrive 하면서 있었던 일들... 오류잡기 (2) | 2022.05.15 |
---|