Skip to content

Driver Hub Battery: Feature request #1825

@TopProjectsCreator

Description

@TopProjectsCreator

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions