mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-27 14:39:43 +00:00
debug
This commit is contained in:
@@ -356,28 +356,36 @@ def rtc_inference_thread(
|
|||||||
get_actions_threshold = 0
|
get_actions_threshold = 0
|
||||||
|
|
||||||
inference_count = 0
|
inference_count = 0
|
||||||
|
wait_logged = False
|
||||||
|
|
||||||
while not shutdown_event.is_set():
|
while not shutdown_event.is_set():
|
||||||
if not policy_active.is_set():
|
if not policy_active.is_set():
|
||||||
|
if not wait_logged:
|
||||||
|
logger.info("[RTC] Waiting for policy_active...")
|
||||||
|
wait_logged = True
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
wait_logged = False
|
||||||
|
|
||||||
action_queue = queue_holder["queue"]
|
action_queue = queue_holder["queue"]
|
||||||
if action_queue is None:
|
if action_queue is None:
|
||||||
|
logger.warning("[RTC] queue_holder['queue'] is None!")
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Get observation from shared holder (set by main loop)
|
# Get observation from shared holder (set by main loop)
|
||||||
obs_filtered = obs_holder.get("obs")
|
obs_filtered = obs_holder.get("obs")
|
||||||
if obs_filtered is None:
|
if obs_filtered is None:
|
||||||
if inference_count == 0:
|
logger.warning("[RTC] obs_holder['obs'] is None - main loop not setting it?")
|
||||||
logger.warning("[RTC] Waiting for observation from main loop...")
|
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if action_queue.qsize() <= get_actions_threshold:
|
qsize = action_queue.qsize()
|
||||||
|
if qsize <= get_actions_threshold:
|
||||||
|
try:
|
||||||
if inference_count == 0:
|
if inference_count == 0:
|
||||||
logger.info(f"[RTC] Starting first inference, obs has {len(obs_filtered)} keys")
|
logger.info(f"[RTC] Starting first inference, obs has {len(obs_filtered)} keys, qsize={qsize}, threshold={get_actions_threshold}")
|
||||||
current_time = time.perf_counter()
|
current_time = time.perf_counter()
|
||||||
action_index_before_inference = action_queue.get_action_index()
|
action_index_before_inference = action_queue.get_action_index()
|
||||||
prev_actions = action_queue.get_left_over()
|
prev_actions = action_queue.get_left_over()
|
||||||
@@ -427,6 +435,11 @@ def rtc_inference_thread(
|
|||||||
|
|
||||||
inference_count += 1
|
inference_count += 1
|
||||||
logger.info(f"[RTC] Inference #{inference_count}, latency={new_latency:.2f}s, queue={action_queue.qsize()}, shape={postprocessed_actions.shape}")
|
logger.info(f"[RTC] Inference #{inference_count}, latency={new_latency:.2f}s, queue={action_queue.qsize()}, shape={postprocessed_actions.shape}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"[RTC] Inference failed: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(1.0) # Don't spam errors
|
||||||
else:
|
else:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user