Skip to content

Add move and shoot and port Nathan's shooter code from Java.#8

Merged
wh1te-lotus merged 5 commits into
mainfrom
chris.padwick/moveandshootsim
Feb 23, 2026
Merged

Add move and shoot and port Nathan's shooter code from Java.#8
wh1te-lotus merged 5 commits into
mainfrom
chris.padwick/moveandshootsim

Conversation

@cgpadwick

Copy link
Copy Markdown
Contributor

Add move and shoot simulation mode and port Nathan's shooter code from java from this branch: https://github.com/Team766/robots/blob/shooter-code/src/main/java/com/team766/robot/y2026/reva/mechanisms/ShooterUtils.java

Comment thread scripts/shot_simulator.html Outdated
const HUB_X = HUB_DISTANCE_FROM_WALL;
const HUB_Y = ALLIANCE_ZONE_WIDTH / 2;

const SHOOTER_MIN_LAUNCH_SPEED = 10.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changing this to 5.0 makes the trajectory much better.

@wh1te-lotus wh1te-lotus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works great if minimum and maximum shooter velocities are adjusted to more realistic values. Compensation for air resistance can also be added pretty easily, although it's not the most refined.

Comment thread scripts/shot_simulator.html Outdated
const HUB_Y = ALLIANCE_ZONE_WIDTH / 2;

const SHOOTER_MIN_LAUNCH_SPEED = 10.0;
const SHOOTER_MAX_LAUNCH_SPEED = 25.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changing to 15.0 is much more reasonable. Something like 20.0 may work as well, although I'm not sure it's necessary.

Comment thread scripts/shot_simulator.html Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can messily compensate for air resistance by adding a fudge factor based on time of flight.
like this: const targetDist = Math.hypot(targetXLocation, targetYLocation) + (0.3 * flightTime);

cgpadwick and others added 2 commits February 22, 2026 21:22
Lower launch speed range from 10-25 to 5-15 m/s to match realistic
alliance zone distances. Add linear air resistance compensation
(0.3 * flightTime) to target distance calculation so the auto-shoot
aims slightly farther to account for drag-induced horizontal slowdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace single-ball firing with ball pool (12 meshes) and per-frame
physics hit detection. Auto-shoot mode streams balls at 8/sec. Balls
turn green on hit, red on miss, and fade out over 500ms. Add prominent
hit/miss counter to top bar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wh1te-lotus wh1te-lotus merged commit ea5128f into main Feb 23, 2026
3 checks passed
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