Skip to content
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

Integrate x and y swerve sample values #1142

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

spacey-sooty
Copy link
Collaborator

No description provided.

@spacey-sooty
Copy link
Collaborator Author

Need to test this

Comment on lines +176 to +177
lerpedXPos += lerpedVXPos * dt;
lerpedYPos += lerpedVYPos * dt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This using the velocity of the next timestep instead of the current one is suspicious.

Copy link
Member

@calcmogul calcmogul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct integration equations are:

xₖ₊₁ = xₖ + vₖt + 0.5aₖt²
vₖ₊₁ = vₖ + aₖt

This PR used the following instead:

vₖ₊₁ = vₖ + aₖt
xₖ₊₁ = xₖ + vₖ₊₁t
     = xₖ + (vₖ + aₖt)t
     = xₖ + vₖt + aₖt²

@spacey-sooty
Copy link
Collaborator Author

The correct integration equations are:

xₖ₊₁ = xₖ + vₖt + 0.5aₖt²

vₖ₊₁ = vₖ + aₖt

This PR used the following instead:

vₖ₊₁ = vₖ + aₖt

xₖ₊₁ = xₖ + vₖ₊₁t

Gah this would explain my issue thanks. Will write out and test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants