Class PretendServo
java.lang.Object
com.crossbotics.ftchelper.testkit.PretendServo
A pretend servo for JUnit tests: it remembers the position it was sent (NaN = none yet, like a real
servo before its first command). Get one from
PretendDevices.servo(String).
robot.claw.close();
assertEquals(0.70, devices.servo("claw").position, 1e-9);
Docs: docs/modules/testkit.md-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.qualcomm.robotcore.hardware.Servo.DirectionFORWARD or REVERSE, as set.doubleThe last position sent, 0 to 1 (NaN = never sent).double[]The pulse range set with.fullRange()({low, high} microseconds), or null (the SDK's 600-2400).final com.qualcomm.robotcore.hardware.ServoThe SDK servo to hand to code that wants one (it is also a PwmControl, like a hub servo).intHow many positions were sent. -
Constructor Summary
ConstructorsConstructorDescriptionA new pretend servo on a hub (it can change its pulse range). -
Method Summary
-
Field Details
-
position
public double positionThe last position sent, 0 to 1 (NaN = never sent). -
writes
public int writesHow many positions were sent. -
direction
public com.qualcomm.robotcore.hardware.Servo.Direction directionFORWARD or REVERSE, as set. -
pulseUs
public double[] pulseUsThe pulse range set with.fullRange()({low, high} microseconds), or null (the SDK's 600-2400). -
servo
public final com.qualcomm.robotcore.hardware.Servo servoThe SDK servo to hand to code that wants one (it is also a PwmControl, like a hub servo).
-
-
Constructor Details
-
PretendServo
public PretendServo()A new pretend servo on a hub (it can change its pulse range).
-