Balint-H / modular-agents

Extensions to the ML-Agents toolkit, focusing on humanoid control in Unity
Apache License 2.0
18 stars 3 forks source link

Modular Agents

Physics-based Humanoid Control using Reinforcement Learning

A humanoid walking, following a transparent reference animation Steady-state humanoid walking learned with DReCon.

This repository contains Unity3D packages, scripts and examples to create controllers for physically simulated humanoids trained with Reinforcement Learning. The main contribution is the Modular Agents package, which contains extensions for the ML-Agents Toolkit.

The packages were developed primarily with the control of humanoid characters in mind. However, most systems would translate well to robotic or abstract contexts. It has been implemented considering the following applications:

Examples of learning conditions/methods that have been re-implemented and trained using this toolkit include:

Example training environments have been constructed using the MuJoCo physics engine plugin, with planned support for Unity's native PhysX.

For more information on Modular-Agents, see the documentation of the core package. The components specific to the simulation of humanoids are within the physx and mujoco packages, which have roughly matching content in the Unity's PhysX and MuJoCo physics engines respectively.

At the moment the package is more suited for researchers or users actively involved in the physics-based animation field. Applying the package to a new project is a hands-on process. The current way to construct a learning environment, is to create a new project, import the modular-agents.core + other relevant packages (e.g. modular-agents.mujoco and modular-agents.shared-assets) of one of the previous example projects, copy a working training environment into the new project, and modify it to the specifications of your new environment. We intend to include simplified/automated workflows for generic development use cases eventually.

Why Unity and ML-Agents?

Unity provides a user-friendly and visual interface for constructing virtual scenes. It also comes with nice rendering, and a large body of compatible assets and customizable workflows. Environment logic is flexibile and performant to configure with C# scripting. Lastly, a large number of tools for handling human motion is available for Unity, which is convenient for generating reference motion.

ML-Agents separates environment and learning logic, making it very accessible to users new to RL. Several "off-the shelf" policy types and learning algorithms are already implemented in it, that can be quickly configured, or extended with plug-ins. ML-Agents also supports building Gym compatible environments, making it possible to pair built scenes with other learning frameworks.

Due to the diversity of locomotion environments, it is tempting to create new custom observations/rewards for each condition, or monolithic components that do too many things at once. With Modular Agents we try to provide templates and scripts that let you reuse your/our code as much as possible, without the behaviours growing out of control.

Package organisation

To understand how the packages are related, please see the documentation found here.

Example projects:

The following example projects are provided to help get started with the package:

Related repositories:

About

This package was inspired by the Marathon Environments project. Modular Agents was started to investigate both interactive physics based character animation, and locomotion synthesis for applications in the field of assistive robotics[^4]. [^4]: Hodossy, B. and Farina, D., 2022. Shared Autonomy Locomotion Synthesis with Virtual Wearable Robotic (preprint).

The initial contributors were:

This work was partially supported by the Artanim Foundation, the UKRI CDT in Prosthetics and Orthotics (Grant No. EP/S02249X/1) and the Natural BionicS initative (Grant agreement ID: 810346).