How to use keyboard control a robot in a python standalong application

The example here:
1. Using Input Devices: Keyboard — Omniverse Robotics documentation
shows how to control a robot by keyboard in Extension.
But how to do this in a python standalong application?

Hi @user93379

You can control a robot by keyboard in a standalone application in the same way you control it in an extension.

The following code shows an example. It is a simple adaptation of the standalone application example (at PATH_TO_ISAAC_SIM/standalone_examples/api/omni.isaac.jetbot/ to support keyboard control using the same code that you mentioned in your post…

from omni.isaac.kit import SimulationApp

simulation_app = SimulationApp({"headless": False})

import omni
import carb

from omni.isaac.jetbot import Jetbot
from omni.isaac.core import World
from omni.isaac.jetbot.controllers import DifferentialController
import numpy as np

_command = [0.0, 0.0]

def _sub_keyboard_event(event, *args, **kwargs):
    global _command
    if (event.type == carb.input.KeyboardEventType.KEY_PRESS
        or event.type == carb.input.KeyboardEventType.KEY_REPEAT):
        if event.input == carb.input.KeyboardInput.W:
            _command = [20, 0.0]
        if event.input == carb.input.KeyboardInput.S:
            _command = [-20, 0.0]
        if event.input == carb.input.KeyboardInput.A:
            _command = [0.0, np.pi / 5]
        if event.input == carb.input.KeyboardInput.D:
            _command = [0.0, -np.pi / 5]
    if event.type == carb.input.KeyboardEventType.KEY_RELEASE:
        _command = [0.0, 0.0]

# subscribe to keyboard events
appwindow = omni.appwindow.get_default_app_window()
input = carb.input.acquire_input_interface()
input.subscribe_to_keyboard_events(appwindow.get_keyboard(), _sub_keyboard_event)

my_world = World(stage_units_in_meters=0.01)
my_jetbot = my_world.scene.add(Jetbot(prim_path="/World/Jetbot", name="my_jetbot", position=np.array([0, 0.0, 2.0])))
my_controller = DifferentialController(name="simple_control")

while simulation_app.is_running():
    if my_world.is_playing():
        if my_world.current_time_step_index == 0:



Thanks very much for your reply. I have done this sccessfully.