This project has moved. For the latest updates, please go here.

Controlling Motors for XX degrees of rotation?

Nov 13, 2013 at 5:15 PM
Firstly, well done on this - have been playing with this all morning and it's very simple to use but very powerful.

I have a suggestion (this may be already supported and I have missed it, if so I apologize!).
I notice that I can call 'TurnMotorAtSpeed' or 'TurnMotorAtPower', along with 'TurnMotorAtSpeedForTime' or 'TurnMotorAtPowerForTime'.
It would be nice if you could include something along the lines of 'TurnMotorAtSpeedForRotation', or at the very least overload the TurnMotorAtSpeed parameters, so you could optionally specify the max rotation.

I know you can use the BrickChanged event to monitor the rotation of the motor and stop it once it reaches the desired angle and that does work well, but it makes it a little more complicated than it otherwise could be.

Love this SDK though, lots of fun!
Nov 13, 2013 at 6:06 PM
Edited Nov 13, 2013 at 6:11 PM
Glad you're liking the library!

Unfortunately there's no "native" command on the EV3 brick to accomplish this. You can use the StepMotor methods to approximate the functionality. If memory serves, those methods will step the provided number of degrees from the current position. Not exactly what you're looking for where (what I think you're saying) you want to move the motor to 120 degrees absolute and stop. Steps are relative.

Regardless, I'll see if I can come up with something for a future release that achieves the functionality you're after.

Thanks for the request!