-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: Chassis-Code
Are you sure you want to change the base?
Pathfinder basic #27
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
Basic Pathfinder code