All Projects → AcutronicRobotics → Ros2learn

AcutronicRobotics / Ros2learn

Licence: apache-2.0
ROS 2 enabled Machine Learning algorithms

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Ros2learn

Atari
AI research environment for the Atari 2600 games 🤖.
Stars: ✭ 174 (+46.22%)
Mutual labels:  reinforcement-learning, ml, dqn, rl
Mushroom Rl
Python library for Reinforcement Learning.
Stars: ✭ 442 (+271.43%)
Mutual labels:  reinforcement-learning, dqn, rl, trpo
Deeprl Tensorflow2
🐋 Simple implementations of various popular Deep Reinforcement Learning algorithms using TensorFlow2
Stars: ✭ 319 (+168.07%)
Mutual labels:  reinforcement-learning, dqn, ppo, trpo
Tianshou
An elegant PyTorch deep reinforcement learning library.
Stars: ✭ 4,109 (+3352.94%)
Mutual labels:  dqn, ppo, rl, trpo
Pytorch Drl
PyTorch implementations of various Deep Reinforcement Learning (DRL) algorithms for both single agent and multi-agent.
Stars: ✭ 233 (+95.8%)
Mutual labels:  reinforcement-learning, dqn, ppo, rl
Gym Gazebo2
gym-gazebo2 is a toolkit for developing and comparing reinforcement learning algorithms using ROS 2 and Gazebo
Stars: ✭ 257 (+115.97%)
Mutual labels:  robotics, ros, reinforcement-learning, rl
Torchrl
Pytorch Implementation of Reinforcement Learning Algorithms ( Soft Actor Critic(SAC)/ DDPG / TD3 /DQN / A2C/ PPO / TRPO)
Stars: ✭ 90 (-24.37%)
Mutual labels:  reinforcement-learning, dqn, ppo, trpo
Awesome Robotics
A curated list of awesome links and software libraries that are useful for robots.
Stars: ✭ 478 (+301.68%)
Mutual labels:  robotics, ros, reinforcement-learning
Elegantrl
Lightweight, efficient and stable implementations of deep reinforcement learning algorithms using PyTorch.
Stars: ✭ 575 (+383.19%)
Mutual labels:  reinforcement-learning, dqn, ppo
Easy Rl
强化学习中文教程,在线阅读地址:https://datawhalechina.github.io/easy-rl/
Stars: ✭ 3,004 (+2424.37%)
Mutual labels:  reinforcement-learning, dqn, ppo
Gibsonenv
Gibson Environments: Real-World Perception for Embodied Agents
Stars: ✭ 666 (+459.66%)
Mutual labels:  robotics, ros, reinforcement-learning
Pytorch Rl
This repository contains model-free deep reinforcement learning algorithms implemented in Pytorch
Stars: ✭ 394 (+231.09%)
Mutual labels:  robotics, reinforcement-learning, dqn
Hands On Reinforcement Learning With Python
Master Reinforcement and Deep Reinforcement Learning using OpenAI Gym and TensorFlow
Stars: ✭ 640 (+437.82%)
Mutual labels:  reinforcement-learning, ppo, trpo
Pytorch Rl
Deep Reinforcement Learning with pytorch & visdom
Stars: ✭ 745 (+526.05%)
Mutual labels:  reinforcement-learning, dqn, trpo
Autonomous Learning Library
A PyTorch library for building deep reinforcement learning agents.
Stars: ✭ 425 (+257.14%)
Mutual labels:  reinforcement-learning, dqn, ppo
Aws Robomaker Sample Application Deepracer
Use AWS RoboMaker and demonstrate running a simulation which trains a reinforcement learning (RL) model to drive a car around a track
Stars: ✭ 105 (-11.76%)
Mutual labels:  ros, reinforcement-learning, rl
Reinforcement Learning Algorithms
This repository contains most of pytorch implementation based classic deep reinforcement learning algorithms, including - DQN, DDQN, Dueling Network, DDPG, SAC, A2C, PPO, TRPO. (More algorithms are still in progress)
Stars: ✭ 426 (+257.98%)
Mutual labels:  dqn, ppo, trpo
Pytorch Rl
PyTorch implementation of Deep Reinforcement Learning: Policy Gradient methods (TRPO, PPO, A2C) and Generative Adversarial Imitation Learning (GAIL). Fast Fisher vector product TRPO.
Stars: ✭ 658 (+452.94%)
Mutual labels:  reinforcement-learning, ppo, trpo
Run Skeleton Run
Reason8.ai PyTorch solution for NIPS RL 2017 challenge
Stars: ✭ 83 (-30.25%)
Mutual labels:  reinforcement-learning, ppo, trpo
Slm Lab
Modular Deep Reinforcement Learning framework in PyTorch. Companion library of the book "Foundations of Deep Reinforcement Learning".
Stars: ✭ 904 (+659.66%)
Mutual labels:  reinforcement-learning, dqn, ppo

This repository contains a number of ROS and ROS 2 enabled Artificial Intelligence (AI) and Reinforcement Learning (RL) algorithms that run in selected environments.

The repository contains the following:

  • algorithms: techniques used for training and teaching robots.
  • environments: pre-built environments of interest to train selected robots.
  • experiments: experiments and examples of the different utilities that this repository provides.

A whitepaper about this work is available at https://arxiv.org/abs/1903.06282. Please use the following BibTex entry to cite our work:

@misc{1903.06282,
Author = {Yue Leire Erro Nuin and Nestor Gonzalez Lopez and Elias Barba Moral and Lander Usategui San Juan and Alejandro Solano Rueda and Víctor Mayoral Vilches and Risto Kojcev},
Title = {ROS2Learn: a reinforcement learning framework for ROS 2},
Year = {2019},
Eprint = {arXiv:1903.06282},
}

Installation

Please refer to Install.md to install from sources.

Refer to docker/README.md for ROS2Learn Docker container installation and usage instructions.

Usage

Tune hyperparameters

Check the optimal network hyperparameters for the environment you want to train. Hyperparams.md.

Train an agent

You will find all available examples at /experiments/examples/. Although the algorithms are complex, the way to execute them is really simple. For instance, if you want to train MARA robot using ppo2_mlp, you should execute the following command:

cd ~/ros2learn/experiments/examples/MARA
python3 train_ppo2_mlp.py

Note that you can add the command line arguments provided by the environment, which in this case are provided by the gym-gazebo2 Env. Use -h to get all the available commands.

If you want to test your own trained neural networks, or train with different environment form gym-gazebo2, or play with the hyperparameters, you must update the values of the dictionary directly in the corresponding algorithm itself. For this example, we are using ppo2_mlp from baselines submodule, so you can edit the mara_mlp() function inside baselines/ppo2/defaults.py.

Example Train

Run a trained policy

Once you are done with the training, or if you want to test some specific checkpoint of it, you can run that using one of the running-scripts available. This time, to follow with the example, we are going to run a saved ppo2_mlp policy.

First, we will edit the already mentioned mara_mlp() dictionary, in particular the trained_path value, in baselines/ppo2/defaults.py to the checkpoint we want (checkpoints placed by default in /tmp/ros2learn). Now we are ready to launch the script.

Since we want to visualize it in real conditions, we are also going to set some flags:

cd ~/ros2learn/experiments/examples/MARA
python3 run_ppo2_mlp.py -g -r -v 0.3

This will launch the simulation with the visual interface, real time physics (no speed up) and 0.3 rad/sec velocity in each servomotor.

Example Run

Visualize training data on tensorboard

The logdir path will change according to the used environment ID and the used algorithm in training. Now you just have to execute Tensorboard and open the link it will provide (or localhost:port_number) in your web browser. You will find many useful graphs like the reward (eprewmean) plotted there.

You can also set a specific port number in case you want to visualize more than one tensorboard file from different paths.

tensorboard --logdir=/tmp/ros2learn/MARACollision-v0/ppo2_mlp --port 8008

Example Tensorboard

Do your own experiment

Hyperparameter tunning (existing environment)

  1. Set the desired target in the corresponding environment in gym-gazebo2 submodule.
    • self.target_position
    • self.target_orientation
  2. Set the desired hyperparameters in the corresponding default script of the algorithm in baselines submodule.

Create your own train script to use your own environment

  1. Create a session
  2. Get the hyperparameters from the corresponding defaults script of the algorithm to be used (you will need to add a new dictionary for your own environment)
  3. Make the environment
    • DummyVecEnv for a single instance
    • SubprocVecEnv for multiple instances
  4. Call the corresponding learn function of the algorithm to be used

Optional:

  • Save the statistics and checkpoints in Tensorboard
    • checkpoints
    • tensorboard
    • log
    • monitor
    • progress
  • Save the used hyperparameters in the training

⚠️ Be aware of env.set_episode_size(episode_size) function, if it is not called once the environment is made, the default size of the episode will be 1024. It is advisable to set the same value as the one to be used in the learning algorithm, or at least a power of 2.

Create your own run script to use your own environment

  1. Create a session
  2. Get the hyperparameters from the corresponding defaults script of the algorithm in baselines submodule used in training time, and also the target in your own environment
    • self.target_position
    • self.target_orientation
  3. Make a single environment (DummyVecEnv)
  4. Normalize the environment (VecNormalize) if you have normalized in the training
  5. Make the model and load the checkpoint you want to test
  6. Get the actions from the model
    • stochastic
    • deterministic
  7. Execute the actions

Optional:

  • Save in files some useful information such us:
    • Accuracy
    • Position error (axes)
    • Orientation error (quaternion)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].