From 2eb5c5447664b340396e300e83e7cdfba3456c61 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 17 Jan 2020 20:17:21 -0800 Subject: [PATCH] TrapezoidProfile: Fix aliasing of m_initial to result in calculate() (#2284) Fixes #2283. --- .../edu/wpi/first/wpilibj/trajectory/TrapezoidProfile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/trajectory/TrapezoidProfile.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/trajectory/TrapezoidProfile.java index 0b24411b6e..6212059e59 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/trajectory/TrapezoidProfile.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/trajectory/TrapezoidProfile.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2019 FIRST. All Rights Reserved. */ +/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -173,7 +173,7 @@ public class TrapezoidProfile { */ @SuppressWarnings("ParameterName") public State calculate(double t) { - State result = m_initial; + State result = new State(m_initial.position, m_initial.velocity); if (t < m_endAccel) { result.velocity += t * m_constraints.maxAcceleration;