Skip to content

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DualShot

FRC 10479 PowerHouse · 2026 REBUILT dual-turret shooting simulator. A browser-based shooting lab: drive the robot around the official 2026 field and watch both turrets solve their shots live — flywheel speed, hood elevation, turret yaw, time of flight, entry angle, and Monte-Carlo hit probability — with real drag-aware ballistics running in a Rust→WASM core.

Inspired by Team 6907's u2026_Shooting_Visualizer (GOATSim). DualShot models 10479's actual robot: two independent turrets mounted at the rear corners, both feeding on the same HUB.

Using it

Input Action
W A S D drive (field-relative)
Q / E rotate chassis
Shift fine control · Space brake
F fire one volley (both turrets)
H range heatmap overlay
P pause · 1–4 camera presets
drag robot reposition it
mouse drag / scroll orbit / zoom camera

Per-turret cards (top left) show the live solution; go / no go states include the reason (too far, entry too shallow, speed cap, hub clipped, not descending). The transport bar fires volleys, toggles per-turret autofire, and tracks scored/shot tallies against the predicted hit probability. All mechanism parameters (elevation limits, flywheel cap, effective wheel radius, mount offsets, dispersion) are live-tunable in the Controls drawer.

Physics model

  • Point-mass FUEL with gravity + quadratic drag: a = −g ẑ − k·|v|·v, k = ½ρ·C_d·A/m ≈ 0.0246 m⁻¹. Semi-implicit Euler at 240 Hz.
  • Per-turret shot solver: two-stage elevation sweep (2° coarse / 0.25° refine) with 12-step bisection on exit speed; constraints: descending entry, minimum entry angle, hub-rim clearance, flywheel cap; picks the minimum-speed valid solution.
  • Shoot-on-the-move: virtual-target fixed-point iteration (target displaced by −v·ToF), with turret velocity including the ω×r term from chassis rotation; final solution verified by a full 3-D flight sim.
  • Scoring: ball crosses 1.83 m descending within 0.56 m of hub center (matches FuelSim's rule; the true hex opening's apothem is 0.53 m — the circular approximation slightly over-accepts corner shots).
  • Hit probability: 200-sample seeded Monte-Carlo with angular dispersion σ = (base + gain·range)/range plus speed jitter.

Hood-angle convention

The robot code's "hood angle" is measured from vertical; DualShot displays elevation above horizontal: elevation = 90° − hood. (10479's commanded hood 19–35° ⇔ elevation 71–55°.)

Data provenance

Value Source
Field 16.541 × 8.069 m; hub center x = 4.61 m, y = 4.0345 m 10479 AprilTag layout / FuelSim; matches manual 651.2 × 317.7 in
FUEL Ø0.15 m, 0.2033 kg, C_d 0.47, ρ 1.2041 2026 manual (5.91 in, 0.448–0.5 lb) + FuelSim
Hub entry height 1.83 m, entry radius 0.56 m FuelSim ENTRY_HEIGHT/ENTRY_RADIUS; manual (41.7 in hex @ 72 in)
Turret mounts (−0.185, ±0.185) m; yaw ±210°; exit height 0.5 m 10479 robot code (RobotContainer real ctor; TurretConstants)
Flywheel 210–290 rad/s over 1.34–5.60 m; effective wheel radius ≈ 0.03 m 10479 ShotCalculator interpolation tables; radius inferred from their ToF table — calibration knob, not a measurement
Drivetrain max 4.57 m/s 10479 TunerConstants

⚠️ The effective flywheel radius (exit speed = ω × r_eff) is the least-certain number in the model — measure real exit velocity and adjust the "Wheel eff. radius" slider to calibrate.

Development

# prerequisites: Rust (wasm32-unknown-unknown target), wasm-pack, Node 22+
cd web
npm install
npm run wasm     # build the Rust core → src/wasm/pkg
npm run dev      # vite dev server
npm run build    # full production build (wasm + typecheck + vite)
cargo test --workspace   # physics/solver test suite

Architecture: crates/sim-core (pure Rust — ballistics, solver, ball pool, Monte-Carlo, heatmap; fully unit-tested) → crates/sim-wasm (wasm-bindgen facade, flat typed-array buffers) → web/ (Vite + TypeScript + three.js; rendering, input, UI). Design doc and implementation plan live in docs/superpowers/.

Credits

  • Team 6907 GOATSim — prior art and the reference field/robot asset bundle.
  • Field model: 2026 FRC field in AdvantageScope asset format (FIRST field CAD → community glTF export), via 6907's repository.
  • FuelSim (hammerheads5000) — cross-validated hub geometry and FUEL physics constants, vendored in 10479's robot code.
  • MoSim — arena/venue presentation reference (bleachers, alliance light washes, post-processing recipe).
  • FIRST® and REBUILT℠ are trademarks of FIRST; this is an unofficial fan/team tool.

About

DualShot — dual-turret shooting simulator for FRC 2026 REBUILT. Rust/WASM ballistics core + three.js. Team 10479 PowerHouse.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages