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

DCMotorSim acceleration (a bug of my own making?) #7448

Closed
narmstro2020 opened this issue Nov 29, 2024 · 2 comments · Fixed by #7449
Closed

DCMotorSim acceleration (a bug of my own making?) #7448

narmstro2020 opened this issue Nov 29, 2024 · 2 comments · Fixed by #7449
Labels
type: bug Something isn't working.

Comments

@narmstro2020
Copy link
Contributor

In the the getAngularAccelerationRadPerSecSq() function a matrix named acceleration is calculated from Ax + Bu. This would result in xdot.
The returned result is the first row of the xdot matrix, which would be velocity. Shouldn't it be the second row at index 1 for acceleration.

I know I wrote code to this effect in a PR.

Also is there a way to use the discretized versions of A and B instead of the continuous form just out of curiosity.

@narmstro2020 narmstro2020 added the type: bug Something isn't working. label Nov 29, 2024
@calcmogul
Copy link
Member

Yep, it should be index 1.

WPILib uses continuous models everywhere because they're easier to formulate. We have functions for discretizing them internally.

@narmstro2020
Copy link
Contributor Author

Excellent. I'll make a PR fixing this.
I've been tooling around with my own versions of the sims using the beta code. Mostly just modifications to the plumbing and further usages of mutable unit class elements when I saw this one.

You probably know that I've got a torque/current and voltage sim PR in the works.

Some of that plumbing exists in my little experiments on the side.

I haven't done any updates on that PR in a while due to lack of feedback and my own scheduling/timing issues.

I made another one recently that just does a reorg on DCMotor and introduces a Gearbox class. These components are in the other PR as well.

I'm sure the lack of feedback involves the sim being a lower priority as we approach the 2025 season and not a ("Ooh that's bad and I don't know how to put it nicely, haha)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants