public abstract class RobotHardware
extends java.lang.Object
This class represents a hardware configuration on the robot. Subclasses should contain public motors, servos, and sensors properties corresponding to the devices defined in the robot config file,
For example:
public class DemoRobot implements RobotHardware {
public DcMotor motorRight;
public DcMotor motorLeft;
public DcMotor motorHarvester;
public Servo servoClaw;
@Override
public void instantiateHardware(HardwareMap hardwareMap) {
//Drive Motor Setup
motorLeft = hardwareMap.dcMotor.get("left");
motorRight = hardwareMap.dcMotor.get("right");
motorLeft.setDirection(DcMotor.Direction.REVERSE);
//Auxiliary motor setup
motorHarvester = hardwareMap.dcMotor.get("harvester");
//Servo setup
servoClaw = hardwareMap.servo.get("claw");
}
}
| Constructor and Description |
|---|
RobotHardware() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
instantiateHardware(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap)
Instantiates motor, sensor, and servo properties with appropriate objects
|