Nhiều tính năng của Isaac Sim – đặc biệt là cầu nối ROS 2 – được xây bằng OmniGraph: hệ thống lập trình trực quan, nối các "node" bằng dây, chạy mỗi khung hình mà không cần script Python. Hiểu OmniGraph là chìa khóa để đọc, sửa các robot có sẵn ROS và tự dựng giao tiếp cho robot của mình.
- Hiểu node, thuộc tính, dây thực thi và dây dữ liệu.
- Tạo đồ thị điều khiển robot bằng giao diện và bằng menu dựng sẵn.
- Tạo cùng đồ thị đó bằng Python.
1. Khái niệm

- Node: một khối chức năng có đầu vào (
inputs:*), đầu ra (outputs:*). Isaac Sim thêm hàng trăm node: đọc thời gian mô phỏng, tính odometry, điều khiển articulation, publish/subscribe ROS 2… - Dây thực thi (
execIn/execOut,tick): quyết định khi nào node chạy. NodeOn Playback Tickphát xung mỗi khung khi mô phỏng đang Play. - Dây dữ liệu: truyền giá trị từ đầu ra node này sang đầu vào node khác.
- Đồ thị cũng là prim USD (thường ở
/World/ActionGraphhoặc dưới robot) – được lưu cùng cảnh, cùng asset (layerasset_control.usd,asset_ros.usdở bài #8).
2. Dựng đồ thị bằng giao diện

- Window > Graph Editors > Action Graph, bấm New Action Graph.
- Gõ tên node vào ô tìm kiếm bên trái và kéo vào: On Playback Tick, Differential Controller, Articulation Controller, hai Constant Double.
- Nối dây như hình 1; điền
wheelRadius0,03,wheelDistance0,1125 (Jetbot),targetPrimtrỏ tới robot,jointNameslà tên hai khớp bánh theo thứ tự trái, phải. - Play: Jetbot chạy vòng tròn bán kính v/ω ≈ 0,67 m.
3. Dựng đồ thị bằng Python
og.Controller.edit() nhận bốn nhóm thao tác: tạo node, đặt giá trị, nối dây. Đoạn sau tạo đúng đồ thị ở hình 1:
import omni.graph.core as og
import usdrt.Sdf
keys = og.Controller.Keys
og.Controller.edit(
{"graph_path": "/World/JetbotGraph", "evaluator_name": "execution"}, # execution = Action Graph
{
keys.CREATE_NODES: [
("Tick", "omni.graph.action.OnPlaybackTick"),
("V", "omni.graph.nodes.ConstantDouble"),
("W", "omni.graph.nodes.ConstantDouble"),
("Diff", "isaacsim.robot.wheeled_robots.DifferentialController"),
("Art", "isaacsim.core.nodes.IsaacArticulationController"),
],
keys.SET_VALUES: [
("V.inputs:value", 0.2),
("W.inputs:value", 0.3),
("Diff.inputs:wheelRadius", 0.03),
("Diff.inputs:wheelDistance", 0.1125),
("Art.inputs:targetPrim", [usdrt.Sdf.Path("/World/Jetbot")]),
("Art.inputs:jointNames", ["left_wheel_joint", "right_wheel_joint"]),
],
keys.CONNECT: [
("Tick.outputs:tick", "Diff.inputs:execIn"),
("Tick.outputs:tick", "Art.inputs:execIn"),
("Tick.outputs:deltaSeconds", "Diff.inputs:dt"),
("V.inputs:value", "Diff.inputs:linearVelocity"),
("W.inputs:value", "Diff.inputs:angularVelocity"),
("Diff.outputs:velocityCommand", "Art.inputs:velocityCommand"),
],
},
)
Đọc/ghi thuộc tính lúc đang chạy:
attr = og.Controller.attribute("/World/JetbotGraph/V.inputs:value")
og.Controller.set(attr, 0.0) # dừng xe
print(og.Controller.get(og.Controller.attribute("/World/JetbotGraph/Diff.outputs:velocityCommand")))
4. Chủ động "kích" đồ thị từ script
Trong script standalone muốn đồ thị chạy đúng lúc bạn chọn (ví dụ chỉ publish khi đã tính xong), thay On Playback Tick bằng On Impulse Event rồi bật xung:
og.Controller.set(og.Controller.attribute("/ActionGraph/OnImpulseEvent.state:enableImpulse"), True)
simulation_context.step(render=True)
Ví dụ MoveIt và ROS 2 Clock của Isaac Sim dùng đúng cách này (bài #20, #23).
5. Node tự viết
Khi thiếu node, bạn có thể viết node OmniGraph bằng Python (file .ogn mô tả thuộc tính + file .py có hàm compute) hoặc C++ cho hiệu năng cao. Tài liệu có hướng dẫn "Custom Python Nodes" và "Custom C++ Nodes"; Extension Template Generator (bài #10) giúp tạo khung.
Bài tiếp theo (#20): cầu nối ROS 2 – cài đặt, đồng hồ mô phỏng và điều khiển xe bằng cmd_vel.
Tài liệu tham khảo
- OmniGraph (Isaac Sim)
- Isaac Sim OmniGraph Tutorial
- OmniGraph via Python Scripting Tutorial
- OmniGraph Core Concepts (Omniverse)
- Commonly Used OmniGraph Shortcuts
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.