Reading motor position (eg. to determine claw orientation/degree)

Hi, we’re using V5. We have a motor that connects to an arm via a set of gears. Pretty much it’s like this:

Motor --> to small gear --> teeth are connected to teeth of larger gear ==> arm is connected to this larger gear.

We tried to use Motor::rotation(deg) to get the arm orientation/degree, but we couldn’t make sense of it… Do wer need to have some kind of calculation to “translate” it? Or we need to buy/use sensors (like “encoders”? But we thought V5 motors already have it built-in…)

Please advise…

Thanks

Yes motor.rotation(deg) is correct, it returns a double value of the motor’s intergrated encoder. Are you unsure how to recieve that value or what?

The encoder inside the v5 motor measures the rotation of the axle connected directly to the motor.

If your arm is not connected directly to the motor, the value will be wrong…

You can multiply the value of Motor::rotation(deg) by your gear ratio (e.g., 1/7) in order to get the rotation of the arm.

One important thing to note about encoders is that when you first turn the robot on, the position that the arm is in will be considered 0 degrees. In other words, the encoder measures the change in position since the robot was turned on. You might want to use a limit switch to get the absolute position.

1 Like

Got it… we’ll work on the math

Thanks