diff --git a/ExoMy_Software-master/docker/entrypoint.sh b/ExoMy_Software-master/docker/entrypoint.sh index 21a7fbc..e5a30a7 100644 --- a/ExoMy_Software-master/docker/entrypoint.sh +++ b/ExoMy_Software-master/docker/entrypoint.sh @@ -2,7 +2,7 @@ set -eo pipefail cleanup() { - for pid_var in HTTP_PID ROSMASTER_PID ROSBRIDGE_PID ROSAPI_PID ROBOT_PID MOTOR_PID JOYSTICK_PID JOY_PID; do + for pid_var in HTTP_PID ROSMASTER_PID ROSBRIDGE_PID ROSAPI_PID ROBOT_PID MOTOR_PID JOYSTICK_PID JOY_PID DELAY_PID; do if [[ -n "${!pid_var:-}" ]]; then kill "${!pid_var}" 2>/dev/null || true fi @@ -34,11 +34,14 @@ then rosparam load /root/exomy_ws/src/exomy/config/exomy.yaml rosparam set /controller logitech-F710 + rosparam set /delay_seconds 0.0 /opt/ros/melodic/lib/rosbridge_server/rosbridge_websocket > /tmp/rosbridge.log 2>&1 & ROSBRIDGE_PID=$! /opt/ros/melodic/lib/rosapi/rosapi_node > /tmp/rosapi.log 2>&1 & ROSAPI_PID=$! + python /root/exomy_ws/src/exomy/src/delay_node.py > /tmp/delay_node.log 2>&1 & + DELAY_PID=$! python /root/exomy_ws/src/exomy/src/f710_joy_node.py > /tmp/joy_node.log 2>&1 & JOY_PID=$! python /root/exomy_ws/src/exomy/src/robot_node.py > /tmp/robot_node.log 2>&1 & @@ -48,7 +51,7 @@ then python /root/exomy_ws/src/exomy/src/joystick_parser_node.py > /tmp/joystick_parser.log 2>&1 & JOYSTICK_PID=$! - wait -n "$HTTP_PID" "$ROSMASTER_PID" "$ROSBRIDGE_PID" "$ROSAPI_PID" "$ROBOT_PID" "$MOTOR_PID" "$JOYSTICK_PID" "$JOY_PID" + wait -n "$HTTP_PID" "$ROSMASTER_PID" "$ROSBRIDGE_PID" "$ROSAPI_PID" "$ROBOT_PID" "$MOTOR_PID" "$JOYSTICK_PID" "$JOY_PID" "$DELAY_PID" exit 1 elif [[ $1 == "devel" ]] then diff --git a/ExoMy_Software-master/gui/admin.html b/ExoMy_Software-master/gui/admin.html index 14a5733..3b02ee2 100644 --- a/ExoMy_Software-master/gui/admin.html +++ b/ExoMy_Software-master/gui/admin.html @@ -72,6 +72,34 @@ +
Latenz-Simulation
+Verzögert Steuerbefehle (Controller + Web-GUI) und Kamerabild gleichzeitig.
+Systemstatus
@@ -246,9 +274,43 @@ } } + function updateDelayButtons(seconds) { + var sel = document.getElementById('delay_select'); + if (sel) sel.value = String(seconds); + } + + async function fetchDelay() { + try { + var response = await fetch(adminApiBase + '/api/delay'); + if (!response.ok) return; + var data = await response.json(); + updateDelayButtons(data.delay_seconds); + } catch (e) {} + } + + async function setDelay(seconds) { + var statusEl = document.getElementById('delay_status'); + if (statusEl) statusEl.textContent = 'Setze…'; + try { + var response = await fetch(adminApiBase + '/api/delay', { + method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({delay_seconds: seconds}) + }); + var data = await response.json(); + updateDelayButtons(seconds); + if (statusEl) statusEl.textContent = data.status || 'Gesetzt'; + window.setTimeout(function() { if (statusEl) statusEl.textContent = ''; }, 2000); + } catch (e) { + if (statusEl) statusEl.textContent = 'Fehler'; + } + } + window.addEventListener('load', function () { fetchStatus(); + fetchDelay(); window.setInterval(fetchStatus, 10000); + window.setInterval(fetchDelay, 5000); });