Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2026:jan.vaduva:raul_ionut.nastasie [2026/05/24 17:34]
raul_ionut.nastasie
pm:prj2026:jan.vaduva:raul_ionut.nastasie [2026/05/24 17:36] (current)
raul_ionut.nastasie
Line 95: Line 95:
 ===== Software Design ===== ===== Software Design =====
    
-The host runs a Python script that reads the DualShock 4 via pygame/​SDL2, ​mixes the left stick into a pair of signed L298N motor PWM commands using a standard tank-drive mix (forward + turn → left wheel = forward + turn, right wheel = forward - turn, each clipped to ±255), maps the right stick to two servo angles, and POSTs the snapshot as JSON to the ESP8266 at 20 Hz over the LAN. The Triangle button hits a separate /​mode/​toggle endpoint, Cross hits /estop. Identical snapshots aren't re-sent — the host only POSTs when something actually changes, so the rover'​s tiny HTTP stack isn't drowning in duplicates while the operator'​s hands sit still.+The host runs a Python script that reads the DualShock 4 via pygame/​SDL2, ​parses ​the inputs (including clamping ​of values from left thumbstick), maps the right stick to two servo angles, and POSTs the snapshot as JSON to the ESP8266 at 20 Hz over the LAN. The Triangle button hits a separate /​mode/​toggle endpoint. Identical snapshots aren't re-sent — the host only POSTs when something actually changes, so the rover'​s tiny HTTP stack isn't drowning in duplicates while the operator'​s hands sit still.
  
-The ESP8266 sketch is a small Arduino program that runs an HTTP server with three endpoints (/control, /estop, /​mode/​toggle). In **manual mode** it just unpacks the JSON into direction-and-duty signals for the L298N plus a couple of Servo.write() calls, with a 1-second host-silence failsafe that kills the motors if the PC stops talking. In **autonomous mode** it ignores the incoming /control packets entirely and runs a small state machine: ping the ultrasonic every 60 ms, drive forward at full PWM while clear, pivot left briefly when an obstacle is detected closer than 6 cm, re-sample, if still blocked pivot right twice as long, repeat until something opens up. Readings closer than 3 cm are dropped as sensor ringdown — they were the main culprit for the rover thinking it had hit a wall when it hadn'​t.+The ESP8266 sketch is a small Arduino program that runs an HTTP server with two endpoints (/control, /​mode/​toggle). In **manual mode** it just unpacks the JSON into direction-and-duty signals for the L298N plus a couple of Servo.write() calls, with a 1-second host-silence failsafe that kills the motors if the PC stops talking. In **autonomous mode** it ignores the incoming /control packets entirely and runs a small state machine: ping the ultrasonic every 60 ms, drive forward at full PWM while clear, pivot left briefly when an obstacle is detected closer than 6 cm, re-sample, if still blocked pivot right twice as long, repeat until something opens up. Readings closer than 3 cm are dropped as sensor ringdown — they were the main culprit for the rover thinking it had hit a wall when it hadn'​t.
  
 The ESP32-CAM, meanwhile, runs the stock **CameraWebServer** example from the Arduino-ESP32 distribution,​ unchanged: it joins the same Wi-Fi network and serves an MJPEG stream on port 80. The host pulls that stream over HTTP and shows it in its own window. The control plane (PC ↔ ESP8266) and the video plane (PC ← ESP32-CAM) are entirely independent — neither side knows about the other, which means a hiccup on the video side can't stall the controls, and vice versa. The ESP32-CAM, meanwhile, runs the stock **CameraWebServer** example from the Arduino-ESP32 distribution,​ unchanged: it joins the same Wi-Fi network and serves an MJPEG stream on port 80. The host pulls that stream over HTTP and shows it in its own window. The control plane (PC ↔ ESP8266) and the video plane (PC ← ESP32-CAM) are entirely independent — neither side knows about the other, which means a hiccup on the video side can't stall the controls, and vice versa.
pm/prj2026/jan.vaduva/raul_ionut.nastasie.1779633256.txt.gz · Last modified: 2026/05/24 17:34 by raul_ionut.nastasie
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0