Hi all, just wanted to open a thread for general discussion on the new CTRE simulation support.
I want to be able to teach my students how to implement the new Talon’s simulation support easily.
I will put here my understanding of it here and hopefully, we (I) could understand how to integrate it into the java/c++ command base framework while supporting real code execution when the time comes.
New release info:
The example that I will analyze here (motion magic)
My understanding - points:
-
Creating a
SimProfile
class, all motor’s profiles will extend this class which includesrun
method (should be abstract prob) that will update theSimCollection
about the motor’s current state based on specific physic’s profile implementation
Example -
Creating a class that represents the specific motor physic’s profile which extends the
SimProfile
class for each motor (unless they are in follower more) in each system in our robot (different physics for each system so different profile)
Example -
PhysicsSim
class, manager class, creates and holds all of our motors profiles, will be updated (run) inRobot.java
simulationPeriodic
method.
Example -
Initializing
PhysicsSim
: pushing talons soPhysicsSim
will create and hold the appropriate profile insimulationInit
atRobot.java
Exmaple -
Updating
PhysicsSim
: insimulationPeriodic
atRobot.java
update (run)PhysicsSim
to update all active profiles
Example
Physics dive in: (I will add a dive in on how to tweak the physics params if this thread will be active)
TBC
Conclusion:
From my understanding, the main changes are:
-
TalonSRXSimCollection
- through this collection teams will update the motors about their current state - Phoenix Tuner simulation support which includes Plotter, Self Test Snapshot, Control, and Configs
- Support for simulated device-to-device features, such as follower mode and remote sensors/limit-switches
- Integration with WPILib’s simulation GUI when using WPI_* classes
So the provided example shows a way to update the TalonSRXSimCollection
, which is all we need to run a close loop control in simulation mode (?)
@ozrien Any input will be more than welcome