mit-racecar / vesc

71 stars 106 forks source link

Strong initial kick #14

Closed mbudris closed 5 years ago

mbudris commented 5 years ago

Hi, when launching the code, motors kick a lot for a short moment. After that everything works flawlessly. Have anyone experienced such behavior?

ArtlyStyles commented 5 years ago

I saw that too. Are you driving it with teleop or your own code? If you are driving it with your code, you should not set the speed to max when the car is not moving. Try to increase the speed gradually. Also, change the maximum speed in vesc config file will also helps.

mbudris commented 5 years ago

It kicks at initialization. Maybe some initial serial stream is interpreted as speed by VESC, because there is a kick every time I start the driver, just with different force. I use teleop and it starts with zero speed so there should be no problems.

AmeyHande commented 5 years ago

Hello @mbudris , The reason behind the kick at initialization is maybe due the reason that motor starts to rotate only after value of ERPM command input given out to VESC motor controller exceeds ~1000.00 erpm and it kicks in motor at that specified ERPM. If we can lower the value of parameter related to that behavior of limiting minimum absolute ERPM value required for motor to start, then the issue of Initial Kick-in would be solved and in-addition to that we would be able to operate the vehicle at speed lower than (1000 ERPM or 0.2 m/s speed).

mbudris commented 5 years ago

Not sure about that because if it was some consistent speed command to all motors, the robot would certainly move, because the kick takes somewhat a second.

jetsonhacks commented 5 years ago

The phenomeon you are describing is called 'cogging'. This is inherent to brushless motors. This is caused by the ESC not knowing exactly where the rotor and the stators are in relationship to each other when the motor starts. Basically the ESC fires 'randomly' until it can figure it out. See this video for an explanation: https://youtu.be/PVwRI-mSVQ4?t=291

You can get better results by using a sensored motor, the sensor helps determine the relative positions. You will need to add a sensored motor to the Traxxas, along with the appropriate wires to the VESC. In addition, you will have to set the appropriate parameters on the VESC using the BLDC tool.

mbudris commented 5 years ago

While the ROS VESC driver might do such "probing", but I don't think this is necessary, especially when one has to go through some special procedures to set up the VESC for its motor using its own software. Another thing is that if I launch the driver without motors (and VESCs) turned on and then turn the power, I have smooth behavior, without any issues.

mbudris commented 5 years ago

Actually jetsonhacks have been right, I think.

The kick comes from vesc/vesc_interface.cpp: void VescInterface::setDetect(disp_pos_mode mode) { send(VescPacketSetDetect(mode)); }

I have commented it out and it works flawlessly now. YET. I've sensored motors, though.

ArtlyStyles commented 5 years ago

hi @mbudris: I actually do ot set the "setDetect" functoin in VescInterface.cpp. Are you using a different version of MIT-Racecar from this github?

mbudris commented 5 years ago

Sorry, that was another branch, indeed.

On Mon, Jun 3, 2019, 06:52 Artly notifications@github.com wrote:

hi @mbudris https://github.com/mbudris: I actually do ot set the "setDetect" functoin in VescInterface.cpp. Are you using a different version of MIT-Racecar from this github?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mit-racecar/vesc/issues/14?email_source=notifications&email_token=AB6J2CT7VQGIY7SD7A254BLPYSIRLA5CNFSM4GIYCSXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWYHOOY#issuecomment-498104123, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6J2CRHTFE67K4H6MZGSLDPYSIRLANCNFSM4GIYCSXA .