From 0fd381a4415aed07556a2991983d27e289afc3cc Mon Sep 17 00:00:00 2001 From: AchintyaAkula <154371377+AchintyaAkula@users.noreply.github.com> Date: Thu, 25 Dec 2025 20:04:35 -0800 Subject: [PATCH 1/5] Added docs for VoltageCompensatingMotor Added docs for voltage compensating motor, although example is little long, not sure how it will display --- .../hardware/motors-and-servos/motors.md | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/nextftc/hardware/motors-and-servos/motors.md b/src/nextftc/hardware/motors-and-servos/motors.md index d058afb..c0f4a0a 100644 --- a/src/nextftc/hardware/motors-and-servos/motors.md +++ b/src/nextftc/hardware/motors-and-servos/motors.md @@ -102,4 +102,40 @@ MotorGroup myMotorGroup = new MotorGroup( ); ``` -::: \ No newline at end of file +::: + +## `VoltageCompensatingMotor` + +`VoltageCompensatingMotor` is a class that takes into consideration the voltage +of the robot to set the power of a `MotorEx`, allowing the system to set power to +more or less than the user input, increasing the motor's consistency/stability +to perform in abnormal voltage levels. NextFTC allows for easy use of the +`VoltageCompensatingMotor` as shown below: + +:::tabs key:code +== Kotlin + +```kotlin +val myMotorEx = MotorEx("motor_name") + +val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx) + +// or with "ideal" voltage(Volts) and voltage caching time(seconds/Duration) specifications +val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, 500.milliseconds, 12.0) +val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, 0.5, 12.0) +val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, "0.5", 12.0) +``` + +== Java + +```java +MotorEx myMotor = new MotorEx("motor_name") + +VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx) + +// or with "ideal" voltage(Volts) and voltage caching time(seconds) specifications +VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx, 0.5, 12.0) +VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx, "0.5", 12.0) +``` + +::: From 8bef1f17c62e1b436486859128e49a1543647af1 Mon Sep 17 00:00:00 2001 From: AchintyaAkula <154371377+AchintyaAkula@users.noreply.github.com> Date: Thu, 25 Dec 2025 20:07:43 -0800 Subject: [PATCH 2/5] Added LoopTimeComponent to components list --- src/nextftc/concepts/components.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nextftc/concepts/components.md b/src/nextftc/concepts/components.md index 06f0a51..03aaf4d 100644 --- a/src/nextftc/concepts/components.md +++ b/src/nextftc/concepts/components.md @@ -10,6 +10,7 @@ NextFTC has several built-in components, including: - `BulkReadComponent` - `BindingsComponent` (for [NextBindings](/bindings)) +- `LoopTimeComponent` - `PedroComponent` (for the PedroPathing Extension) - `SubsystemComponent` - `CommandManager` @@ -90,4 +91,4 @@ init { ::: Components' `pre`- functions are called in the order they're set and `post`- -functions are called in the reverse order. \ No newline at end of file +functions are called in the reverse order. From 9e29a3232e5198833ff4239f316fa9d1089dd666 Mon Sep 17 00:00:00 2001 From: AchintyaAkula <154371377+AchintyaAkula@users.noreply.github.com> Date: Thu, 25 Dec 2025 20:15:16 -0800 Subject: [PATCH 3/5] Updated FeedbackCRServo usage example to match current constructors --- .../motors-and-servos/feedback-servos.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/nextftc/hardware/motors-and-servos/feedback-servos.md b/src/nextftc/hardware/motors-and-servos/feedback-servos.md index cd94f76..ca298c2 100644 --- a/src/nextftc/hardware/motors-and-servos/feedback-servos.md +++ b/src/nextftc/hardware/motors-and-servos/feedback-servos.md @@ -52,35 +52,19 @@ The caching tolerance is the same for any normal `ServoEx` or other implementati == Kotlin ```kotlin -val servo: FeedbackCRServoEx = FeedbackCRServoEx("analog-name", "servo-name", 0.01) - -// Alternatively val servo: FeedbackCRServoEx = FeedbackCRServoEx { cacheTolerance = 0.01, // Or whatever you'd like to use feedbackFactory = { ActiveOpMode.hardwareMap.analogInput.get("analog-name") }, servoFactory = { ActiveOpMode.hardwareMap.crservo.get("servo-name") } } - -// Alternatively -val analogInput: AnalogInput = ActiveOpMode.hardwareMap.analogInput.get("analog-name") -val servoFactory: CRServo = ActiveOpMode.hardwareMap.crservo.get("servo-name") -val servo: FeedbackCRServoEx = FeedbackCRServoEx(analogInput, servoFactory, 0.01) // Using cache tolerance = 0.01 ``` == Java ```java -FeedbackCRServoEx servo = new FeedbackCRServoEx("analog-name", "servo-name", 0.01); - -// Alternatively FeedbackCRServoEx servo = new FeedbackCRServoEx( 0.01, // Or your preferred cache tolerance () -> { ActiveOpMode.hardwareMap().analogInput.get("analog-name") }, () -> { ActiveOpMode.hardwareMap().crservo.get("servo-name") } ); - -// Alternatively -AnalogInput analogInput = ActiveOpMode.hardwareMap.analogInput.get("analog-name"); -CRServo servoFactory = ActiveOpMode.hardwareMap.crservo.get("servo-name"); -FeedbackCRServoEx servo = new FeedbackCRServoEx(analogInput, servoFactory, 0.01); ``` == ::: From 983598dcbb6332f4277a889f273b91a83fa6c480 Mon Sep 17 00:00:00 2001 From: AchintyaAkula <154371377+AchintyaAkula@users.noreply.github.com> Date: Thu, 25 Dec 2025 21:45:58 -0800 Subject: [PATCH 4/5] Added LoopTimeComponent to TeleOp guide Added LoopTimeComponent part to TeleOp section of guide --- src/guide/opmodes/teleop.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/guide/opmodes/teleop.md b/src/guide/opmodes/teleop.md index 8baf8a5..0a1b617 100644 --- a/src/guide/opmodes/teleop.md +++ b/src/guide/opmodes/teleop.md @@ -37,7 +37,9 @@ public class TeleOpProgram extends NextFTCOpMode { Just like for autonomous, we need to add the required subsystems as a `SubsystemComponent`. We will also add a `BulkReadComponent`. Additionally, we will add a `BindingsComponent`, which -allows us to use gamepads from [NextBindings](/bindings). +allows us to use gamepads from [NextBindings](/bindings). You could also +choose to add an instance of the LoopTimeComponent which will log your +looptimes to your telemetry periodically. :::tabs key:code @@ -49,7 +51,8 @@ class TeleOpProgram : NextFTCOpMode() { addComponents( SubsystemComponent(Lift, Claw), BulkReadComponent, - BindingsComponent + BindingsComponent, + LoopTimeComponent() ) } } @@ -63,7 +66,8 @@ public class TeleOpProgram extends NextFTCOpMode { addComponents( new SubsystemComponent(Lift.INSTANCE, Claw.INSTANCE), BulkReadComponent.INSTANCE, - BindingsComponent.INSTANCE + BindingsComponent.INSTANCE, + new LoopTimeComponent() ); } } From ee7b69ecdc46d27f04ba627544c67dd2cec6767c Mon Sep 17 00:00:00 2001 From: AchintyaAkula <154371377+AchintyaAkula@users.noreply.github.com> Date: Wed, 7 Jan 2026 21:35:55 -0800 Subject: [PATCH 5/5] Fixed duration formats in examples Updated examples of VoltageCompensatingMotor initialization to use numeric values instead of strings for voltage caching time. --- src/nextftc/hardware/motors-and-servos/motors.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nextftc/hardware/motors-and-servos/motors.md b/src/nextftc/hardware/motors-and-servos/motors.md index c0f4a0a..3ff35c6 100644 --- a/src/nextftc/hardware/motors-and-servos/motors.md +++ b/src/nextftc/hardware/motors-and-servos/motors.md @@ -123,7 +123,6 @@ val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx) // or with "ideal" voltage(Volts) and voltage caching time(seconds/Duration) specifications val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, 500.milliseconds, 12.0) val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, 0.5, 12.0) -val myVoltageCompensatingMotor = VoltageCompensatingMotor(myMotorEx, "0.5", 12.0) ``` == Java @@ -135,7 +134,7 @@ VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMot // or with "ideal" voltage(Volts) and voltage caching time(seconds) specifications VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx, 0.5, 12.0) -VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx, "0.5", 12.0) +VoltageCompensatingMotor myVoltageCompensatingMotor = new VoltageCompensatingMotor(myMotorEx, "500ms", 12.0) ``` :::