Shenzhen-Robotics-Alliance / maple-sim

Elevating FRC Java Robot Simulations to the Next Level with Physics Engines
BSD 3-Clause "New" or "Revised" License
19 stars 12 forks source link

[API] API Overhaul #43

Closed catr1xLiu closed 1 day ago

catr1xLiu commented 1 day ago

I had some time to burn so I refactored the library to roughly how I would do it. Feel free to tell me what you like and don't like.

This is an implementation of the SimRobot idea we talked about a week ago.

The user would grab the robot from the simulation arena and can either pass it throughout their subsystems or statically access it. The user then uses this robot to initialize their drivetrain sim, gamepiece storage, mechanisms/motors and intakes.

A somewhat comprehensive list of changes:

Renamed MapleMotorSim to MechanismSim SwerveDriveTrainSimulation now has it's own SwerveConfig that extends the base config Swerve module and gyro now have their own configs Intakes now are backed by a GamePieceStorage object that can be shared between intakes and other subsystems GamePiece changes from previous PR GamePiece now has a user control invariance that only lets user mutating functions work if they should have control over the GamePiece IntakeSimulation, MechanismSim, GamePieceStorage, and DriveTrainSimulation are all constructed through SimRobot now GamePieces can be cleared from the arena based on their current state (aka clear all Limbo) SimulatedArena timing methods are now non-static Added RuntimeLog for better user feedback on warnings/errors