Hi All
Next question. I have PWM control of my scooter hub drive wheels working, but with the ODrive being as accurate as it is, there doesn’t seem to be any concept of “stopped”. At the moment with my RC control sticks centered there is still a good chance the ODrive will register around 0.1RPM and if I left my robot alone for 10 minutes it would be half way across the room.
So, my question is where do I start with trying to add a dead-zone to the speed control in the ODrvie firmware. It should be pretty easy, something like:
If(requestedspeed > -0.2rpm and requestedspeed < 0.2rpm) then requestedspeed = 0
Unfortunately I am no C or C++ programmer and the source code is well over my head. Any suggestions at where I could start looking?
Obviously this would be best set as a configurable value, something like “minimum speed” under which the speed would drop to exactly 0.
Any advice would be appreciated.
Thanks
Martin
Ok, I had a fresh look at it, and it looks like it would be possible to add at the same place that the velocity limiting is done in controller.cpp
Something like:
// Velocity limiting
float vel_lim = config_.vel_limit;
if (vel_des > vel_lim) vel_des = vel_lim;
if (vel_des < -vel_lim) vel_des = -vel_lim;
// Velocity dead-zone
float min_vel = 0.2f;
if ((vel_des < min_vel) AND (vel_des > -min_vel)) vel_des = 0.0f;
Does that make sense?
Obviously it would be better to not use hard coded minimum speeds but for my use I can work with that.
Yes you can do that.
For the future, we should probably have an “input filter module” for things like stick mixing, deadband, and setpoint filtering. I added a feature request here.
Hi guys, is that feature already in the latest’s firmware? This PWM deadband would be very welcome as my RC car radio (with the wheel) has like about 2% accuracy when returning to zero. This will make motors creep at like .5 rpm and since the machine is tracked and 100kg they will start to warm up quickly and past 70 deg C all sorts of bad things start happening. A configurable dead band would be an absolute luxury.
I have read as much as I can find and from what I tell the whole thing was just dropped which is a pity. I think its fair to say that without this feature, PWM based control from an RC transmitter is not usable. No matter how good the TX/RX combo are you will never get a neutral.
If I have missed something please let me know.
Thanks,
Serge
A transmitter that would have a built in dead band control itself would also be an answer.
I still hope I can come back to my garden tracked robot soon and honestly I was hopping that feature would be long implemented. bummer It is not like rocket science like one variable to ignore range around zero.
We’ll have deadband in an upcoming ODrive firmware release for S1/Pro/Micro! If you’re using a v3.6, it should be fairly simple to implement yourself.