Code Monkey home page Code Monkey logo

rex-gym's Introduction

Rex: an open-source quadruped robot

The goal of this project is to train an open-source 3D printed quadruped robot exploring Reinforcement Learning and OpenAI Gym. The aim is to let the robot learns domestic and generic tasks in the simulations and then successfully transfer the knowledge (Control Policies) on the real robot without any other manual tuning.

This project is mostly inspired by the incredible works done by Boston Dynamics.

Related repositories

rexctl - A CLI application to bootstrap and control Rex robot running the trained Control Policies.

rex-models - A web URDF visualizer. Collection of Rex robot models.

Rex-gym: OpenAI Gym environments and tools

This repository contains a collection of OpenAI Gym Environments used to train Rex, the Rex URDF model, the learning agent implementation (PPO) and some scripts to start the training session and visualise the learned Control Polices. This CLI application allows batch training, policy reproduction and single training rendered sessions.

Installation

Create a Python 3.7 virtual environment, e.g. using Anaconda

conda create -n rex python=3.7 anaconda
conda activate rex

PyPI package

Install the public rex-gym package:

pip install rex_gym

Install from source

Clone this repository and run from the root of the project:

pip install .

CLI usage

Run rex-gym --help to display the available commands and rex-gym COMMAND_NAME --help to show the help message for a specific command.

Use the --arg flag to eventually set the simulation arguments. For a full list check out the environments parameters.

To switch between the Open Loop and the Bezier controller (inverse kinematics) modes, just append either the --open-loop or --inverse-kinematics flags.

rex-gym COMMAND_NAME -ik
rex-gym COMMAND_NAME -ol

For more info about the modes check out the learning approach.

Policy player: run a pre-trained agent

To start a pre-trained agent (play a learned Control Policy):

rex-gym policy --env ENV_NAME

Train: Run a single training simulation

To start a single agent rendered session (agents=1, render=True):

rex-gym train --playground True --env ENV_NAME --log-dir LOG_DIR_PATH

Train: Start a new batch training simulation

To start a new batch training session:

rex-gym train --env ENV_NAME --log-dir LOG_DIR_PATH

Robot platform

Mark 1

The robot used for this first version is the Spotmicro made by Deok-yeon Kim.

I've printed the components using a Creality Ender3 3D printer, with PLA and TPU+.

The hardware used is listed in this wiki.

The idea is to extend the robot adding components like a robotic arm on the top of the rack and a LiDAR sensor in the next versions alongside fixing some design issue to support a better (and easier) calibration and more reliable servo motors.

Simulation model

Base model

Rex is a 12 joints robot with 3 motors (Shoulder, Leg and Foot) for each leg.

The robot base model is imported in pyBullet using an URDF file.

The servo motors are modelled in the model/motor.py class.

rex bullet

Robotic arm

The arm model has the open source 6DOF robotic arm Poppy Ergo Jr equipped on the top of the rack.

rex arm

To switch between base and arm models use the --mark flag.

Learning approach

This library uses the Proximal Policy Optimization (PPO) algorithm with a hybrid policy defined as:

a(t, o) = a(t) + π(o)

It can be varied continuously from fully user-specified to entirely learned from scratch. If we want to use a user-specified policy, we can set both the lower and the upper bounds of π(o) to be zero. If we want a policy that is learned from scratch, we can set a(t) = 0 and give the feedback component π(o) a wide output range.

By varying the open loop signal and the output bound of the feedback component, we can decide how much user control is applied to the system.

A twofold approach is used to implement the Rex Gym Environments: Bezier controller and Open Loop.

The Bezier controller implements a fully user-specified policy. The controller uses the Inverse Kinematics model (see model/kinematics.py) to generate the gait.

The Open Loop mode consists, in some cases, in let the system lean from scratch (setting the open loop component a(t) = 0) while others just providing a simple trajectory reference (e.g. a(t) = sin(t)).

The purpose is to compare the learned policies and scores using those two different approach.

Tasks

This is the list of tasks this experiment want to cover:

  1. Basic controls:
    1. Static poses - Frame a point standing on the spot.
    • Bezier controller
    • Open Loop signal
    1. Gallop
      • forward
      • Bezier controller
      • Open Loop signal
      • backward
      • Bezier controller
      • Open Loop signal
    2. Walk
      • forward
      • Bezier controller
      • Open Loop signal
      • backward
      • Bezier controller
      • Open Loop signal
    3. Turn - on the spot
    • Bezier controller
    • Open Loop signal
    1. Stand up - from the floor
    • Bezier controller
    • Open Loop signal
  2. Navigate uneven terrains:
    • Random heightfield, hill, mount
    • Maze
    • Stairs
  3. Open a door
  4. Grab an object
  5. Fall recovery
  6. Reach a specific point in a map
  7. Map an open space

Terrains

To set a specific terrain, use the --terrain flag. The default terrain is the standard plane. This feature is quite useful to test the policy robustness.

Random heightfield

Use the --terrain random flag to generate a random heighfield pattern. This pattern is updated at every 'Reset' step.

hf

Hills

Use the --terrain hills flag to generate an uneven terrain.

hills

Mounts

Use the --terrain mounts flag to generate this scenario.

mounts

Maze

Use the --terrain maze flag to generate this scenario.

maze

Environments

Basic Controls: Static poses

Goal: Move Rex base to assume static poses standing on the spot.

Inverse kinematic

The gym environment is used to learn how to gracefully assume a pose avoiding too fast transactions. It uses a one-dimensional action space with a feedback component π(o) with bounds [-0.1, 0.1]. The feedback is applied to a sigmoid function to orchestrate the movement. When the --playground flag is used, it's possible to use the pyBullet UI to manually set a specific pose altering the robot base position (x,y,z) and orientation (roll, pitch, jaw).

Basic Controls: Gallop

Goal: Gallop straight on and stop at a desired position.

In order to make the learning more robust, the Rex target position is randomly chosen at every 'Reset' step.

Bezier controller

This gym environment is used to learn how to gracefully start the gait and then stop it after reaching the target position (on the x axis). It uses two-dimensional action space with a feedback component π(o) with bounds [-0.3, 0.3]. The feedback component is applied to two ramp functions used to orchestrate the gait. A correct start contributes to void the drift effect generated by the gait in the resulted learned policy.

Open Loop signal

This gym environment is used to let the system learn the gait from scratch. The action space has 4 dimensions, two for the front legs and feet and two for the rear legs and feet, with the feedback component output bounds [−0.3, 0.3].

Basic Controls: Walk

Goal: Walk straight on and stop at a desired position.

In order to make the learning more robust, the Rex target position is randomly chosen at every 'Reset' step.

Bezier controller

This gym environment is used to learn how to gracefully start the gait and then stop it after reaching the target position (on the x axis). It uses two-dimensional action space with a feedback component π(o) with bounds [-0.4, 0.4]. The feedback component is applied to two ramp functions used to orchestrate the gait. A correct start contributes to void the drift effect generated by the gait in the resulted learned policy.

Forward

Backwards

Open Loop signal

This gym environment uses a sinusoidal trajectory reference to alternate the Rex legs during the gait.

leg(t) = 0.1 cos(2π/T*t)
foot(t) = 0.2 cos(2π/T*t)

The feedback component has very small bounds: [-0.01, 0.01]. A ramp function are used to start and stop the gait gracefully.

Basic Controls: Turn on the spot

Goal: Reach a target orientation turning on the spot.

In order to make the learning more robust, the Rex start orientation and target are randomly chosen at every 'Reset' step.

Bezier controller

This gym environment is used to optimise the step_length and step_rotation arguments used by the GaitPlanner to implement the 'steer' gait. It uses a two-dimensional action space with a feedback component π(o) with bounds [-0.05, 0.05].

Open loop

This environment is used to learn a 'steer-on-the-spot' gait, allowing Rex to moving towards a specific orientation. It uses a two-dimensional action space with a small feedback component π(o) with bounds [-0.05, 0.05] to optimise the shoulder and foot angles during the gait.

Basic Controls: Stand up

Goal: Stand up starting from the standby position This environment introduces the rest_postion, ideally the position assumed when Rex is in standby.

Open loop

The action space is equals to 1 with a feedback component π(o) with bounds [-0.1, 0.1] used to optimise the signal timing. The signal function applies a 'brake' forcing Rex to assume an halfway position before completing the movement.

Environments parameters

Environment env flag arg flag
Galloping gallop target_position
Walking walk target_position
Turn turn init_orient, target_orient
Stand up standup N.A
arg Description
init_orient The starting orientation in rad.
target_orient The target orientation in rad.
target_position The target position (x axis).
Flags Description
log-dir The path where the log directory will be created. (Required)
playground A boolean to start a single training rendered session
agents-number Set the number of parallel agents

PPO Agent configuration

You may want to edit the PPO agent's default configuration, especially the number of parallel agents launched during the simulation.

Use the --agents-number flag, e.g. --agents-number 10.

This configuration will launch 10 agents (threads) in parallel to train your model.

The default value is setup in the agents/scripts/configs.py script:

def default():
    """Default configuration for PPO."""
    # General
    ...
    num_agents = 20

Credits

Papers

Sim-to-Real: Learning Agile Locomotion For Quadruped Robots and all the related papers. Google Brain, Google X, Google DeepMind - Minitaur Ghost Robotics.

Inverse Kinematic Analysis Of A Quadruped Robot

Leg Trajectory Planning for Quadruped Robots with High-Speed Trot Gait

Robot platform v1

Deok-yeon Kim creator of SpotMini.

The awesome Poppy Project.

SpotMicro CAD files: SpotMicroAI community.

Inspiring projects

The kinematics model was inspired by the great work done by Miguel Ayuso.

rex-gym's People

Contributors

dependabot[bot] avatar nicrusso7 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  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  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  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  avatar

rex-gym's Issues

running error in windows

Hi, I met an error when I ran the demo walk, the rex-gym has successfully installed on my windows.
Could you please tell me how to solve this problem?
Thank you!

PS F:\program_study\quadruped_robot\rex-gym> rex-gym policy --env walk
pybullet build time: Oct 24 2021 14:53:06
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "E:\program\Anaconda3\envs\pytorch\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\program\Anaconda3\envs\pytorch\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\program\Anaconda3\envs\pytorch\Scripts\rex-gym.exe\__main__.py", line 7, in <module>
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\click\core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\click\core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\rex_gym\cli\entry_point.py", line 31, in policy
    PolicyPlayer(env, args, signal_type).play()
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\rex_gym\playground\policy_player.py", line 29, in play
    config = utility.load_config(policy_dir)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\rex_gym\agents\scripts\utility.py", line 197, in load_config
    config = yaml.load(file_)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\main.py", line 951, in load
    return loader._constructor.get_single_data()
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 113, in get_single_data
    return self.construct_document(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 118, in construct_document
    data = self.construct_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 146, in construct_object
    data = self.construct_non_recursive_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_obje
ct
    data = constructor(self, tag_suffix, node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 1013, in construct_python_object_new

    return self.construct_python_object_apply(suffix, node, newobj=True)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 995, in construct_python_object_appl
y
    value = self.construct_mapping(node, deep=True)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 440, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 255, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 146, in construct_object
    data = self.construct_non_recursive_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 188, in construct_non_recursive_obje
ct
    for _dummy in generator:
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 723, in construct_yaml_map
    value = self.construct_mapping(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 440, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 255, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 146, in construct_object
    data = self.construct_non_recursive_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_obje
ct
    data = constructor(self, tag_suffix, node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 995, in construct_python_object_appl
y
    value = self.construct_mapping(node, deep=True)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 440, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 255, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 146, in construct_object
    data = self.construct_non_recursive_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 188, in construct_non_recursive_obje
ct
    for _dummy in generator:
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 717, in construct_yaml_seq
    data.extend(self.construct_sequence(node))
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 211, in construct_sequence
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 211, in <listcomp>
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 146, in construct_object
    data = self.construct_non_recursive_object(node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 183, in construct_non_recursive_obje
ct
    data = constructor(self, tag_suffix, node)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 913, in construct_python_name
    return self.find_python_name(suffix, node.start_mark)
  File "E:\program\Anaconda3\envs\pytorch\lib\site-packages\ruamel\yaml\constructor.py", line 898, in find_python_name
    mark,
ruamel.yaml.constructor.ConstructorError: while constructing a Python object
cannot find 'walk_env.RexWalkEnv' in the module 'rex_gym.envs.gym'
  in "E:\program\Anaconda3\envs\pytorch\lib\site-packages\rex_gym/policies/walk/ik\config.yaml", line 7, column 7
``

how to learn a policy from scratch

I want to train the robot to learn to walk from scratch, but I don't know what command or step to achieve it
Kindly let me know what to do.

change learning algorithm

I'm a newer to robot simulation in pybullet using gym and ubuntu, I' m confused about some question.
1、Through command line, the simulation can be run, which is not familar to me. How can I view the source code by pycharm?(I mean which file contains the simulation environment and PPO algorithm and any other code, is this package "/home/iver/anaconda3/envs/rex/lib/python3.7/site-packages/rex_gym"? But which is the main function correspond to command line? How can I run the training code from the source code?)
2、If I want to use DDPG or any other learning algorithm, which file I need to change?
3、I use command line to train a robot, but failed. PS. The tensorflow in my virtual environment is 1.15.0.
Screenshot from 2021-11-29 11-13-55
Screenshot from 2021-11-29 11-14-08
thanks a lot if you can offer me some help!

issue with installing

Hi,
pip install rex_gym
is downloading all the versions of rex_gym and I see a lot of red in my terminal.
please refer to the below image. Can someone tell me what's the issue and do I need to do anything else to install it in right
way. please let me know
Thank you
image

Robot walking backwards in headless mode

Hi

After I fixed the headless rendering issue I had another problem.

While running the policy_player in headless mode, I turned render option to False when initializing the environment, and used a gym.wrappers.monitoring.video_recorder to record the scene.
Here you can see the robot is walking smoothly backwards(walking environment, in mounts terrain).

2021-05-19.10.56.13.996819.mp4

Another case(gallop, plane), but this time is turning around

2021-05-19.11.09.19.051276.mp4

I tried enabling the sleep control in

if self._is_render:
# Sleep, otherwise the computation takes less time than real time,
# which will make the visualization like a fast-forward video.
time_spent = time.time() - self._last_frame_time
self._last_frame_time = time.time()
time_to_sleep = self.control_time_step - time_spent
if time_to_sleep > 0:
time.sleep(time_to_sleep)
base_pos = self.rex.GetBasePosition()
# Keep the previous orientation of the camera set by the user.
[yaw, pitch, dist] = self._pybullet_client.getDebugVisualizerCamera()[8:11]
self._pybullet_client.resetDebugVisualizerCamera(dist, yaw, pitch, base_pos)

but the problem still exists. Any ideas?

Thanks!

Offscreen rendering made terrain disappear

HI

I'm trying to add visual signal of the terrain to the agent.

While rendering in offscreen mode(I turned render option to False when initializing environment), I found that the terrain becam invisible, but the robot looks fine. Do you have any idea about how could I render the terrain without GUI?
image

Thanks!

cannot run

The following errors are reported after installation and operation

(rex) lrh@lrh:~/桌面/rex-gym$ rex-gym policy -e walk
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorflow_core/python/framework/dtypes.py:597: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.object,
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorflow_core/python/framework/dtypes.py:605: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.bool,
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py:106: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.object:
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py:108: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.bool:
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:568: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
(np.object, string),
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:569: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
(np.bool, bool),
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorboard/util/tensor_util.py:100: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.object: SlowAppendObjectArrayToTensorProto,
/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/tensorboard/util/tensor_util.py:101: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.bool: SlowAppendBoolArrayToTensorProto,
Traceback (most recent call last):
File "/home/lrh/anaconda3/envs/rex/bin/rex-gym", line 8, in
sys.exit(cli())
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/click/core.py", line 760, in invoke
return _callback(*args, **kwargs)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/rex_gym/cli/entry_point.py", line 31, in policy
PolicyPlayer(env, args, signal_type).play()
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/rex_gym/playground/policy_player.py", line 29, in play
config = utility.load_config(policy_dir)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/rex_gym/agents/scripts/utility.py", line 197, in load_config
config = yaml.load(file
)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/main.py", line 1071, in load
return loader._constructor.get_single_data()
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 121, in get_single_data
return self.construct_document(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 126, in construct_document
data = self.construct_object(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 154, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 191, in construct_non_recursive_object
data = constructor(self, tag_suffix, node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 955, in construct_python_object_new
return self.construct_python_object_apply(suffix, node, newobj=True)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 937, in construct_python_object_apply
value = self.construct_mapping(node, deep=True)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 445, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 261, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 154, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 196, in construct_non_recursive_object
for _dummy in generator:
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 674, in construct_yaml_map
value = self.construct_mapping(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 445, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 261, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 154, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 191, in construct_non_recursive_object
data = constructor(self, tag_suffix, node)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 865, in construct_python_name
return self.find_python_name(suffix, node.start_mark)
File "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 850, in find_python_name
mark,
ruamel.yaml.constructor.ConstructorError: while constructing a Python object
cannot find 'algorithm.PPOAlgorithm' in the module 'rex_gym.agents.ppo'
in "/home/lrh/anaconda3/envs/rex/lib/python3.7/site-packages/rex_gym/policies/walk/ik/config.yaml", line 3, column 14

Question about real robot and servos

Heyhey Nicola,

Great work with the repo and the robot!
I have a question about the servos: You're using the standard MG996R servos, right? And they don't give you any position feedback or torque feedback or literally any kind of feedback, right? I have one here and all it does is it accepts incoming PWM signals and then goes to the corresponding position.
My question is why do you have the Rex.GetMotorTorques() function in your robot class (or rather why is it part of your observation)? My concern is that a policy that was trained in simulation wouldn't transfer to the real robot if the state doesn't contain this information.

Cheers,
Flo

Training from command line example

Can you give an example of training a policy directly from the command line?

I've tried this but it doesn't seem to produce anything in the logging directory:

rex-gym train --playground True --env walk --log-dir ~/rex-gym/logging

Am I missing some arguments?

Issue with multiple envs and determinism

Hello,

Thanks for the project, it looks awesome.

I've been trying to use Stable-Baselines3 on it (we created a fork to register the gym env: https://github.com/osigaud/rex-gym)
and could train an agent on it, however after training or when using a second env for testing, we could not reproduce the results.

Do you know what can change between two instantiation of the environment?
It seems that the observation provided to the agent is somehow quite different to the one seen during training.
(we are testing simple walk forward on a plane)

I'm using the RL Zoo to train the agent (and remove any kind of mistake from my part). It works with other pybullet envs perfectly (e.g. with HalfCheetahBulletEnv-v0) but not with rex-gym :/

Additionally, it seems that the env is not deterministic, could you confirm? And do you know why?

PS: if needed I can provide a minimal example to reproduce the issue

General questions

Just a few general questions:

  1. How do I run a policy from a trained model?
  2. How do I restart training from the same place I left off if I stop in the middle or the training crashes?

Not sure if my training is working. No window opens.

I was trying to run the command rex-gym train --playground True --env walk --log-dir "trainLogs" but I only get the following screen:
image

What am I doing wrong? I am using Windows, and I installed the packages from source.

about training use gpu or cpu

hello ,i have a question for this :
if i train with gpu ,the training process will get stuck ,i do not know why,
but if i train with cpu ,all is ok.
i do not understand why ?

OSError while running rex-gym policy

Anaconda Prompt (Anacondar) 06-07-2020 11_29_37

i have followed the readme and installed rex-gym in a conda environment. While running "rex-gym policy --env gallop" i am getting an OSError: Cannot resume an existing run since the logging directory does not contain a configuration file.

Please help me resolve the error.

Modules dependencies error

Hi, I'm using Windows11(OSBuild:22621.674) and running this on virtual env on anaconda. I installed rex-gym from source (not PyPi).
Then, I faced same problem as this and I tried pip install --no-dependencies . but I still in pip's dependecies problem.
It seems the install succeeded, but actually, a lot of modules which is needed for rex-gym weren't installed such as gym.
image
I tried to install them manually , but I couldn't find appropriate version.
How do you solve the dependencies problems? Please let me know. Thank you.

Considerations for 'Learning Quadrupedal Locomotion over Challenging Terrain' Paper

Hi @nicrusso7,

Thank you for this fantastic effort in making this niche field open sourced. I was browsing through your source code as well as the research paper that inspired this work, and made some comparisons with more recent advancements in Deep Reinforcement Learning for robotic quadrupeds.

  1. How much effort is required to use this existing work to train another robotic quadruped of an entirely different set of URDF? For instance, how much changes do we need to do in order to train the Anymal Model C robot (URDF here)?

  2. If adapting the existing framework to accomodate other types of quadrupeds is simple, how much effort is required to update the the approach to match current approaches? For instance, the work as shown by the ETH Zurich's Robotics Systems Lab? (For one, they use Raisim while this repository is in the OpenAI Gym environment)

I am really excited about the prospect of Legged robots, and would love to invest the time to furthering the work in this repository. Looking forward to hearing from you!

Regards,
Derek

Installation error

firstly, well done on what I have read so far. I am trying to install and followed your instructions, however I received an error:
pip install rex_gym
Collecting rex_gym
Using cached https://files.pythonhosted.org/packages/98/1c/6d979037d598d3ddd410908eba0bbcf76b464ebd22143a8d9682c3a9af26/rex_gym-0.1.7.tar.gz
ERROR: Command errored out with exit status 1:
command: 'C:\Users\user.conda\envs\rex\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\setup.py'"'"'; file='"'"'C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\pip-egg-info'
cwd: C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym
Complete output (9 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\setup.py", line 37, in
'': [f for f in copy_assets('policies')] + [a for a in copy_assets('util')]
File "C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\setup.py", line 37, in
'': [f for f in copy_assets('policies')] + [a for a in copy_assets('util')]
File "C:\Users\user\AppData\Local\Temp\pip-install-jqupm9ki\rex-gym\setup.py", line 16, in copy_assets
yield os.path.join(dirpath.split('/', 1)[1], f)
IndexError: list index out of range
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Have you see this error before? I hope you can help, looking forward to reviewing.

--RW

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.