Hi @gudwnzm
Very busy times here
Note: Isaac Sim’s Navigation Sample is relying on the dynamic control extension and only supports the control of differential wheeled robots
To include a new robot you need to modify the _create_robot
function (/home/toni/.local/share/ov/pkg/isaac_sim-2021.2.1/exts/omni.isaac.demos/omni/isaac/demos/navigation_preview.py
) and define some variable specifying the robot USD path, joint names, wheel radius, and others… and add a new field to the self._robot_option
dropdown item
Also, you can import and use the RobotController
in other scripts to control a robot (differential wheeled robot), such as the next code which loads and control the Jetbot robot to reach the position (2, 1) meters when the P key is pressed
import math
import omni
import carb
import numpy as np
from pxr import UsdGeom
from omni.isaac.core import PhysicsContext
from omni.isaac.core.utils.prims import create_prim
from omni.isaac.core.utils.nucleus import find_nucleus_server
from omni.isaac.dynamic_control import _dynamic_control
from omni.isaac.demos.utils.simple_robot_controller import RobotController
stage = omni.usd.get_context().get_stage()
dc = _dynamic_control.acquire_dynamic_control_interface()
physx = omni.physx.acquire_physx_interface()
result, nucleus_server = find_nucleus_server()
if result is False:
carb.log_error("Could not find nucleus server with /Isaac folder")
asset_path = nucleus_server + "/Isaac"
PhysicsContext(physics_dt=1/60.0)
# add ground plane
create_prim(prim_path="/background", usd_path=asset_path + "/Environments/Grid/gridroom_curved.usd", position=np.array([0, 0, -9]))
# add robot
robot_usd = asset_path + "/Robots/Jetbot/jetbot.usd"
robot_prim_path = "/robot"
robot_chassis = robot_prim_path + "/chassis"
prim = stage.DefinePrim(robot_prim_path, "Xform")
prim.GetReferences().AddReference(robot_usd)
# robot controller
is_rc_initialized = False
rc = RobotController(stage=stage,
dc=dc,
articulation_path=robot_prim_path,
odom_prim_path=robot_chassis,
wheel_joint_names=["left_wheel_joint", "right_wheel_joint"],
wheel_speed=[10.0, 10.0],
goal_offset_threshold=[0.05, 0.05],
wheel_base = 0.12,
wheel_radius = 0.035)
# events
def keyboard_event(event, *args, **kwargs):
if event.type == carb.input.KeyboardEventType.KEY_PRESS:
if event.input == carb.input.KeyboardInput.P:
# goal in centimeter (100, 100, 0)
stage_unit = UsdGeom.GetStageMetersPerUnit(stage)
goal_x, goal_y, goal_z = 200 * stage_unit, 100 * stage_unit, 0
max_speed = 250 * stage_unit
start_vel, start_acc = 0.5, 0.02
goal_vel, goal_acc = start_vel, start_acc
rc.set_goal(goal_x, goal_y, math.radians(goal_z), start_vel, start_acc, goal_vel, goal_acc, max_speed)
rc.enable_navigation(True)
def physics_event(step):
global is_rc_initialized
if dc.is_simulating():
if not is_rc_initialized:
rc.control_setup()
is_rc_initialized = True
return
rc.update(step)
# subscribe to events
appwindow = omni.appwindow.get_default_app_window()
input = carb.input.acquire_input_interface()
input.subscribe_to_keyboard_events(appwindow.get_keyboard(), keyboard_event)
physics_sub = physx.subscribe_physics_step_events(physics_event)
debug_draw_sub = omni.kit.app.get_app().get_update_event_stream().create_subscription_to_pop(rc.draw_path)