Skip to content

5818 lib

Boomaa23 edited this page May 26, 2021 · 1 revision

5818-lib

At the end of the 2020 season the team created a library to include most of the basic robot utilities and tools that end up being copied and pasted from year to year in the exact same format. This page describes the proper way to include and use the 5818-lib library. Note that this should be used for production-level code on final robots. It is beneficial to write through this content yourself to learn if you have not been exposed to the content of 5818-lib.

Refer to the source code with embedded documentation for more detail. Use these functions before writing a custom implementation.

Usage

Insert this into the build.gradle.kts for your project. Three dots symbolize other data that may remain. Re-sync the Gradle project after entry.

dependencies {
    implementation("org.rivierarobotics:5818-lib:X.X.X")
    ...
}
...
repositories {
    maven {
        name = "octyl.net"
        url = uri("https://maven.octyl.net/repository/team5818-releases")
    }
    ...
}

Remember to change the version number to the latest, found at the source code as the latest commit message with "pre tag commit" in the commit message. An example can be found below:

[Gradle Release Plugin] - pre tag commit: 'vX.X.X'.

Assorted

  • MathUtil: Helpers for generic conversions. Includes joystick deadband fitting, wrapping angles to circle, value limiting, converting degrees to ticks (and vice versa), and arcade drive calculations.

Motor Controllers

  • MotionMagicSetPosition: Command to set a position using a Motion Magic enabled CTRE motor controller. Includes getters/setters (overridable methods) for loops with timeout and positional limiting.
  • MotorUtil: Common calls to motor controller APIs. Currently includes Motion Magic setup and soft limit setting for CTRE controllers.

PID

  • PIDConfig: Stores P (proportional), I (integral), D (derivative), and F (feed-forward) gain values for an accompanying PIDF loop. Optional storage for PID tolerance (WPI PID controller only) and output range.
  • CTREMultiPID: Can switch between multiple PID configurations. Typically corresponds with position and velocity loop switching. Requires a CTRE controller that has already been set up for Motion Magic.
  • WPIMultiPID: Similar to CTREMultiPID except control loop is calculated synchronously by WPI included PIDController. Does not support a feed-forward and requires a tolerance (default 0).
  • PIDStore: Base class for "MultiPID" type classes, do not instantiate/use (recommended).

Shuffleboard

These classes aim to simplify putting objects onto the Shuffleboard into a similar process as SmartDashboard. Data is organized under the Shuffleboard into tabs, and from there into entries or tables with entries in them.

  • RobotShuffleboard: Base class. Instantiate only a single object. Inject if necessary.
  • RSTab: Stores a single Shuffleboard tab, contains all entries (get/set).
  • RSTable: Stores a table under a Shuffleboard tab, also contains entries but within a table.
  • RSTileOptions: Options for setting entries to a Shuffleboard tab or table.

Examples

Clone this wiki locally