-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathrun_sim.sh
More file actions
executable file
·45 lines (36 loc) · 2.18 KB
/
Copy pathrun_sim.sh
File metadata and controls
executable file
·45 lines (36 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -euo pipefail
# Isaac Sim 5.0 / IsaacLab 0.54.3 launcher for Unitree Go2 digital twin.
#
# We intentionally do NOT source /opt/ros/jazzy because system Jazzy is built
# for Python 3.12 and Isaac Sim 5.0 requires Python 3.11. The Isaac Sim
# ROS 2 bridge extension ships an internal Jazzy (rclpy + msg libs) matching
# Python 3.11 — this script points the loader at those libraries.
export ISAAC_VENV="${ISAAC_VENV:-$HOME/Sim/isaac-sim-venv}"
export ISAACLAB_PATH="${ISAACLAB_PATH:-$HOME/Sim/IsaacLab}"
export OMNI_KIT_ACCEPT_EULA=YES
export ROS_DISTRO=jazzy
export RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-rmw_fastrtps_cpp}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Activate Isaac Sim venv (Python 3.11, isaacsim 5.0, isaaclab 0.54.3)
source "$ISAAC_VENV/bin/activate"
# ponytail: Isaac 5.x moved the bundled ROS 2 libs from isaacsim.ros2.bridge -> isaacsim.ros2.core.
# Pick whichever ext actually has $ROS_DISTRO/lib so this works across Isaac versions.
ISAAC_ROS2_EXT="$(python -c "import isaacsim, os; b=os.path.dirname(isaacsim.__file__); d=os.environ['ROS_DISTRO']; print(next(os.path.join(b,'exts',e) for e in ('isaacsim.ros2.core','isaacsim.ros2.bridge') if os.path.isdir(os.path.join(b,'exts',e,d,'lib'))))")"
BUNDLED_LIB="$ISAAC_ROS2_EXT/$ROS_DISTRO/lib"
BUNDLED_RCLPY="$ISAAC_ROS2_EXT/$ROS_DISTRO/rclpy"
if [[ ! -d "$BUNDLED_LIB" ]]; then
echo "[run_sim] bundled ROS 2 $ROS_DISTRO libs not found at $BUNDLED_LIB" >&2
exit 1
fi
# The bridge extension does NOT auto-add its rclpy to Python's sys.path, so
# PYTHONPATH is required for rclpy imports. LD_LIBRARY_PATH is required so
# rclpy's native typesupport libs can be dlopen'd at publisher-creation time.
# When the bridge extension is also enabled, two copies of rcl_interfaces get
# loaded and trigger a ParameterEvent assert — so omniverse_sim.py now enables
# only the OmniGraph core extensions, not isaacsim.ros2.bridge, and publishes
# via rclpy from Python directly.
export PYTHONPATH="$BUNDLED_RCLPY${PYTHONPATH:+:$PYTHONPATH}"
export LD_LIBRARY_PATH="$BUNDLED_LIB${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
cd "$SCRIPT_DIR"
exec python -u main.py --robot_amount 1 --robot go2 --terrain flat "$@"