Coding in Degrees


I’m updating our code from revs to degrees because I was advised that it was far more accurate. However, when inputting a number (ex: 26.6), I’m receiving an error message on VCS that it is rounding it to simply 26. Can I not use decimals in degrees?


I’m assuming you’re trying to use some command like Motor.spin() or something. For these kinds of functions, you cannot use decimals as far as I know if degree is the specified rotation type because that is already such a small unit. You could always make a custom function that would accept a value as a decimal of a degree by having the parameter type be float or double. That would give you much more freedom.


Thank you! The difference of one degree is .0028 revs so I think the whole numbers will be fine, just didn’t know if anything more specific was possible


Any of the rotation types can be decimal, and they all have the same amount of precision, they are just scaled differently. All that is happening is the rotation type telling the brain how to relate your input in the specified units to an encoder count. The encoder is ultimately what will determine the precision of each move.