Translation and Rotation controls now function

This commit is contained in:
2025-10-27 22:15:14 -04:00
parent 9ba978512d
commit 052429a724
2 changed files with 9 additions and 24 deletions

View File

@ -26,14 +26,14 @@
<legend>Translation &amp; Rotation</legend> <legend>Translation &amp; Rotation</legend>
<div class="control-group"> <div class="control-group">
<label for="vx-slider">Move Forward/Backward (m/s)</label> <label for="vx-slider">Move Forward/Backward (pixels/s)</label>
<input type="range" id="vx-slider" min="-3" max="3" step="0.1" value="0"> <input type="range" id="vx-slider" min="-300" max="300" step="0.1" value="0">
<output id="vx-value">0.0</output> <output id="vx-value">0.0</output>
</div> </div>
<div class="control-group"> <div class="control-group">
<label for="vy-slider">Strafe Left/Right (m/s)</label> <label for="vy-slider">Strafe Left/Right (pixels/s)</label>
<input type="range" id="vy-slider" min="-3" max="3" step="0.1" value="0"> <input type="range" id="vy-slider" min="-300" max="300" step="0.1" value="0">
<output id="vy-value">0.0</output> <output id="vy-value">0.0</output>
</div> </div>
@ -50,8 +50,8 @@
<legend>Performance Limits</legend> <legend>Performance Limits</legend>
<div class="control-group"> <div class="control-group">
<label for="max-speed-slider">Max Module Speed (m/s)</label> <label for="max-speed-slider">Max Module Speed (pixels/s)</label>
<input type="range" id="max-speed-slider" min="1" max="5" step="0.1" value="4"> <input type="range" id="max-speed-slider" min="1" max="300" step="0.1" value="4">
<output id="max-speed-value">4.0</output> <output id="max-speed-value">4.0</output>
</div> </div>
</fieldset> </fieldset>

View File

@ -301,24 +301,9 @@ function animate() {
ctx.translate(canvas.width / 2, canvas.height / 2); ctx.translate(canvas.width / 2, canvas.height / 2);
// Animation for testing // Animation for testing
xSpeed += xDir; xSpeed = vxSlider.value;
ySpeed += yDir; ySpeed = vySlider.value;
turnSpeed += turnDir; turnSpeed = omegaSlider.value;
if (xSpeed > 100)
xDir = -1;
else if (xSpeed < -100)
xDir = 1;
if (ySpeed > 100)
yDir = -0.8;
else if (ySpeed < -100)
yDir = 0.8;
if (turnSpeed > 1)
turnDir = -0.01;
else if (turnSpeed < -1)
turnDir = 0.01;
// Animate the grid with robot movement // Animate the grid with robot movement
let offsetSpeedDivisor = (100 - gridSquareSize <= 0 ? 1 : 100 - gridSquareSize); let offsetSpeedDivisor = (100 - gridSquareSize <= 0 ? 1 : 100 - gridSquareSize);