Skip to content

Spectrum3847/2024-SpectrumSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3847 2024 - Simulation and Prep Code

Uses 604's Simulation Example as a base and brings in our 2024 SpectrumLib with updates

General Guidelines

  • Each Mechanism (motor that is following another) has it's own folder
  • All values that can be tuned or configured should live in a mechanismConfig file, NO MAGIC NUMBERS inside of mechanisms
  • Values that need to be configued for different robots should have a setter method in the mechanismConfig file so the robotConfigs can update them
  • Publish triggers in Mechanism classes that allow you to check mechanism state like Trigger = elevator is at a specific height for scoring, etc.
  • Mechanism methods should not be public when possible unless they return a Command or Trigger.

Check Issues for improvements that we still need to make

Key Elements

  • Multi-Folder Organization
    • Makes it easy to divide up work between multiple programmers and isolate changes.
    • Simplifies pull requests as main files (robot.java, etc) don't get modified as often
  • Mechanism Library Class
    • Wraps most of the TalonFX calls in easier to use fuctions
    • Makes it easy to configure a TalonFX for each mechanism
    • Allows you to configure mechanism for each robot
    • allows you to only configure motors if the mechanism is "Attached" this way you can run on different robots
  • Pilot Class
    • Only configures triggers once the controller is connected
    • Wraps all the gamepad/xbox controls
    • Makes it easier to have modifier buttons (like LeftBumper+x does something else for x alone)
  • Simulation Templates
    • RollerSim, LinearSim, and ArmSim allows you to easily add simulation support to all mechanisms
  • SpectrumLib.Util.TuneValue
    • Makes it simple to setup a value on the smartdashboard to return a value to a caommand and tune it.
  • CTRE swerve- Simulation built in

    • Added Configuration options to so it can run on multiple robots and set different encoder offsets and other configs
  • PhotonVision sim

    • Updated based on the CTRE swerve sim pose
    • Visualized using the built in Field2d widget & web GUI
  • AdvantageScope for 3d viz and plotting

Additional Resources

Controls

  • Left stick X/Y: Swerve translate
  • Tirggers: Swerve rotate

Setup

With just WPILib simulation GUI

  • Ensure the Arm Viz and Sim Field are displayed

WPILib simgui

With AdvantageScope

  • In AdvantageScope, click File > Import Layout and select advantagescope_layout.json.
  • Connect to the local simulator File > Connect to Simulator

AdvantageScope viz

PhotonVision

PhotonVision viz

About

Simultation Branch for Spectrum3847

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages