Skip to content

use ctre sim for elevator - #32

Open
spellingcat wants to merge 6 commits into
mainfrom
ctre-sim
Open

use ctre sim for elevator#32
spellingcat wants to merge 6 commits into
mainfrom
ctre-sim

Conversation

@spellingcat

Copy link
Copy Markdown
Collaborator

this doesn't actually need to be merged but i'm tagging y'all for review

@spellingcat
spellingcat requested review from SCool62 and vivi-o January 9, 2026 21:53
* (ElevatorSubsystem.SPROCKET_DIAMETER_METERS / 2))
/ ElevatorSubsystem.GEAR_RATIO);

// automatically calls the superclass constructor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like in the docs there's a couple of config lines that are supposed to happen in simulationInit() (like setting the motor type etc.). Maybe those should go in the constructor?

leaderSim.setSupplyVoltage(RobotController.getBatteryVoltage());

// calculate pid for the physics sim
volts =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had thought that a main advantage of this is instead of using the wpilib controllers, the controls use the talonfx config as they would on robot, and the physics sim gets the voltage from the motor sim state. lmk if i'm mistaken tho

// it just updates the value the ctre sim has stored

// convert back to rotor position because it doesn't let you set linear position directly
leaderSim.setRawRotorPosition(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So strange they don't let you set actual mech position. CTRE is stupid sometimes ig.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i suspect it's because it reconverts it back with the sensor to mech ratio lol

Comment thread src/main/java/frc/robot/elevator/ElevatorIOReal.java
@spellingcat
spellingcat requested a review from SCool62 January 10, 2026 15:36
@spellingcat

Copy link
Copy Markdown
Collaborator Author

moved to ctre-sim-rabbit-hole

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