I am testing motor control with current is constant in magnitude and opposite in direction per secs.
Testi is done fo micro driver and TI board separately,i got different result.
Test 1: using micro driver witch current direction reverse
- using current control
- current is 1.5A in magnitude
- current direction reverse every second
related code:
double iq = 1.5;
double switch_dt = 1.0;
std::chrono::time_point<std::chrono::system_clock> last_switch_time = std::chrono::system_clock::now();
while (!robot_if.IsTimeout())
{
if (((std::chrono::duration<double>)(std::chrono::system_clock::now() - last)).count() > dt)
{
//closed loop, position
for (int i = 0; i < N_SLAVES_CONTROLED * 2; i++)
{
if (robot_if.motors[i].IsEnabled() && 0 == i)
{
robot_if.motors[i].SetCurrentReference(iq);
}
}
robot_if.SendCommand(); //This will send the command packet
// switch iq direction per secs
if (((std::chrono::duration<double>)(std::chrono::system_clock::now() - last_switch_time)).count() > switch_dt)
{
last_switch_time = std::chrono::system_clock::now();
iq = -iq;
}
}
else
{
std::this_thread::yield();
}
}
result:the drv8305 will report nFault in 3 secs and red led is on,motor buzzes
here is the testing video:
https://drive.google.com/file/d/1eqOmKfc-2lyCA3dOnlg3KSkkqMJ5C2vW/view?usp=sharing
Test 2: using micro driver with current direction constant
- using current control
- current is changed in magnitude per secs ,from 1.5A to 4A,and then from 4A to 1.5A next sec
- current direction keep constant
result:everything is good,motor rotating also good.no error
Test 3: using TI board
- using current control
- current is 1.5A in magnitude
- current direction reverse every second
The code is almost same as using micro driver,so i do not paste again.
Result:everything is good,motor is rotating good,no error occur.
Does my micro driver have some problem?
Did anyone have similar issues and how could you solve them.
Thank you very much!