mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
TrapezoidProfile: Fix aliasing of m_initial to result in calculate() (#2284)
Fixes #2283.
This commit is contained in:
committed by
Peter Johnson
parent
0e206e69cf
commit
2eb5c54476
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user