diff --git "a/mujoco_server.py" "b/mujoco_server.py" --- "a/mujoco_server.py" +++ "b/mujoco_server.py" @@ -492,7 +492,6 @@ def switch_robot(robot_type, scene_name=None): if robot_type == current_robot and env is not None: return - print(f"Switching to robot: {robot_type}") # Close old renderer if renderer is not None: @@ -547,7 +546,6 @@ def switch_robot(robot_type, scene_name=None): # Create new renderer renderer = mujoco.Renderer(env.model, height=env.height, width=env.width) - print(f"Switched to {robot_type}") prepare_overlay_renderers(robot_type, active_scene) @@ -572,10 +570,6 @@ def broadcast_state(): } with teleop_lock: teleop_snapshot = last_teleop_action.copy() - # Debug: print non-zero jogging values - non_zero = {k: v for k, v in teleop_snapshot.items() if v != 0.0} - if non_zero: - print(f"[Broadcast] Non-zero teleop values: {non_zero}") reward_value = None if hasattr(env, "get_task_reward"): reward_value = env.get_task_reward() @@ -663,19 +657,10 @@ def broadcast_state(): # Send to all connected clients with ws_clients_lock: dead_clients = set() - # Debug: print client count and teleop state - if any(v != 0 for k, v in teleop_snapshot.items() if isinstance(v, (int, float))): - print(f"[Broadcast] Sending to {len(ws_clients)} clients, teleop non-zero values: {dict((k,v) for k,v in teleop_snapshot.items() if v != 0)}") - # Print actual JSON being sent - import json as json_module - parsed = json_module.loads(state_msg) - actual_teleop = parsed.get('data', {}).get('teleop_action', {}) - print(f"[Broadcast] Actual JSON teleop_action j3 = {actual_teleop.get('j3', 'MISSING')}") for ws in ws_clients: try: ws.send(state_msg) - except Exception as e: - print(f"[Send] Failed to send to client: {e}") + except Exception: dead_clients.add(ws) # Remove dead clients ws_clients.difference_update(dead_clients) @@ -960,7 +945,6 @@ def handle_ws_message(ws, data): global needs_robot_switch, camera_follow, last_teleop_action msg_type = data.get('type') - print(f"[WS] Received message type: {msg_type}") if msg_type in ("client_identity", "trainer_identity", "client_notification", "notification"): _handle_external_client_message(ws, data) @@ -1077,7 +1061,6 @@ def handle_ws_message(ws, data): payload = data.get('data', {}) robot = payload.get('robot', 'g1') scene = payload.get('scene') - print(f"Robot switch requested: {robot} / scene: {scene}") _schedule_robot_switch(robot, scene) elif msg_type == 'home': @@ -1130,10 +1113,7 @@ def handle_ws_message(ws, data): homing_state["stuck_count"] = 0 homing_state["is_jogging"] = False homing_state["current_direction"] = None - print(f"๐ Starting homing sequence for {len(joint_errors)} joints") - print(f"โ Homing joint {homing_state['current_joint'] + 1}...") else: - print("โ Already at home position") return # Process current joint @@ -1151,7 +1131,6 @@ def handle_ws_message(ws, data): if homing_state["is_jogging"]: stop_jog() homing_state["is_jogging"] = False - print(f"โ Joint {joint_idx + 1} reached target (error: {abs_error:.4f} rad)") # Move to next joint homing_state["joint_errors"].pop(0) @@ -1163,10 +1142,8 @@ def handle_ws_message(ws, data): homing_state["stuck_count"] = 0 homing_state["is_jogging"] = False homing_state["current_direction"] = None - print(f"โ Homing joint {homing_state['current_joint'] + 1}...") else: # All joints homed - print("โ Homing sequence complete!") homing_state["active"] = False return @@ -1176,7 +1153,6 @@ def handle_ws_message(ws, data): homing_state["stuck_count"] += 1 if homing_state["stuck_count"] > 20: # Stuck for ~2 seconds if abs_error <= tolerance * 3: - print(f"โ Joint {joint_idx + 1} stuck at {abs_error:.4f}, close enough") if homing_state["is_jogging"]: stop_jog() homing_state["is_jogging"] = False @@ -1190,7 +1166,6 @@ def handle_ws_message(ws, data): homing_state["stuck_count"] = 0 homing_state["is_jogging"] = False homing_state["current_direction"] = None - print(f"โ Homing joint {homing_state['current_joint'] + 1}...") else: homing_state["active"] = False return @@ -1201,10 +1176,8 @@ def handle_ws_message(ws, data): if homing_state["previous_error"] is not None: prev_err = homing_state["previous_error"] if (prev_err > 0 and error < 0) or (prev_err < 0 and error > 0): - print(f"โฉ Joint {joint_idx + 1} overshot! {prev_err:.4f} โ {error:.4f}") homing_state["current_velocity"] = homing_state["current_velocity"] / 2.0 homing_state["current_velocity"] = max(0.005, homing_state["current_velocity"]) - print(f" Velocity halved to {homing_state['current_velocity']:.3f}") if homing_state["is_jogging"]: stop_jog() homing_state["is_jogging"] = False @@ -1221,7 +1194,6 @@ def handle_ws_message(ws, data): start_jog('joint', joint=joint_idx + 1, direction=direction, velocity=desired_velocity) homing_state["is_jogging"] = True homing_state["current_direction"] = direction - print(f" J{joint_idx + 1}: err={error:.4f}, dir={direction}, vel={desired_velocity:.3f}") homing_state["previous_error"] = error homing_state["previous_abs_error"] = abs_error @@ -1245,7 +1217,6 @@ def handle_ws_message(ws, data): stop_jog = getattr(env, "stop_jog", None) if callable(stop_jog) and homing_state["is_jogging"]: stop_jog() - print("โธ Homing stopped by user") homing_state["active"] = False homing_state["is_jogging"] = False @@ -1531,1994 +1502,18 @@ def root_redirect(): @app.route(API_PREFIX) @app.route(f'{API_PREFIX}/') def index(): - response = make_response(render_template_string(""" - - -
-