Skip to content

Commit

Permalink
Stop resetting position after profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gleason committed Oct 26, 2017
1 parent aa418fb commit 1ad60f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public static void main(String[] args) throws IOException {
profiles.put("RedBackup", backupRed);
profiles.put("BlueBackup", backupBlue);
profiles.put("forward100In", points);
profiles.put("BlueBackup", backupBlue);
profiles.put("BlueLoadingToLoading", blueLoadingToLoading);
profiles.put("BlueBoilerToLoading", blueBoilerToLoading);
profiles.put("RedLoadingToLoading", redLoadingToLoading);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ public void loadProfile(MotionProfileData data) {
currentGearSettings.getClosedLoopRampRate(), 1);
}

//Only call position getter once
double startPosition = data.resetPosition() ? 0 : getPositionFeet();

//Load in profiles
for (int i = 0; i < data.getData().length; ++i) {
CANTalon.TrajectoryPoint point = new CANTalon.TrajectoryPoint();
Expand All @@ -690,7 +693,7 @@ public void loadProfile(MotionProfileData data) {
point.velocityOnly = velocityOnly; // true => no position servo just velocity feedforward

// Set all the fields of the profile point
point.position = feetToEncoder(data.getData()[i][0]) * (data.isInverted() ? -1 : 1);
point.position = startPosition + feetToEncoder(data.getData()[i][0]) * (data.isInverted() ? -1 : 1);

//Calculate vel based off inversion
if (data.isInverted()) {
Expand Down

0 comments on commit 1ad60f0

Please sign in to comment.