-
Notifications
You must be signed in to change notification settings - Fork 0
add fuel in simulation #52
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,19 @@ | |
|
|
||
| package frc.robot; | ||
|
|
||
| import org.ironmaple.simulation.SimulatedArena; | ||
| import java.util.List; | ||
|
|
||
| import org.ironmaple.simulation.SimulatedArena; | ||
| import org.ironmaple.simulation.gamepieces.GamePiece; | ||
| import org.ironmaple.simulation.seasonspecific.crescendo2024.CrescendoNoteOnField; | ||
| import org.ironmaple.simulation.seasonspecific.rebuilt2026.RebuiltFuelOnField; | ||
| import org.ironmaple.simulation.seasonspecific.reefscape2025.ReefscapeAlgaeOnField; | ||
| import org.json.simple.parser.Yytoken; | ||
|
|
||
| import edu.wpi.first.math.geometry.Pose3d; | ||
| import edu.wpi.first.math.geometry.Translation2d; | ||
| import edu.wpi.first.networktables.NetworkTableInstance; | ||
| import edu.wpi.first.networktables.StructArrayPublisher; | ||
| import edu.wpi.first.wpilibj.AnalogPotentiometer; | ||
| import edu.wpi.first.wpilibj.Encoder; | ||
| import edu.wpi.first.wpilibj.TimedRobot; | ||
|
|
@@ -117,11 +128,31 @@ public void testPeriodic() {} | |
|
|
||
| /** This function is called once when the robot is first started up. */ | ||
| @Override | ||
| public void simulationInit() {} | ||
| public void simulationInit() { | ||
| for (int xCnt = 0; xCnt < 4; xCnt++){ | ||
| double x = 3 + xCnt * 0.15; | ||
| for (int yCnt = 0; yCnt < 6; yCnt++){ | ||
| double y = 3 + yCnt * 0.15; | ||
| SimulatedArena.getInstance().addGamePiece(new RebuiltFuelOnField(new Translation2d(x, y))); | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
| /** This function is called periodically whilst in simulation. */ | ||
| StructArrayPublisher<Pose3d> fuelPoses = NetworkTableInstance.getDefault() | ||
| .getStructArrayTopic("MyPoseArray", Pose3d.struct) | ||
| .publish(); | ||
| @Override | ||
| public void simulationPeriodic() { | ||
| SimulatedArena.getInstance().simulationPeriodic(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Severity: medium 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
|
|
||
| fuelPoses.accept(SimulatedArena.getInstance() | ||
| .getGamePiecesArrayByType("Fuel")); | ||
| } | ||
|
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this stuff somewhere else?