I created a more accurate way to move a motor by DPS

OK so some of you may know that the set_motor_dps function for the BrickPi3 is a very inaccurate. So I have created a simple Python function that allows accurate movement of a motor in Degrees Per Second.

The accuracy isn’t perfect. get_motor_status indicated that my function was off by a maximum of 20 DPS, but that’s maximum. I also added the ability to move the motor to a target position using DPS instead of speed. So it is exactly like set_motor_position except with DPS. I’ve tested the accuracy by having move the motor 360 degrees at 100, 200, and 300 DPS and they all had pinpoi accurate. At a higher DPS like 600 you really start to notice a little slippage in the breaking. However it isn’t really any different than the current set_motor_position function.

Note this function I made is not complete! I will be increasing the accuracy even more. Also the function doesn’t yet have the ability to run the motors in reverse. And finally here’s how you use it: `move_DPS(port, DPS, target_position) The target position argument is option all. If left out e motor will run continuously at the given DPS until stopped.

I also have no idea why the second paragraph is in bold. ???

Note this function works very well unless until you put a load on the motors. I am looking into ways to fix this.

Also big shout out to @Matt, the encoder superhero, for showing me how to move a motor in DPS. I think this is the 3rd time @Matt has saved the day for me in encoders? 4th? I lostount. :slight_smile: