Skip to content
Autumn edited this page Apr 26, 2023 · 2 revisions

Wrappers all around!

NE-Robotics wrappers library is designed to provide easy interchange between motor controllers, gyroscopes, & encoders the system works by interfacing with abstracted classes which allow for the functional change in code between types as simple as changing an enum.

Getting Started

Navigate to your build.gradle and add the following

maven {
        url = uri("https://maven.pkg.github.com/NE-Robotics/wrappers")
        credentials {
            username = "Mechanical-Advantage-Bot"
            password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051"
        }
}

and inside of dependencies add

implementation 'com.northeasternrobotics.wrappers:wrappers:0.1.+'

Example

import com.northeasternrobotics.wrappers.motorcontrollers.WrapperedCANMotorCtrl;

wheelMotor = new WrapperedCANMotorCtrl(
                prettyName,
                CANID,
                CANMotorCtrlType.TALONFX
        );

wheelMotor.setInverted(true);
wheelMotor.setNeutralMode(NeutralMode.Break);
wheelMotor.setClosedLoopGains(wheel_kP, wheel_kI, wheel_kD);

Note that the only difference between this code for a TalonFX & for example a Spark Max is the following

CANMotorCtrlType.SPARK_MAX
Clone this wiki locally