Translation and Rotation controls now function
This commit is contained in:
12
index.html
12
index.html
@ -26,14 +26,14 @@
|
||||
<legend>Translation & Rotation</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="vx-slider">Move Forward/Backward (m/s)</label>
|
||||
<input type="range" id="vx-slider" min="-3" max="3" step="0.1" value="0">
|
||||
<label for="vx-slider">Move Forward/Backward (pixels/s)</label>
|
||||
<input type="range" id="vx-slider" min="-300" max="300" step="0.1" value="0">
|
||||
<output id="vx-value">0.0</output>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="vy-slider">Strafe Left/Right (m/s)</label>
|
||||
<input type="range" id="vy-slider" min="-3" max="3" step="0.1" value="0">
|
||||
<label for="vy-slider">Strafe Left/Right (pixels/s)</label>
|
||||
<input type="range" id="vy-slider" min="-300" max="300" step="0.1" value="0">
|
||||
<output id="vy-value">0.0</output>
|
||||
</div>
|
||||
|
||||
@ -50,8 +50,8 @@
|
||||
<legend>Performance Limits</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="max-speed-slider">Max Module Speed (m/s)</label>
|
||||
<input type="range" id="max-speed-slider" min="1" max="5" step="0.1" value="4">
|
||||
<label for="max-speed-slider">Max Module Speed (pixels/s)</label>
|
||||
<input type="range" id="max-speed-slider" min="1" max="300" step="0.1" value="4">
|
||||
<output id="max-speed-value">4.0</output>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
21
script.js
21
script.js
@ -301,24 +301,9 @@ function animate() {
|
||||
ctx.translate(canvas.width / 2, canvas.height / 2);
|
||||
|
||||
// Animation for testing
|
||||
xSpeed += xDir;
|
||||
ySpeed += yDir;
|
||||
turnSpeed += turnDir;
|
||||
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;
|
||||
|
||||
xSpeed = vxSlider.value;
|
||||
ySpeed = vySlider.value;
|
||||
turnSpeed = omegaSlider.value;
|
||||
|
||||
// Animate the grid with robot movement
|
||||
let offsetSpeedDivisor = (100 - gridSquareSize <= 0 ? 1 : 100 - gridSquareSize);
|
||||
|
||||
Reference in New Issue
Block a user