FtcRobotController
FtcRobotController copied to clipboard
Driver Hub Battery: Feature request
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?
Out of curiousity, what decision would your robot make based off of the battery level of the driver hub?