• Stars
    star
    1,188
  • Rank 39,371 (Top 0.8 %)
  • Language
    Python
  • License
    Other
  • Created about 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Isaac Gym Environments for Legged Robots

Isaac Gym Environments for Legged Robots

This repository provides the environment used to train ANYmal (and other robots) to walk on rough terrain using NVIDIA's Isaac Gym. It includes all components needed for sim-to-real transfer: actuator network, friction & mass randomization, noisy observations and random pushes during training.
Maintainer: Nikita Rudin
Affiliation: Robotic Systems Lab, ETH Zurich
Contact: [email protected]

Useful Links

Project website: https://leggedrobotics.github.io/legged_gym/ Paper: https://arxiv.org/abs/2109.11978

Installation

  1. Create a new python virtual env with python 3.6, 3.7 or 3.8 (3.8 recommended)
  2. Install pytorch 1.10 with cuda-11.3:
    • pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
  3. Install Isaac Gym
    • Download and install Isaac Gym Preview 3 (Preview 2 will not work!) from https://developer.nvidia.com/isaac-gym
    • cd isaacgym/python && pip install -e .
    • Try running an example cd examples && python 1080_balls_of_solitude.py
    • For troubleshooting check docs isaacgym/docs/index.html)
  4. Install rsl_rl (PPO implementation)
  5. Install legged_gym
    • Clone this repository
    • cd legged_gym && pip install -e .

CODE STRUCTURE

  1. Each environment is defined by an env file (legged_robot.py) and a config file (legged_robot_config.py). The config file contains two classes: one conatianing all the environment parameters (LeggedRobotCfg) and one for the training parameters (LeggedRobotCfgPPo).
  2. Both env and config classes use inheritance.
  3. Each non-zero reward scale specified in cfg will add a function with a corresponding name to the list of elements which will be summed to get the total reward.
  4. Tasks must be registered using task_registry.register(name, EnvClass, EnvConfig, TrainConfig). This is done in envs/__init__.py, but can also be done from outside of this repository.

Usage

  1. Train:
    python issacgym_anymal/scripts/train.py --task=anymal_c_flat
    • To run on CPU add following arguments: --sim_device=cpu, --rl_device=cpu (sim on CPU and rl on GPU is possible).
    • To run headless (no rendering) add --headless.
    • Important: To improve performance, once the training starts press v to stop the rendering. You can then enable it later to check the progress.
    • The trained policy is saved in issacgym_anymal/logs/<experiment_name>/<date_time>_<run_name>/model_<iteration>.pt. Where <experiment_name> and <run_name> are defined in the train config.
    • The following command line arguments override the values set in the config files:
    • --task TASK: Task name.
    • --resume: Resume training from a checkpoint
    • --experiment_name EXPERIMENT_NAME: Name of the experiment to run or load.
    • --run_name RUN_NAME: Name of the run.
    • --load_run LOAD_RUN: Name of the run to load when resume=True. If -1: will load the last run.
    • --checkpoint CHECKPOINT: Saved model checkpoint number. If -1: will load the last checkpoint.
    • --num_envs NUM_ENVS: Number of environments to create.
    • --seed SEED: Random seed.
    • --max_iterations MAX_ITERATIONS: Maximum number of training iterations.
  2. Play a trained policy:
    python issacgym_anymal/scripts/play.py --task=anymal_c_flat
    • By default the loaded policy is the last model of the last run of the experiment folder.
    • Other runs/model iteration can be selected by setting load_run and checkpoint in the train config.

Adding a new environment

The base environment legged_robot implements a rough terrain locomotion task. The corresponding cfg does not specify a robot asset (URDF/ MJCF) and no reward scales.

  1. Add a new folder to envs/ with '<your_env>_config.py, which inherit from an existing environment cfgs
  2. If adding a new robot:
    • Add the corresponding assets to resourses/.
    • In cfg set the asset path, define body names, default_joint_positions and PD gains. Specify the desired train_cfg and the name of the environment (python class).
    • In train_cfg set experiment_name and run_name
  3. (If needed) implement your environment in <your_env>.py, inherit from an existing environment, overwrite the desired functions and/or add your reward functions.
  4. Register your env in isaacgym_anymal/envs/__init__.py.
  5. Modify/Tune other parameters in your cfg, cfg_train as needed. To remove a reward set its scale to zero. Do not modify parameters of other envs!

Troubleshooting

  1. If you get the following error: ImportError: libpython3.8m.so.1.0: cannot open shared object file: No such file or directory, do: sudo apt install libpython3.8

Known Issues

  1. The contact forces reported by net_contact_force_tensor are unreliable when simulating on GPU with a triangle mesh terrain. A workaround is to use force sensors, but the force are propagated through the sensors of consecutive bodies resulting in an undesireable behaviour. However, for a legged robot it is possible to add sensors to the feet/end effector only and get the expected results. When using the force sensors make sure to exclude gravity from trhe reported forces with sensor_options.enable_forward_dynamics_forces. Example:
    sensor_pose = gymapi.Transform()
    for name in feet_names:
        sensor_options = gymapi.ForceSensorProperties()
        sensor_options.enable_forward_dynamics_forces = False # for example gravity
        sensor_options.enable_constraint_solver_forces = True # for example contacts
        sensor_options.use_world_frame = True # report forces in world frame (easier to get vertical components)
        index = self.gym.find_asset_rigid_body_index(robot_asset, name)
        self.gym.create_asset_force_sensor(robot_asset, index, sensor_pose, sensor_options)
    (...)

    sensor_tensor = self.gym.acquire_force_sensor_tensor(self.sim)
    self.gym.refresh_force_sensor_tensor(self.sim)
    force_sensor_readings = gymtorch.wrap_tensor(sensor_tensor)
    self.sensor_forces = force_sensor_readings.view(self.num_envs, 4, 6)[..., :3]
    (...)

    self.gym.refresh_force_sensor_tensor(self.sim)
    contact = self.sensor_forces[:, :, 2] > 1.

More Repositories

1

darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
C++
2,158
star
2

ros_best_practices

Best practices, conventions, and tricks for ROS
C++
1,477
star
3

ocs2

Optimal Control for Switched Systems
C++
802
star
4

elevation_mapping_cupy

Elevation Mapping on GPU.
Python
508
star
5

open3d_slam

Pointcloud-based graph SLAM written in C++ using open3D library.
C++
503
star
6

rsl_rl

Fast and simple implementation of RL algorithms, designed to run fully on GPU.
Python
487
star
7

se2_navigation

Pure Pursuit Control and SE(2) Planning
C++
439
star
8

free_gait

An Architecture for the Versatile Control of Legged Robots
C++
397
star
9

traversability_estimation

Traversability mapping for mobile rough terrain navigation
C++
352
star
10

raisimLib

RAISIM, A PHYSICS ENGINE FOR ROBOTICS AND AI RESEARCH
325
star
11

xpp

Visualization of Motions for Legged Robots in ros-rviz
C++
293
star
12

graph_msf

A graph-based multi-sensor fusion framework. It can be used to fuse various relative or absolute measurments with IMU readings in real-time.
C++
259
star
13

icp_localization

This package provides localization in a pre-built map using ICP and odometry (or the IMU measurements).
C++
258
star
14

viplanner

ViPlanner: Visual Semantic Imperative Learning for Local Navigation
Python
236
star
15

delora

Self-supervised Deep LiDAR Odometry for Robotic Applications
Python
232
star
16

iPlanner

iPlanner: Imperative Path Planning. An end-to-end learning planning framework using a novel unsupervised imperative learning approach
Python
200
star
17

SimBenchmark

Physics engine benchmark for robotics applications: RaiSim vs Bullet vs ODE vs MuJoCo vs DartSim
C++
193
star
18

learning_quadrupedal_locomotion_over_challenging_terrain_supplementary

Supplementary materials for "Learning Locomotion over Challenging Terrain"
C++
173
star
19

raisimGym

Python
141
star
20

art_planner

Local Navigation Planner for Legged Robots
C++
132
star
21

perceptive_mpc

Code for "Perceptive Model Predictive Control for Continuous Mobile Manipulation"
C++
129
star
22

wild_visual_navigation

Wild Visual Navigation: A system for fast traversability learning via pre-trained models and online self-supervision
Python
126
star
23

tensorflow-cpp

Pre-built TensorFlow for C/C++ and CMake.
Shell
114
star
24

terrain-generator

Python
108
star
25

vitruvio

Vitruvio is a framework for rapid leg design analysis and optimization for legged robots. The purpose of the simulation framework is to guide the early stages of legged robot design. The end effectors track an input trajectory and the necessary joint speed, torque, power and energy for the tracking is computed.
MATLAB
88
star
26

L3E

Learning-based localizability estimation for robust LiDAR localization.
87
star
27

elmo_ethercat_sdk

C++
80
star
28

MPC-Net

Accompanying code for the publication "MPC-Net: A First Principles Guided Policy Search"
Python
79
star
29

tree_detection

This package implements a simple tree detector from point cloud data. It makes no assumptions about the ground plane and can handle arbitrary terrains.
C++
69
star
30

rayen

Imposition of Hard Convex Constraints on Neural Networks
Python
68
star
31

raisimOgre

https://rsl.ethz.ch/partnership/spinoff/raisim.html
67
star
32

smug_planner

C++
59
star
33

noesis

A Reinforcement Learning Software Toolbox for Robotics
C++
53
star
34

RSLGym

Reinforcement learning framework from RSL for policy training with RaiSim.
Python
48
star
35

hardware_time_sync

Guidelines on how to hardware synchronize the time of multiple sensors, e.g., IMU, cameras, etc.
46
star
36

anomaly_navigation

Anomaly Navigation - ANNA
Python
41
star
37

cerberus_darpa_subt_datasets

Datasets collected by Team CERBERUS during the DARPA Subterranean Challenge
39
star
38

RaiSimUnity

A visualizer for RaiSim based on Unity
31
star
39

raw_image_pipeline

Image processing pipeline for cameras that provide raw data
C++
31
star
40

soem_interface

This software package serves as a C++ interface for one or more EtherCAT devices running on the same bus. The lower level EtherCAT communication is handled by the SOEM library.
C
28
star
41

tcan

A library to communicate to devices connected through CAN, EtherCat, USB or TCP/IP.
C++
28
star
42

swerve_steering

C++
26
star
43

workflows

Collection of workflows, best-practices and guidelines for software development.
Python
26
star
44

radiance_field_ros

Implementation of Radiance Fields for Robotic Teleoperation
Python
25
star
45

terra

A grid world environment for high-level earthworks planning in JAX for RL.
Python
22
star
46

urdf2robcogen

A tool that translates a robot URDF description into the kindsl format that can be processed by RobCoGen.
C++
21
star
47

maxon_epos_ethercat_sdk

Implementation of an ethercat device driver for the maxon epos 4
C++
18
star
48

self_supervised_segmentation

Python
17
star
49

ocs2_robotic_assets

Various robotic assets for OCS2 Toolbox
CMake
17
star
50

cerberus_anymal_locomotion

C++
16
star
51

cuda_ue4_linux

C++
15
star
52

ethercat_sdk_master

A wrapper around SOEM to allow multiple masters and devices on EtherCAT
C++
14
star
53

ethercat_device_configurator

Manages setup yaml files for the RSL ethercat infrastructure
C++
14
star
54

lunar_planner

Python
14
star
55

pytictac

Simple Timing Utils
Python
13
star
56

catkin_create_rqt

An RQT plugin generator script, supporting several arguments to generate a rqt plugin for ROS, similar to catkin_create_pkg
Python
12
star
57

rl-blindloco

Project page for Science Robotics paper "Learning Quadrupedal Locomotion over Challenging Terrain"
HTML
11
star
58

learning_docker

Shell
9
star
59

any_ping_indicator

An Ubuntu indicator applet to show the ping status.
Python
8
star
60

plr-exercise

Python
7
star
61

terra-baselines

Train, visualize, and evaluate RL policies for the Terra environment.
Python
7
star
62

rsl_heap

CMake
7
star
63

anymal_brax

Python
7
star
64

perfectlyconstrained

Official implementations from the paper "Should We Relax a Bit? A Study on Degeneracy Mitigation in Point Cloud Registration"
7
star
65

unity_ros_teleoperation

C#
6
star
66

gtsam_catkin

Catkinized version of gtsam.
CMake
4
star
67

digbench

Benchmarks and map generation for the Terra environment.
Python
4
star
68

mobile_manipulation

Under construction
3
star
69

realsense_eth_robotics_summer_school_2019

Launch files and utility nodes for running the Realsense on SMB
CMake
2
star
70

xpp-release

Release repository of the xpp repo, necessary for ros hosting.
1
star
71

rsl_panoptic_mapping

C++
1
star
72

rsl_panoptic

Python
1
star
73

pretrained_depth_embedders

Python
1
star
74

darknet_ros-release

1
star
75

webapp-container

Scripts and tools to containerize a PHP-FPM, Nginx, Redis web-application βš™οΈ
Dockerfile
1
star