Skip to content

auto following works now with the json#3

Open
Dhairya-exe wants to merge 2 commits intomainfrom
new
Open

auto following works now with the json#3
Dhairya-exe wants to merge 2 commits intomainfrom
new

Conversation

@Dhairya-exe
Copy link
Copy Markdown

everything in autorunner.java and the sample_path.json in the deploy directory


@Override
public void execute() {
if (currentIndex >= points.size())
Copy link
Copy Markdown
Contributor

@John-Wiens John-Wiens Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also always use {}

double distance = Math.hypot(dx, dy);
double dtheta = wrapAngle(target.theta - pose.getRotation().getRadians());

if (distance < POSITION_TOLERANCE && Math.abs(dtheta) < ANGLE_TOLERANCE) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic will not work properly depending on sample rate.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made it time based instead so I don't need to use that logic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for? Is it related to pathing?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just the april tag map for the cameras

public static final double ACCURATE_FOLLOWER_FEED_FORWARD_MULTIPLIER = 1;
public static String[] paths;

static {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you still using .polarauto files?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to .json

return driverController.getRightTriggerAxis();
}

// public static double getDriverLTPercent() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove code instead of just commenting it out.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its for the other controller that has a bad trigger.


public static double getOperatorRightY() {
double rightX = operatorController.getRightX(), rightY = operatorController.getRightY();
if (Math.hypot(rightX, rightY) < Constants.OperatorConstants.LEFT_STICK_DEADZONE) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you comparing your right joystick values to the left stick deadzone

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return leftY;
}

public static double getOperatorRightX() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you comparing your right joysticks to the left stick dead zone.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

// Dictates the inputs and outputs
private double maxInput;
private double minInput;
private double maxOutput = 1500;// defaults to 100% and -100% motor power
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these set to 1500? Should be -1 and 1 for 100% power

import frc.robot.tools.math.Vector;

public class Peripherals {
private PhotonCamera frontReefCam = new PhotonCamera("Front_Reef");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove code components you don't have implemented yet.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is too much code in drive that references the camera stuff, but it doesn't effect anything if I don't have anything plugged in.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements an autonomous path following system using JSON-based configuration. The main changes add infrastructure for conditional execution, path following commands, and various utility classes for vector math, PID control, and robot subsystems.

Reviewed changes

Copilot reviewed 45 out of 48 changed files in this pull request and generated 22 comments.

Show a summary per file
File Description
photonlib.json, WPILibNewCommands.json, Phoenix6-frc2025-latest.json, AdvantageKit.json Added vendor dependency configurations for vision, commands, motor controllers, and logging
AutoFollower.java Abstract base class defining interface for path following commands
Vector.java Vector math utility for 2D calculations
PID.java (tools/math) Basic PID controller implementation
PID.java (tools/controlloops) Enhanced PID controller with detailed documentation
TriggerButton.java Simple wrapper extending WPILib Trigger
PathLoader.java Utility to load path data from JSON files
SwerveModule.java Comprehensive swerve module control implementation
Superstructure.java High-level robot state management
Peripherals.java Sensor and camera management subsystem
Drive.java Main drive subsystem with path following, odometry, and vision
Conditional classes Interface and implementations for autonomous branching logic
SetRobotState commands Various command classes for state management
AutoRunner.java Command orchestrator for JSON-based autonomous routines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import java.util.function.BooleanSupplier;
import java.util.function.IntFunction;

import javax.lang.model.util.ElementScanner14;
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import 'javax.lang.model.util.ElementScanner14' should be removed. This is a compiler-related utility that is not used anywhere in this file and should not be present in robot code.

Copilot uses AI. Check for mistakes.

import org.littletonrobotics.junction.Logger;

import com.fasterxml.jackson.databind.ser.BeanSerializer;
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import 'com.fasterxml.jackson.databind.ser.BeanSerializer' should be removed. This import is not used anywhere in the file.

Copilot uses AI. Check for mistakes.
package frc.robot.subsystems;

import java.util.function.BooleanSupplier;
import java.util.function.IntFunction;
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import 'java.util.function.IntFunction' should be removed. This import is not used anywhere in the file.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +36
private void check() {
if (condition.getAsBoolean()) {
runCommands();
}
}
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'check()' method is never called, making this Trigger class non-functional. Either implement periodic checking (e.g., in Robot.periodic) or remove the unused method.

Copilot uses AI. Check for mistakes.
import edu.wpi.first.wpilibj2.command.Command;

public abstract class AutoFollower extends Command {
/** Creates a new PolarTakeDrive. */
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect JavaDoc comment references 'PolarTakeDrive' instead of 'AutoFollower'. The documentation should match the actual class name.

Copilot uses AI. Check for mistakes.
/**
* Converts feet to meters.
*
* @param inches The length in feet to be converted.
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param tag "inches" does not match any actual parameter of method "feetToMeters()".

Suggested change
* @param inches The length in feet to be converted.
* @param feet The length in feet to be converted.

Copilot uses AI. Check for mistakes.
/**
* Converts a quantity in degrees to rotations.
*
* @param rotations The quantity in degrees to be converted.
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param tag "rotations" does not match any actual parameter of method "degreesToRotations()".

Suggested change
* @param rotations The quantity in degrees to be converted.
* @param degrees The quantity in degrees to be converted.

Copilot uses AI. Check for mistakes.
/**
* Converts a quantity in degrees to radians.
*
* @param rotations The quantity in degrees to be converted.
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param tag "rotations" does not match any actual parameter of method "degreesToRadians()".

Suggested change
* @param rotations The quantity in degrees to be converted.
* @param degrees The quantity in degrees to be converted.

Copilot uses AI. Check for mistakes.
/**
* Converts revolutions per second (RPS) to revolutions per minute (RPM).
*
* @param RPM The value in revolutions per second (RPS) to be converted.
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param tag "RPM" does not match any actual parameter of method "RPSToRPM()".

Suggested change
* @param RPM The value in revolutions per second (RPS) to be converted.
* @param RPS The value in revolutions per second (RPS) to be converted.

Copilot uses AI. Check for mistakes.
/** Creates a new PolarTakeDrive. */
public abstract int getPathPointIndex();

public abstract void initialize();
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method overrides Command.initialize; it is advisable to add an Override annotation.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants