TrapezoidProfile: Fix aliasing of m_initial to result in calculate() (#2284)

Fixes #2283.
This commit is contained in:
Tyler Veness
2020-01-17 20:17:21 -08:00
committed by Peter Johnson
parent 0e206e69cf
commit 2eb5c54476

View File

@@ -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;