Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
/ SwerveLibrary Public archive
forked from frc-88/SwerveLibrary

Swerve controls code developed by FRC Team 88 TJ². Capable of controlling both standard and differential swerves.

License

Notifications You must be signed in to change notification settings

ligerbots/SwerveLibrary

 
 

Repository files navigation

Actions Status Maven Central javadoc

SwerveLibrary

Swerve controls code developed by FRC Team 88 TJ². Capable of controlling both standard and differential swerves.

SwerveLibrary is the officially supported software library for TJ²'s Diff Swerve 2021.

Intended for use with the wpilib Java framework.

Installation

To install, simply add the following line to the dependencies section of build.gradle

dependencies {
    // WPILIB autofills this section with some code. Do not delete it.
    
    compile "io.github.frc-88:swerve:0.2.0"
}

At this time, in order for the library to work, you must have both the pheonix and rev-robotics vendor dependencies installed. See the instructions from WPILIB on how to do this.

Usage

SwerveLibrary makes use of an extensive configuration scheme for describing the robot setup. Below is an example of a minimal config file.

swerve.toml

[gyro]
template = "navx" # The type of gyro being used.
port-type = "I2C" # The type of port the navx is plugged into.
port = "kMXP" # The name of the port, as passed into the navx constructor.

[[modules]]
template = "team88.diff-swerve-2021.beta" # The template for the module.
location-inches = { x = 10.991, y = 12.491 } # The location of the module.
motors.lo.can-id = 0 # The CAN ID of the first motor.
motors.hi.can-id = 1 # The CAN ID of the second motor.
azimuth-sensor.can-id = 0 # The CAN ID of the CANCoder.
azimuth-sensor.offset = 0 # The degrees to subtract from the read module angle.

[[modules]]
template = "team88.diff-swerve-2021.beta" # The template for the module.
location-inches = { x = -10.991, y = 12.491 } # The location of the module.
motors.lo.can-id = 2 # The CAN ID of the first motor.
motors.hi.can-id = 3 # The CAN ID of the second motor.
azimuth-sensor.can-id = 1 # The CAN ID of the CANCoder.
azimuth-sensor.offset = 0 # The degrees to subtract from the read module angle.

[[modules]]
template = "team88.diff-swerve-2021.beta" # The template for the module.
location-inches = { x = -10.991, y = -12.491 } # The location of the module.
motors.lo.can-id = 12 # The CAN ID of the first motor.
motors.hi.can-id = 13 # The CAN ID of the second motor.
azimuth-sensor.can-id = 2 # The CAN ID of the CANCoder.
azimuth-sensor.offset = 0 # The degrees to subtract from the read module angle.

[[modules]]
template = "team88.diff-swerve-2021.beta" # The template for the module.
location-inches = { x = 10.991, y = -12.491 } # The location of the module.
motors.lo.can-id = 14 # The CAN ID of the first motor.
motors.hi.can-id = 15 # The CAN ID of the second motor.
azimuth-sensor.can-id = 3 # The CAN ID of the CANCoder.
azimuth-sensor.offset = 0 # The degrees to subtract from the read module angle.

Place this file in the src/main/deploy/ directory of your robot project, so it will upload to the RoboRIO whenever code is deployed.

The API for this library is provided through the SwerveController class, which is constructed with the path to the config file in the deploy directory.

import frc.team88.swerve.SwerveController;

// ...

SwerveController swerveController = new SwerveController("swerve.toml");

Documentation

See the wiki page for further usage documentation.

Javadocs for this project can be found here.

Examples

Example projects using this library can be found in examples/

Support

For support, contact Paul Terrasi at [email protected]

About

Swerve controls code developed by FRC Team 88 TJ². Capable of controlling both standard and differential swerves.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%