BrianPeek / legoev3

LEGO MINDSTORMS EV3 API for .NET
Apache License 2.0
137 stars 72 forks source link

Non-Integer Turn Ratio in StepMotorSync #27

Closed njsokalski closed 7 years ago

njsokalski commented 7 years ago

When using the StepMotorSync method, the turnRation parameter is of type Short (System.Int16), which is an integral value. How are we supposed to make the motors turn at ratios like 0.5, 1.25, etc.? The fact that it is of type Short obviously requires me to convert the value to a Short, which will cause rounding, almost defeating the purpose of having a ratio at all. Am I misunderstanding how this method is intended to be used? Thanks.

BrianPeek commented 7 years ago

Not possible...the parameter the brick is expecting is between -200 and 200 as an integer value.

njsokalski commented 7 years ago

I understand that, which is basically what my question was about. However, I think I managed to figure out how to do everything, but the documentation was very unclear about what the different values (or ranges of values) did, since it is not just a "ratio" of any numbers (it involved which direction, whether the ratio was A/B or B/A, etc.). The algorithm for finding the appropriate value was much more complex than I was expecting (I was expecting to just need A/B), but I guess I have to learn every part somehow.

Nathan Sokalski njsokalski@hotmail.commailto:njsokalski@hotmail.com http://www.nathansokalski.com/


From: Brian Peek notifications@github.com Sent: Thursday, April 13, 2017 4:12 AM To: BrianPeek/legoev3 Cc: njsokalski; Author Subject: Re: [BrianPeek/legoev3] Non-Integer Turn Ratio in StepMotorSync (#27)

Not possible...the parameter the brick is expecting is between -200 and 200 as an integer value.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/BrianPeek/legoev3/issues/27#issuecomment-293822914, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGA_R9Yyv3pM7Ww5lNGGAqIfPbHvIm8Aks5rvdjegaJpZM4M6cd5.