We have released RumiCar Simulator v11.0.0. The release notes below are also available on GitHub.
v11.0.0
The learning API now uses the same names and values as the real-car RumiCar libraries (Arduino RumiCar-lib, Raspberry Pi RasPi/RumiCar.py, RumiCar-Zero2Cam), and supports the strength of RC_steer (its second argument) and a delay in the middle of loop() (Stage BN and BO. In the driving physics only the steering under an RC_steer strength of 1-254 changed (a call without the strength and strength 255 use the same expression as before). This is MAJOR because the values of the learning API RC_read, the Python names, the second argument of RC_steer and a delay in the middle of loop() behave differently — programs that use RC_read on the tabletop, or the strength, or a delay in the middle, drive differently. The shipped official sample race (full scale; RC_read is not cut off there) drives the same; its verifyHash e9f1da0b and the frozen hashes f0–f3 are the same as before. Only the resultSha256 of the result file was re-pinned because it includes the version (engineVer).) (1) The 20 cm cut-off of RC_read — the real-car libraries cut the ToF reading off at 200 mm and return -3 when nothing is closer (0–200 = distance in mm, -1 = no reading, -2 = argument error, -3 = nothing within 20 cm = open). The simulator’s RC_read(LEFT/CENTER/RIGHT/REAR) returns the same values: tabletop cuts off at 200 mm (learn under the same condition as the real model), mid-scale uses 400 mm by length similarity (handled like sensorMaxMm), full scale (real-car size) has no cut-off (the ToF sits higher on a real car and does not see the ground, so the current range stays). Only RC_read is cut off; the ranging itself (2,000 mm range, cone drawing, noise/optics models) and the raw C++/JavaScript read sensorN.readRangeSingleMillimeters() (as in the Arduino exercises) are unchanged. -3 is the smallest number, so the samples replace it with “far” before comparing (if d == -3: d = 999). (2) Unified names — the rear sensor’s BACK is gone; it is REAR (=3, the same value as on Arduino). RC_read(REAR) without a rear sensor returns -1 (was -2). The wheel-encoder axle is RC_wheel_speed(FRONT=0 / REAR=3) too (the old REAR=1 collided with the Arduino value; anything else returns -2). Python now sees only the canonical names: RC_setup/RC_steer/RC_drive/RC_read and the constants, the optional RC_wheel_speed, and standard Python print, time, math, random, sys. The old Raspberry Pi aliases rc_steer/rc_drive/rc_clear/rc_wheel_speed, read_one_sensor(), read_all_sensors(), sensorN.get_distance() and the Arduino-only Serial, delay, millis, micros, map, constrain, sensorN were removed from Python (C++/JavaScript keep the Arduino names). RC_params() (the params.json values; an empty dict in the simulator) and RC_state("NAME") (the name of the current state; prints state A -> B when it changes), which exist in RasPi RumiCar.py and Zero2Cam, were added for Python (the C/JS names stay the same as on Arduino). Both from RumiCar import * and import RumiCar (→ RumiCar.RC_drive(...)) work, and so do both program forms: RasPi style (top-level while True:) and Zero2Cam style (def setup()/def loop()). The RasPi Exercises 1.1–3.2 of the RumiCar repository (including import sys; sys.path.append('..')) and the Zero2Cam sample drive.py were confirmed to run through the interpreter unchanged (drive.py stops with the KeyError of (4) below because RC_params()["stop_mm"] is not in the empty dict — the same way it fails on a real car without params.json). (3) Rewritten sample programs — tabletop corridors (0.4–0.9 m) are wider than 20 cm, so driving down the middle gives -3 on both side ToFs almost all the time. The shipped sample (samples.js, C/Python/JavaScript) and the three Python car-type programs were rewritten as “Wall Hugger”, which hugs the right wall: keep the right reading inside a band, steer toward the side with the larger reading when a wall appears within 20 cm ahead, search by steering right when the right wall is lost (after a while only half of the time, so the circle widens), and reverse with opposite lock when the front closes to 80 mm; in a narrow corridor where both walls are visible it centers on the left/right difference. Measured (the 56 tabletop courses with a finish, solo, laps=3, rejoin=OFF, production runRace): Wall Hugger FR 50/56, 4WD 53/56, FF 48/56 (the previous Python Apex Hunter family: 46/42/38 before the cut-off; the C versions 47/48/47). The 4WD/FF versions add “lift the throttle to 70 when turning” and “keep steering for 2 cycles once started (HOLD)” (the turning radius changes with the throttle: measured by driving at PWM 200, then applying full lock and switching to the given PWM, 240 → 70 gives FR 0.8→0.45 m, 4WD 1.3→0.7 m, FF 1.8→0.8 m). The three language samples give the same verifyHash on all 56 courses (a machine check of interpreter equivalence). The C car-type programs (Apex Hunter etc.) keep the previous style with raw reads and the confidence limit CONF and drive the same (the rear sensor of the three drift programs now uses the raw read sensor3.readRangeSingleMillimeters() instead of RC_read(BACK), keeping the meaning of 0 ≤ B < 650; two-car races with the rear sensor on have the same verifyHash as before. Range-Flow Estimator uses RC_read(REAR). The three Python competition programs use print instead of Serial.println). (4) Interpreter — reading a key that is not in a Python dict (d["x"]) is now a runtime error with a line number (like KeyError); before it silently continued with no value. A dict is displayed (print(d), str(d), f-strings) as in python3, {'a': 1} (before: [object Object] or a JS error; the list display 1,2 is unchanged). A busy-wait on Python’s time.time()/time.monotonic() gets the same infinite-loop hint as millis(). (5) Explanations and verification — usage §7, Specs & Limits, the design Q&A and §12 of the physics model explanation (ja/en) were updated for the new API, and §12 gained a section on the cut-off and Wall Hugger. Verification gates: section D of wf_bh6_docs now checks the completion counts of the three Python and three C programs, the agreement of the three language samples and the constants of g ≈ 18 + 0.976·R against production runRace and config; the AST fingerprints of the shipped samples in wf_bj1_pysem were re-stamped for the new text; the rc_* fixtures of wf_bj1/wf_as12 became RC_*. The programs/ folder of the RumiCar repository was regenerated with gen_program_files.mjs (Python versions as .py in the Zero2Cam form). (6) Strength of RC_steer (Stage BO) — as in the real libraries (RumiCar-lib v0.6.0, RasPi RumiCar.py 0.6.0), the second argument of RC_steer(direction, strength) (the share of the signal to the steering motor, 0-255, not compensated) is now accepted on the default car too (up to v10.5.0 only a car with the optional continuous steering took it; the default car returned 0 without changing the steering). 0 is the same as CENTER (neutral), 255 and leaving it out are the full lock of before (the trajectory does not change by a single bit), and CENTER ignores the strength. On the default car (DC motor) the target angle is full lock × strength/255 and the speed of steering outward from the centre is also × strength/255 (moving toward the centre keeps the old speed). The optional continuous steering (proportional servo) moves at a constant speed whatever the strength. The values are relative guides, not compensated per car type (physics model explanation §12 “Strength of the learning API RC_steer“). (7) Argument handling as in the real libraries — the strength and speed of RC_steer and RC_drive are truncated toward 0 and clamped to 0-255 (as Python’s int() and the Arduino int parameter; up to v10.5.0 they were rounded, so RC_drive(FORWARD, 99.9) was 100, now 99). A value that is not a number (a string that is not digits, None, a list, a missing argument) counts as 0, and, together with a wrong direction and an invalid RC_state name, a warning is logged the first time (once per function and value). The shipped programs that passed fractional speeds — Launch Lab, Brake Lab and Apex Strategist — now round explicitly ((int)(… + 0.5), int(pwm+0.5)) and drive exactly as before (same traceHash and verifyHash). (8) A delay in the middle of loop() — a delay(ms) (C) or time.sleep(seconds) (Python) written directly in the body of loop() waits on the spot, as on the real car, and the following statements run after the wait (that loop() call is split there and continues with the same local variables; the body of while True: works the same; after a split no 0.05 s period is added, the rest runs after just the wait). Up to v10.5.0 a delay in the middle did not wait, so RC_steer(RIGHT); delay(500); RC_steer(LEFT); delay(500); (the shape of Exercise-2.1, 2.2, 2.4 and 2.5) only applied the last command. A delay at the end of the body, inside if/for, inside your own function or as part of an expression, and delay in JavaScript work as before. The shipped sample programs do not use delay, so they drive the same. (9) Exercise-2.5 and 3.3 — Exercise-2.5 “Change the steering strength” and 3.3 “A car that drives smoothly” of RumiCar-lib v0.6.0 and their RasPi versions (the setup()/loop() form run by python3 RumiCar.py) were confirmed to run unchanged in the production UI (loaded with ⬆ and run with ▶) and in production runRace (2.5 steps RIGHT255→LEFT255→RIGHT128→LEFT128 every 0.5 s; 3.3 completes 3 laps of an elliptic oval). / in the simulator’s C stays true division, so the C version of 3.3 prints Power as a fraction and repeated ×1.3 steps grow a little larger than on Arduino (the Python version uses // and matches Arduino). In the README of programs/ in the RumiCar repository, “to run it on RasPi, add setup() and while True: loop() at the end” was replaced by running it unchanged with python3 RumiCar.py. The verification gate wf_bo1_steer was added (a table made by running the canonical RasPi RumiCar.py 0.6.0 — 240 RC_steer, 90 RC_drive and 12 RC_state cases — the steering law, the delay split, and Exercise-2.5/3.3), bringing the permanent gates to 82, plus the real-browser check check_bo1_exercise. Unchanged: the driving physics (except the steering under a strength of 1-254 in (6)), the ranging itself (sensors.js), the raw read values, the C/JavaScript names, the deterministic engine of official races (🏁), the saved-data formats, and the tabletop courses.
Verifying this release yourself
git clone https://github.com/RumiCar-group/RumiCar-Simulator.git
cd RumiCar-Simulator
node wf_run_all.mjs # the full assertion-gate suiteThe suite runs from a fresh clone with no dependencies beyond Node.js.
The real-browser checks under browser/ additionally need npm install and a display.
