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

Add physics simulation classes with torque input instead of voltage input #7130

Open
calcmogul opened this issue Sep 25, 2024 · 1 comment
Open
Labels
component: wpilibc WPILib C++ component: wpilibj WPILib Java os: simulation type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Comments

@calcmogul
Copy link
Member

calcmogul commented Sep 25, 2024

Is your feature request related to a problem? Please describe.
Current and torque control are becoming popular in CTRE's ecosystem, and our physics sim classes that use a voltage input aren't compatible with it.

Describe the solution you'd like
The current class is hardcoded to use a voltage input, so it's cleanest to have separate classes for each model type. Of the two choices, current or torque, the latter is more generalizable to all kinds of mechanisms.

The torque input should be the direct actuator output, not what the mechanism experiences directly. Thus, the model should include a gear ratio.

Describe alternatives you've considered
We could make all physics sim classes take a torque input, with add-ons for the motor dynamics to adapt voltage inputs to torque inputs (torque = −kₜ/(Rkᵥ) ω + kₜ/R V) or current inputs to torque inputs (torque = kₜ * current). Being able to isolate the actuator dynamics in this way is desirable.

@calcmogul calcmogul added type: feature Brand new functionality, features, pages, workflows, endpoints, etc. os: simulation component: wpilibj WPILib Java component: wpilibc WPILib C++ labels Sep 25, 2024
@narmstro2020
Copy link
Contributor

narmstro2020 commented Oct 3, 2024

I'd like to take a stab at this.

I have a PR for DCMotorSim waiting to be merged. My next logical steps were Elevator and Arm cleanup, but I can roll that into this as well, unless you would like separate PR's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpilibc WPILib C++ component: wpilibj WPILib Java os: simulation type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

No branches or pull requests

2 participants