Skip to content

Commit 12b3b5c

Browse files
author
年迈的老秋风Windy
committed
Add range control for ServoUsingMotor
1 parent c3c5f38 commit 12b3b5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/darbots/corebotlib/hardware/ServoUsingMotor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public double encoderTicksToTargetPosition(long ticks){
8585
return (ticks - encoderTickAtZeroPos) / motor.getEncoderType().getTicksPerRev();
8686
}
8787

88-
8988
@Override
9089
public void setTargetPosition(double targetPosition) {
90+
targetPosition = Range.clip(targetPosition,this.minimumPosition,this.maximumPosition);
9191
this.motor.setTargetPositionTick(this.targetPositionToTicks(targetPosition));
9292
this.targetPosition = targetPosition;
9393
this.lastIsBusy = true;

0 commit comments

Comments
 (0)