- Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Description
In ServoImpl#getPosition,reverse is called on the unscaled position in getPosition. While in ServoImpl#setPosition, reverse is called on scaled values. This means Servo#getPosition return incorrect values for reversed scaled servos.
Example
Let's say we have a reversed servo scaled from 0 to 0.5 instead of from 0 to 1:
Setting:
setPosition(0.5)-> sets an actual position of0.25for the servo.
Getting:
ServoController#getServoPositionreturns0.25(line 178)reversereverses the value from0.25to0.75(line 179)Range.scalescales the value from0.75to1.5(line 180)Range.clipclips the value to1
Result
We expect to get 0.5, not 1
Code Screenshot

Metadata
Metadata
Assignees
Labels
No labels