Giter VIP home page Giter VIP logo

opencat-gym's Introduction

OpenCat Gym

A gym reinforcement learning environment for OpenCat robots based on Stable-Baselines3 and PyBullet.

Simulation and Application

Installation and Usage

Install python packages:

!pip install "stable-baselines3[extra]"
!pip install pybullet

Start training with

python train.py 

To take a look at the pre-trained example, execute

python enjoy.py

Alternatively you can run opencat-gym.ipyn in Jupyter notebook and perform training.

Playing with training parameters

The training parameters are listed as constants in the opencat-gym-env.py. They change the weight of the reward-function.

PENALTY_STEPS = 2e6       # Increase of penalty by step_counter/PENALTY_STEPS
FAC_MOVEMENT = 1000.0     # Reward movement in x-direction
FAC_STABILITY = 0.1       # Punish body roll and pitch velocities
FAC_Z_VELOCITY = 0.0      # Punish z movement of body
FAC_SLIP = 0.0            # Punish slipping of paws
FAC_ARM_CONTACT = 0.01    # Punish crawling on arms and elbows
FAC_SMOOTH_1 = 1.0        # Punish jitter and vibrational movement, 1st order
FAC_SMOOTH_2 = 1.0        # Punish jitter and vibrational movement, 2nd order
FAC_CLEARANCE = 0.0       # Factor to enfore foot clearance to PAW_Z_TARGET
PAW_Z_TARGET = 0.005      # Target height (m) of paw during swing phase

Links

For more information on the reinforcement training implementation: https://stable-baselines3.readthedocs.io/en/master/index.html
And for the simulation environment please refer to: https://pybullet.org/wordpress/
The API for creating the training environment: https://gymnasium.farama.org/

Related Work

The reward and penalty functions are based on: https://www.nature.com/articles/s41598-023-38259-7
Including a joint angle history was inspired by: https://www.science.org/doi/10.1126/scirobotics.aau5872

opencat-gym's People

Contributors

ger01d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

opencat-gym's Issues

Running the trained model on the Bittle

Hello,

I would like to run this trained model on my Petoi Bittle and test it in the real world. However, I am unsure how to proceed with running this model directly on the Bittle's Arduino board.

Could you please provide guidance or steps on how to execute a trained RL model on the Bittle? Specifically, I am looking for information on:

  1. Whether it's feasible to run a trained RL model directly on the Arduino board of the Bittle.
  2. If not, what is the recommended approach to control the Bittle using a trained RL model.
  3. Any examples or documentation that detail the process of integrating a trained model with the Bittle's hardware and software.

Thank you for your assistance!

Best regards

How do you calculate the reward for Bittle robot?

Hello!
First of all, thank you so much for sharing your work. This is awesome and it will help me a lot when learning RL for real-life robots.
I have some questions. Could you please answer when you have time?
(I also asked on Petoi forum. I'm sorry for any inconvenience, but I think asking on GitHub can help more people who have the same question as me.)

How does your model make the robot move forward? As I understand, you use IMU acceleration data along with yaw, pitch, roll, and current angles as inputs for the neural network. However this data alone doesn't indicate if the robot is moving forward, as velocity is needed for calculating reward, not just acceleration.

Am I missing something?
Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.