root commited on
Commit
5c78011
·
1 Parent(s): e4b5600

feat(deploy): optimize ROS 2 for HF Spaces (localhost-only, headless, memory-logging)

Browse files
Files changed (1) hide show
  1. hf_entrypoint.sh +16 -0
hf_entrypoint.sh CHANGED
@@ -8,6 +8,22 @@ set -e
8
 
9
  echo "--- [SYSTEM] ROS 2 Humble Environment Sourced ---"
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # 2. Start the Mock Robot Simulation
12
  echo "--- [DEPLOY] Starting Mock Robot Simulation (robot_1) ---"
13
  ros2 run simulation_manager mock_robot --ros-args -p robot_id:=robot_1 &
 
8
 
9
  echo "--- [SYSTEM] ROS 2 Humble Environment Sourced ---"
10
 
11
+ # --- CLOUD CONTAINER OPTIMIZATIONS ---
12
+ # 1. Network Isolation: Force all ROS traffic to localhost (Bypasses HF network restrictions)
13
+ export ROS_LOCALHOST_ONLY=1
14
+ export ROS_DOMAIN_ID=42
15
+
16
+ # 2. DDS Middleware: Use FastDDS (Default but explicit is better)
17
+ export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
18
+
19
+ # 3. Headless Mode: Prevent any accidental GUI attempts
20
+ export QT_QPA_PLATFORM=offscreen
21
+
22
+ # Debug: Print Memory Info to log
23
+ echo "--- [SYSTEM] Memory Available: ---"
24
+ free -h
25
+ echo "----------------------------------"
26
+
27
  # 2. Start the Mock Robot Simulation
28
  echo "--- [DEPLOY] Starting Mock Robot Simulation (robot_1) ---"
29
  ros2 run simulation_manager mock_robot --ros-args -p robot_id:=robot_1 &