cd ~
git clone https://github.com/ARG-NCTU/isaacgym_rl.git
In this lab, students will learn how to integrate keyboard inputs with robotic car simulation in Isaac Gym. The objective is to map user commands from the keyboard (up
, down
, left
, right
) to motor control actions for a simulated car. This lab combines robotics simulation, keyboard input handling, and control logic.
-
Understand Simulation Basics:
- Set up a robotic car simulation using NVIDIA Isaac Gym.
- Work with DOF (Degrees of Freedom) properties and effort control.
-
Integrate User Inputs:
- Use keyboard inputs to control the car's motors dynamically.
-
Develop Control Logic:
- Map keyboard inputs (
up
,down
,left
,right
) to the car's movement (forward
,backward
,turn left
,turn right
).
- Map keyboard inputs (
- In the main loop of the script, map the input tensor
[up, down, left, right]
to the motor actions[Wheel1, Wheel2, Wheel3, Wheel4]
such that:- Up (
up
): All wheels move forward. - Down (
down
): All wheels move backward. - Left (
left
): Left wheels move backward, and right wheels move forward (turn left). - Right (
right
): Right wheels move backward, and left wheels move forward (turn right).
- Up (
The CarSimulation
class handles:
- Creating a physics-based simulation with Isaac Gym.
- Loading a car asset from a URDF file (
car_gym.urdf
). - Setting DOF properties for motor control.
The KeyboardInput
class from the pykeyboard
library provides:
- A simple interface to capture keyboard inputs (
up
,down
,left
,right
). - A
get_actions()
method that returns the action tensor[up, down, left, right]
.
Modify the section marked with:
################ Write your code here ################
'''
Task: Map the input [up, down, left, right] to the Car Movements [forward, backward, left, right]
Input Variable: input_key: 1x4 tensor [up, down, left, right]
Output Variable: actions: 1x4 tensor [Wheel1, Wheel2, Wheel3, Wheel4]
'''
######################################################
- Modify the code at ~/isaacgym_rl/scripts/lab_car.py.
- Enter Docker then test it.
cd ~/isaacgym_rl
source Docker/run.sh
cd scripts
python3 lab_car.py