ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
422 stars 146 forks source link

enhancement - automatically adding ramp up and ramp down of motors #759

Closed foocross closed 3 years ago

foocross commented 3 years ago

I don't believe this is a built in feature already, but if there is I apologize as we have just started using this library.

It would nice if there was an option to ramp up the motor speed/power at start of a movement and ramp down the speed/power end of a movement. This would help prevent the robot from slipping at for fast movements and tipping over at sudden stops.

WasabiFan commented 3 years ago

I should preface what I'm about to say with the caveat that there may be bugs in this functionality, so you'll have to try it and see.

There are ramp_up_sp and ramp_down_sp properties on the motors, which shadow properties on the underlying drivers. The documentation is here: https://python-ev3dev.readthedocs.io/en/ev3dev-stretch/motors.html#ev3dev2.motor.Motor.ramp_up_sp

You would set the property to a number of milliseconds when you construct the motor object, and then it should apply to all future uses of the motor.

This functionality is not often used, so as I said above, it may require some experimentation.

foocross commented 3 years ago

Thanks- we will try it.