FtcRobotController icon indicating copy to clipboard operation
FtcRobotController copied to clipboard

Driver Hub Battery: Feature request

Open TopProjectsCreator opened this issue 1 month ago • 1 comments

I know that you can find the battery of the control hub by:

package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.VoltageSensor;

@TeleOp(name = "MonitorVoltageOpMode", group = "FTC")
public class MonitorVoltageOpMode extends LinearOpMode {

    @Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();

        waitForStart();

        while (opModeIsActive()) {
            // Get the primary voltage sensor from the hardware map
            // The FtcRobotController automatically puts voltage sensors into the hardware map
            VoltageSensor batterySensor = hardwareMap.voltageSensor.iterator().next();

            // Read the voltage
            double voltage = batterySensor.getVoltage();

            // Display the voltage on the Driver Station telemetry
            telemetry.addData("Robot Battery Voltage", "%.2f V", voltage);
            telemetry.update();
        }
    }
}

But why cant you find the battery level of the driver hub?

TopProjectsCreator avatar Nov 20 '25 01:11 TopProjectsCreator

Out of curiousity, what decision would your robot make based off of the battery level of the driver hub?

alan412 avatar Nov 20 '25 11:11 alan412