Skip to content

bouyio/Cyan-FTC

Repository files navigation

Cyan-FTC

A lightweight motion-planning library for FIRST Tech Challenge teams.


✨ Overview

Cyan-FTC is a community-driven project independent of any single FTC team.
Its mission is to make advanced autonomous movement approachable for rookie teams while still being powerful enough for veterans.

Using Cyan-FTC at the Greek FTC Championship?
Come say hi—I’d love to hear about your experience and help with any issues.


💡 Features

Category Highlights
Localization Plug-and-play odometry (GyroTankOdometry, TankKinematics) or bring your own by implementing PositionProvider.
Path Following Pure Pursuit with configurable look-ahead, distance tolerance, and PID gains.
Unit-Aware Math Smart Distance, Vector, and Point classes—convert seamlessly between in, cm, m, ticks, etc.
Modularity First Works with tank, 2-wheel, 3-wheel, and (soon™) mecanum drivetrains.
Rookie Friendly Clean API, extensive Javadoc, and annotated examples.

📦 Installation

Prerequisites

Step-by-Step

  1. Add JitPack to your root build.dependencies.gradle:

    repositories {
        // …other repositories…
        maven { url "https://jitpack.io" }
    }
  2. Add Cyan-FTC to TeamCode/build.gradle:

    dependencies {
        implementation "com.github.bouyio:Cyan-FTC:1.2.3"
    }
  3. Sync Gradle & build. Done! 🎉


🏁 Getting Started

The quickest way to explore Cyan-FTC is via the disabledSamples package in the quickstart repository.
Below is a high-level tour—see 📚 Javadocs (link once published) for full details.

Localization

  1. Create a measurement provider

    DoubleSupplier leftEnc  = leftEncoder::getCurrentPosition;
    DoubleSupplier rightEnc = rightEncoder::getCurrentPosition;
    DoubleSupplier heading  = imu::getAngle;            // degrees (CCW +)
    
    double ticksPerMeter = /* 2 π r / ticksPerRev */;
    var provider = new GyroTankOdometry.MeasurementProvider(
            leftEnc, rightEnc, heading, ticksPerMeter);
  2. Initialize odometry

    SmartVector2 startPos = new SmartVector2(0, 0, DistanceUnit.METER);
    double startHeading  = 0;       // rad
    
    GyroTankOdometry odometry =
            new GyroTankOdometry(startPos, startHeading, provider);
  3. Update (automatic or manual)

    odometry.update();   // call in your OpMode loop if manual
No IMU? Use TankKinematics
DoubleSupplier leftEnc  = leftEncoder::getCurrentPosition;
DoubleSupplier rightEnc = rightEncoder::getCurrentPosition;
double trackWidth       = 0.32;    // meters

var provider = new TankKinematics.MeasurementProvider(
        leftEnc, rightEnc, ticksPerMeter);

TankKinematics odometry =
        new TankKinematics(startPos, startHeading, trackWidth, provider);

Point Following

PathFollower follower = new PathFollower(odometry);    // default PID
Point goal = new Point(1.2, 0.8, DistanceUnit.METER);

follower.followPoint(goal);

double[] motor = follower.getCalculatedPowers();
leftMotor.setPower(motor[0] + motor[1]);
rightMotor.setPower(motor[0] - motor[1]);

Sequencing & Paths

  • PointSequence for visiting waypoints in order.
  • Path + purePursuitSetup() for smooth curves (Pure Pursuit).

🔄 Changes in v1.2

  • New copy and reverse methods for paths and point sequences.
  • Fixed PathFollower bug leading to endless oscillation.
  • Renamed GyroTankOdometry.GyroTankMeasurementProvider and TankKinematics.TankKinematicsMeasurementProvider to GyroTankOdometry.MeasurementProvider and TankKinematics.MeasurementProvider respectively.

🔄 Changes in v1.2.2

  • Added reverse driving capabilities.
  • Added system identification info.

🗂 Usage Examples

Find example opModes in the disabledSamples package of the quickstart repository.


❓ FAQ

Question Answer
“When will mecanum be supported?” Soon™
“Can I use XYZ drivetrain?” Of course—implement PositionProvider.
“Is there documentation?” Javadoc is generated each release. Detailed guides are WIP.
More Qs? Open an issue or ping me on Discord.

🤝 Contributing

Contributions are welcome! Please:

  1. Fork & create a feature branch.
  2. Follow the code-style guidelines (KTlint/Checkstyle config coming soon).
  3. Make sure ./gradlew check passes.
  4. Open a PR—fill in the template.

📝 License

This project is MIT-licensed.
See LICENSE for details.


📜 Acknowledgements

Path-following logic was inspired by Gluten Free’s excellent tutorials—watch them here.

Dedicated to Foivos, my rookie-year teammate who made autonomous fun.

About

Cyan is a simple motion planning library, made for the FIRST Tech Challenge.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages