/SpartronicsLib

FRC library with V-SLAM, trajectory generation, and LIDAR object detection capabilities

Primary LanguageJavaGNU Lesser General Public License v3.0LGPL-3.0

SpartronicsLib

This is Spartronics FRC Team 4915's year-independent library. Features include:

  • JNI bindings for the Intel RealSense T265 camera which allow for seamless, plug-and-play V-SLAM on the roboRIO.
  • A pure Java RPLidar A1M8 driver that works on the roboRIO, along with a 2D LIDAR object detection algorithim that works on squares and circles. Also includes a LIDAR target tracker.
  • An A* path finder that can generate the waypoints for a trajectory that avoids arbitrary axis-aligned obstacles.
  • A trajectory generator and followers fast enough to generate trajectories on the fly (<20 ms generation time), along with a variety of constraints to make trajectories driveable.
  • Motor wrappers to abstract the various FRC-legal motor controllers and to ease unit conversions.
  • Unit conversion, logging and other handy utilities.

Demo Videos

Click on the below thumbnails to play the videos.

LIDAR object detection on the 2020 Power Cell gamepieces

Thumbnail and link for a video demoing detecting power cells with LIDAR

Generating a trajectory on the fly to an object detected with LIDAR

Odometry is provided by the V-SLAM camera. The robot drive to the center of the ball.

Thumbnail and link for a video demoing the robot driving to a ball detected with LIDAR, using V-SLAM for odometry during trajectory following.

Using SpartronicsLib

For other teams

First, add the JitPack repository to your build.gradle:

repositories {
    maven { url 'https://jitpack.io' } // Add this line
}

Then, add SpartronicsLib as a dependency (note that this will use the latest version of SpartronicsLib on the master branch; to use something different you should change the master-SNAPSHOT bit):

dependencies {
    implementation "com.github.Spartronics4915:SpartronicsLib:master-SNAPSHOT"
}

For Spartronics

Although the above approach makes it easy to share, separate, and track commits to SpartronicsLib, it's not sufficiently beginner-proof. For this reason, SpartronicsLib is copied into our year-specific repo for your use, and then copied out with the Git history at the end of the year. This means that beginners don't need to remember to commit and push in two places, to use --include-build, or to pass --refresh-dependencies, or to do anything else special.

Although this "copy" approach is kludgy and painful, it's the price we have to pay to reduce footguns that cause issues during competition.

Contributing to SpartronicsLib

When adding features to SpartronicsLib, it is reccomended that you include a unit test. The unit testing is very easy, and in many cases it means that you don't need to make another project or have a robot to test your feature.

If you do want to make a change to SpartronicsLib while it's included in an external project, then you should use a local copy of SpartronicsLib instead of the Jitpack one when building your external project. This is easy as passing --include-build ../path/to/SpartronicsLib to the Gradle wrapper when building or testing your external project.