Skip to content

add maplesim for drivetrain and fuel#49

Open
tytremblay wants to merge 2 commits intomainfrom
ty/maplesim
Open

add maplesim for drivetrain and fuel#49
tytremblay wants to merge 2 commits intomainfrom
ty/maplesim

Conversation

@tytremblay
Copy link
Contributor

Describe your changes

Adds maplesim, a physics-based simulation of the rebuild field and game piece.

  • Drivetrain simulation is now collision checked against field elements
  • Drivetrain can now slip its wheels, leading to odometry drift over time (in sim!)
  • Simulated intake can intake fuel from the field
  • Launcher will only launch fuel if we've collected it.
  • Fuel scored in the goal triggers a callback

Recommended visualization topics:
image

Issue ticket number and link

PR Yes/No List

Note: Exceptions can be made by the Software Director or a Mentor.

1. Scope

  • Does this change clearly correspond to one specific task or card?
  • Are there no unrelated changes mixed into this PR?

2. Build & Deploy

  • Does the code compile successfully?
  • Does the code deploy successfully to the simulator or robot?
  • If deployed to a robot: Does the robot start up normally with this code?

3. Safety & Enable Behavior

  • If deployed to a robot: When enabled, does nothing move unexpectedly?
  • No safety checks, limits, or interlocks are removed or bypassed?

4. Testing & Verification

  • Has this change been tested in simulation, on the real robot, or both?
  • Was the new or changed behavior actually exercised during testing?
  • Did the robot behave the way it was intended to?

5. Behavior & Integration

  • Does existing (unchanged) robot behavior still work as expected?
  • Could this change conflict with other recent or active changes?

6. Code Quality & Maintainability

  • Can another student reasonably read and understand this code?
  • Are variable and method names clear and meaningful?
  • Is temporary debug code, print spam, or commented-out code removed?
  • Are new constants placed in a reasonable, consistent location?
  • Would I be comfortable debugging this code at competition?

7. Readiness to Merge

  • Has a mentor or the Software Director reviewed this, if required?
  • If this code were merged right now, would I feel confident enabling the robot?

public static final DriveTrainSimulationConfig mapleSimConfig =
DriveTrainSimulationConfig.Default()
.withRobotMass(Constants.Robot.massWithBumpers)
.withBumperSize(Meters.of(0.86), Meters.of(0.86)) // FRC standard 34" x 34"
Copy link
Contributor

Choose a reason for hiding this comment

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

should we change to our dimensions?

// Adjust steer motor PID gains for simulation
.withSteerMotorGains(
new Slot0Configs()
.withKP(70)
Copy link
Contributor

Choose a reason for hiding this comment

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

note different gains than in ModuleIOSim

flywheels.simulateLaunchedFuel(flywheels::atTarget),
feeder.feedWhenReady(flywheels::atTarget),
dyeRotor.feedWhenReady(flywheels::atTarget),
extension.maintainFuelPressureCommand())
Copy link
Contributor

Choose a reason for hiding this comment

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

intentional remove of maintainFuelPressureCommand?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, if we're using otf, we should be continuously collecting and thus the intake needs to stay out

Copy link
Contributor

@Sid220 Sid220 left a comment

Choose a reason for hiding this comment

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

Think it'll be easier to switch between sim and hardware and more clear if Odometry/Robot and FieldSimulation/RobotPosition are the same.

@tytremblay
Copy link
Contributor Author

Think it'll be easier to switch between sim and hardware and more clear if Odometry/Robot and FieldSimulation/RobotPosition are the same.

Let's discuss this tonight. In the real world, the robot position would eventually diverge from the robot's odometry over time. We just correct that divergence with periodic updates from SLAMDunk.

We don't currently have a simulated SLAMDunk, so there's no correction in sim.

We could have both worlds, and pass a boolean that lets us choose between syncing the two poses and letting them diverge

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