Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pathfinder basic #27

Open
wants to merge 2 commits into
base: Chassis-Code
Choose a base branch
from
Open

Pathfinder basic #27

wants to merge 2 commits into from

Conversation

billwpierce
Copy link
Member

Basic Pathfinder code

@billwpierce billwpierce added enhancement New feature or request help wanted Extra attention is needed DO NOT MERGE labels Feb 18, 2019
@billwpierce billwpierce self-assigned this Feb 18, 2019
@billwpierce billwpierce changed the base branch from master to Chassis-Code February 18, 2019 20:25
Copy link
Member

@NikhilSuresh24 NikhilSuresh24 left a comment

Choose a reason for hiding this comment

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

Small changes

@@ -54,6 +54,8 @@
public static final double INCHES_PER_TICK = Metrics.Wheel.CIRCUMFERENCE_INCHES
/ Metrics.Wheel.TICKS_PER_REVOLUTION;
}
public static final double ROBOT_WIDTH_INCHES = -1; // TODO: set
public static final double ROBOT_WIDTH_METERS = ROBOT_WIDTH_INCHES * 0.0254; // TODO: set
Copy link
Member

Choose a reason for hiding this comment

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

Make the 0.0254 a constant METERS_PER_INCH

import jaci.pathfinder.modifiers.TankModifier;

public class PathfinderBasic extends Command {
double leftDistanceOffset = RobotMap.Component.leftWheelEncoder.getDistance();
Copy link
Member

Choose a reason for hiding this comment

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

these offsets should be done in the constructor

Copy link
Member

Choose a reason for hiding this comment

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

or maybe just not initialized up here

double leftDistanceOffset = RobotMap.Component.leftWheelEncoder.getDistance();
double rightDistanceOffset = RobotMap.Component.rightWheelEncoder.getDistance();
Trajectory.Config config = new Trajectory.Config(Trajectory.FitMethod.HERMITE_CUBIC, Trajectory.Config.SAMPLES_HIGH,
0.05, 1.7, 2.0, 60.0);
Copy link
Member

Choose a reason for hiding this comment

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

extract these magic numbers to consts

Copy link
Member

Choose a reason for hiding this comment

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

Also make them settable through a constructor or methods

Trajectory trajectory;
TankModifier modifier;
DistanceFollower leftTrajectory;
DistanceFollower rightTrajectory;
Copy link
Member

Choose a reason for hiding this comment

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

give all of these things access modifiers

}

// Called once after isFinished returns true
@Override
Copy link
Member

Choose a reason for hiding this comment

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

remove end and interrupted if not being used


@Override
protected void initialize() {
leftDistanceOffset = RobotMap.Component.leftWheelEncoder.getDistance();
Copy link
Member

Choose a reason for hiding this comment

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

just reset the encoders

modifier = new TankModifier(trajectory).modify(RobotMap.Metrics.ROBOT_WIDTH_METERS);
leftTrajectory = new DistanceFollower(modifier.getLeftTrajectory());
rightTrajectory = new DistanceFollower(modifier.getRightTrajectory());
leftTrajectory.configurePIDVA(0.0, 0.0, 0.0, 0.0, 0.0); // TODO: set these PIDVA values
Copy link
Member

Choose a reason for hiding this comment

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

also make these settable through a constructor or method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants