Skip to content

Robot Map

James Hagborg edited this page Dec 17, 2018 · 1 revision

HYPERLib also provides support for a Robot Map File, which is just a class with a collection of constants for each port number used, together with annotations to mark what type of port each constant is. HYPERLib can validate this file and generate a wiring diagram, just as it can with the OI Map. This doesn't affect the execution of the code in any way; it's just a handy bookkeeping device. This page will be updated when the Gradle script to make this happen is done.

As a real-life example:

public class RobotMap {
    public static class DriveTrain {
        @Port(type = Type.PWM) public static final int LEFT_MOTOR = 0;
        @Port(type = Type.PWM) public static final int RIGHT_MOTOR = 1;
        @Port(type = Type.RELAY) public static final int LIGHTS = 3;
    }

    public static class Collector {
        @Port(type = Type.PWM) public static final int MOTOR = 6;
        @Port(type = Type.DIO) public static final int DOWN_SWITCH = 7;
    }

    public static class WheelyBar {
        @Port(type = Type.PWM) public static final int LIFT_MOTOR = 7;
        @Port(type = Type.ANALOG) public static final int POT = 0;
    }

    public static class Shooter {
        @Port(type = Type.PWM) public static final int WHEEL_MOTOR = 2;
        @Port(type = Type.PWM) public static final int ANGLE_MOTOR = 3;
        @Port(type = Type.PWM) public static final int HOLDER_SERVO = 4;
        @Port(type = Type.PWM) public static final int TRIGGER_SERVO = 5;
        @Port(type = Type.DIO) public static final int ENCODER_A = 8;
        @Port(type = Type.DIO) public static final int ENCODER_B = 9;
    }

    public static class Climber {
        @Port(type = Type.RELAY) public static final int POLE_MOTOR = 2;
        @Port(type = Type.RELAY) public static final int WINCH_MOTOR = 1;
        @Port(type = Type.DIO) public static final int POLE_ENCODER_A = 1;
        @Port(type = Type.DIO) public static final int POLE_ENCODER_B = 2;
        @Port(type = Type.DIO) public static final int WINCH_ENCODER_A = 4;
        @Port(type = Type.DIO) public static final int WINCH_ENCODER_B = 5;

    }
}

Wiring Diagram

Clone this wiki locally