Đây là phần nhiều bạn chờ nhất: dùng Isaac Sim làm "robot ảo" cho phần mềm ROS 2 của mình. Isaac Sim không cần node trung gian – bản thân nó publish/subscribe trực tiếp trên DDS qua extension isaacsim.ros2.bridge. Loạt "Lập trình ROS2 AGV" trên blog có kiến thức ROS 2 nền nếu bạn cần ôn.
- Bật cầu nối ROS 2 đúng cách trên Ubuntu (và biết lưu ý Windows).
- Publish đồng hồ mô phỏng, dùng
use_sim_time. - Lái xe trong Isaac Sim bằng
teleop_twist_keyboard.
1. Phiên bản ROS 2 được hỗ trợ
| Nền tảng | ROS 2 |
|---|---|
| Ubuntu 24.04 | Jazzy (khuyến nghị) |
| Ubuntu 22.04 | Humble (khuyến nghị), Jazzy (build trong Docker) |
| Windows 10/11 | Humble chạy trong WSL2 Ubuntu 22.04 |

2. Cách A – thư viện ROS nội bộ (khuyến nghị)
Isaac Sim chạy Python 3.11, khác Python của ROS Humble (3.10). Vì vậy nó đóng gói sẵn thư viện ROS 2 biên dịch cho 3.11. Nếu không source ROS nào, Isaac Sim tự nạp thư viện nội bộ phù hợp với Ubuntu. Muốn chỉ định rõ trong một terminal mới:
export isaac_sim_package_path=$HOME/isaacsim
export ROS_DISTRO=humble
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# chỉ chạy dòng này MỘT lần mỗi terminal
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$isaac_sim_package_path/exts/isaacsim.ros2.bridge/humble/lib
$isaac_sim_package_path/isaac-sim.sh
source /opt/ros/humble/setup.bash trong cùng terminal khi dùng thư viện nội bộ – lẫn Python 3.10 và 3.11 sẽ gây lỗi khó hiểu. Các lệnh ros2 ..., RViz, Nav2 chạy ở terminal khác có source ROS bình thường.3. Cách B – ROS 2 cài trên hệ thống
source /opt/ros/humble/setup.bash # hoặc /opt/ros/jazzy/setup.bash trên 24.04
~/isaacsim/isaac-sim.sh
Cài thêm gói tin nhắn nếu dùng: ros-humble-vision-msgs, ros-humble-ackermann-msgs.
4. DDS: một máy, nhiều máy, Docker
- Một máy: để Fast DDS mặc định (dùng bộ nhớ chia sẻ, nhanh nhất).
- Nhiều máy hoặc Docker: tạo
~/.ros/fastdds.xmldùng transport UDPv4 vớiuseBuiltinTransports=false(mẫu đầy đủ có trong tài liệu và trong workspace), rồi ở mọi terminal:export FASTRTPS_DEFAULT_PROFILES_FILE=~/.ros/fastdds.xml. - Cyclone DDS (chỉ Linux): sửa
apps/isaacsim.exp.full.kitđể tắt tự bật bridge, rồiexport RMW_IMPLEMENTATION=rmw_cyclonedds_cpptrước khi chạy. - Đặt
ROS_DOMAIN_IDgiống nhau ở hai phía nếu không dùng mặc định 0. - Windows: ROS 2 chạy trong WSL2; cần chuyển tiếp các cổng DDS 7400, 7410, 9387 từ Windows sang IP WSL2 bằng
netsh interface portproxy. Cyclone DDS không hỗ trợ trên Windows/WSL2.
5. Workspace mẫu
git clone https://github.com/isaac-sim/IsaacSim-ros_workspaces
cd IsaacSim-ros_workspaces
git checkout IsaacSim-5.1.0
git submodule update --init --recursive
sudo apt install python3-rosdep build-essential python3-colcon-common-extensions
source /opt/ros/humble/setup.bash
cd humble_ws
rosdep install -i --from-path src --rosdistro humble -y
colcon build
source install/local_setup.bash
Workspace chứa các gói dùng ở bài sau: carter_navigation, isaac_ros_navigation_goal, isaac_moveit, isaac_tutorials, custom_message…
6. Đồng hồ mô phỏng: /clock và use_sim_time
Mô phỏng có thể chạy nhanh hoặc chậm hơn thời gian thực. Mọi node ROS 2 làm việc với dữ liệu từ Isaac Sim phải dùng thời gian mô phỏng, nếu không TF sẽ "quá hạn", Nav2 báo lỗi timeout. Tạo nhanh bằng Tools > Robotics > ROS 2 OmniGraphs > Clock, hoặc bằng Python:
og.Controller.edit(
{"graph_path": "/ClockGraph", "evaluator_name": "execution"},
{
og.Controller.Keys.CREATE_NODES: [
("Tick", "omni.graph.action.OnPlaybackTick"),
("SimTime", "isaacsim.core.nodes.IsaacReadSimulationTime"),
("PubClock", "isaacsim.ros2.bridge.ROS2PublishClock"),
],
og.Controller.Keys.CONNECT: [
("Tick.outputs:tick", "PubClock.inputs:execIn"),
("SimTime.outputs:simulationTime", "PubClock.inputs:timeStamp"),
],
},
)
# terminal ROS 2
ros2 topic echo /clock --once
ros2 run my_pkg my_node --ros-args -p use_sim_time:=true
7. Lái xe bằng /cmd_vel

Tutorial chính thức dùng TurtleBot3 nhập từ URDF (bài #7). Đồ thị gồm: ROS2Context → ROS2SubscribeTwist (topic cmd_vel) → hai BreakVector3 lấy linearVelocity.x và angularVelocity.z → DifferentialController (bán kính bánh, khoảng cách bánh của TurtleBot3 Burger: 0,033 m và 0,160 m) → IsaacArticulationController (tên hai khớp bánh). Python tương ứng:
keys = og.Controller.Keys
og.Controller.edit(
{"graph_path": "/World/CmdVelGraph", "evaluator_name": "execution"},
{
keys.CREATE_NODES: [
("Tick", "omni.graph.action.OnPlaybackTick"),
("Ctx", "isaacsim.ros2.bridge.ROS2Context"),
("Twist", "isaacsim.ros2.bridge.ROS2SubscribeTwist"),
("Lin", "omni.graph.nodes.BreakVector3"),
("Ang", "omni.graph.nodes.BreakVector3"),
("Diff", "isaacsim.robot.wheeled_robots.DifferentialController"),
("Art", "isaacsim.core.nodes.IsaacArticulationController"),
],
keys.SET_VALUES: [
("Twist.inputs:topicName", "cmd_vel"),
("Diff.inputs:wheelRadius", 0.033),
("Diff.inputs:wheelDistance", 0.160),
("Art.inputs:targetPrim", [usdrt.Sdf.Path("/World/turtlebot3_burger")]),
("Art.inputs:jointNames", ["wheel_left_joint", "wheel_right_joint"]),
],
keys.CONNECT: [
("Tick.outputs:tick", "Twist.inputs:execIn"),
("Tick.outputs:tick", "Art.inputs:execIn"),
("Ctx.outputs:context", "Twist.inputs:context"),
("Twist.outputs:execOut", "Diff.inputs:execIn"),
("Twist.outputs:linearVelocity", "Lin.inputs:tuple"),
("Twist.outputs:angularVelocity", "Ang.inputs:tuple"),
("Lin.outputs:x", "Diff.inputs:linearVelocity"),
("Ang.outputs:z", "Diff.inputs:angularVelocity"),
("Diff.outputs:velocityCommand", "Art.inputs:velocityCommand"),
],
},
)
# terminal ROS 2 (đã source /opt/ros/humble)
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Bấm Play trong Isaac Sim rồi dùng phím i/j/l/, để lái. Nếu ros2 topic list không thấy topic của Isaac Sim: kiểm tra bridge đã bật (Window > Extensions, tìm "ROS 2 Bridge"), cùng RMW và domain ID, và mô phỏng đang Play.
Bài tiếp theo (#21): đưa camera, lidar, TF, odometry lên ROS 2 và xem trong RViz.
Tài liệu tham khảo
- ROS 2 Installation (5.1.0)
- ROS 2 landing page
- URDF Import: TurtleBot
- Driving TurtleBot Using ROS 2 Messages
- ROS 2 Clock
- IsaacSim-ros_workspaces (GitHub)
Loạt bài "Robot với Isaac Sim" viết theo tài liệu và mã nguồn NVIDIA Isaac Sim 5.1.0. Isaac Sim, Omniverse, PhysX, RTX là thương hiệu của NVIDIA.