Closed JoelChanZhiYang closed 5 months ago
The EV3 robot simulator implementation is in PR. This looks like a big PR but about half of it is tests.
Please delete options that are not relevant.
There is 119 tests to test the main aspects of the robot simulation.
To try out the robot simulation. You can try out this snippet.
In this snippet, you will observe
import { ev3_motorA, ev3_motorB, ev3_motorC, ev3_motorD, ev3_runToRelativePosition, ev3_colorSensorRed, ev3_colorSensorGreen, ev3_pause, ev3_colorSensorBlue, ev3_ultrasonicSensor, ev3_ultrasonicSensorDistance, init_simulation, createRenderer, createPhysics, createTimer, createWorld, createPaper, createWall, createEv3, createFloor, createCSE, createRobotConsole, addControllerToWorld, saveToContext } from "robot_simulation"; init_simulation(() => { const physics = createPhysics(); const renderer = createRenderer(); const timer = createTimer(); const robot_console = createRobotConsole(); const world = createWorld(physics, renderer, timer, robot_console); const program = createCSE(); addControllerToWorld(program, world); const paper = createPaper( renderer, "https://www.shutterstock.com/image-vector/black-white-stripes-260nw-785326606.jpg", 1, 1); addControllerToWorld(paper, world); const floor = createFloor(physics, renderer); addControllerToWorld(floor, world); const wall = createWall(physics, renderer); addControllerToWorld(wall, world); const ev3 = createEv3(physics, renderer); addControllerToWorld(ev3, world); saveToContext("world", world); saveToContext("ev3", ev3); return world; }); // Student code below let motorA = ev3_motorA(); let motorB = ev3_motorB(); let ultrasonicSensor = ev3_ultrasonicSensor(); ev3_pause(2000); let loop = true; while (loop) { let distance = ev3_ultrasonicSensorDistance(ultrasonicSensor); if (distance < 50) { loop = false; continue; } ev3_runToRelativePosition(motorA, 360, 200); ev3_runToRelativePosition(motorB, 360, 200); ev3_pause(3000); }
Description
The EV3 robot simulator implementation is in PR. This looks like a big PR but about half of it is tests.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
There is 119 tests to test the main aspects of the robot simulation.
To try out the robot simulation. You can try out this snippet.
In this snippet, you will observe
Checklist: