jiminy

Jiminy: a fast and portable Python/C++ simulator of poly-articulated robots with OpenAI Gym interface for reinforcement learning

MIT License

Downloads
21.5K
Stars
196
Committers
6
jiminy - [misc] Minor code quality improvements.

Published by duburcqa over 3 years ago

This release brings minor performance improvement. It is mainly intended to improvement overall code quality and consistency with standard naming conventions (essentially Mujoco terminology). A convenience tool to interpolate trajectories in Lie group space has also been added.

New features

  • [core|python/viewer] Provide generic interpolation method for configuration evolution over time. Use it in Python viewer.

Improvements

  • [core] Compute subtree coms by default.
  • [core] Do not compute 'oMf' for 'JOINT' and 'BODY' frames but rather copy data from 'oMi' and 'oMf'.
  • [core] Improvement breakpoint management to avoid skipping controller/sensor updates.
  • [core] Return static variables for Robot 'getControlLimit' and 'getArmatures' to avoid memory allocations.
  • [core] Set 'command' and 'u_custom' to zero automatically before calling callbacks.
  • [core] Improve vector 'clamp' utility to avoid memory allocation.
  • [core/python] Make sure registered variables vector is 1D.
  • [core|python] Add option to monitor motor efforts and plot them by default instead of command.
  • [python/robot] Enable setting options only partially.
  • [python/dynamics] Add optional flag to update collisions. Fix com jacobian not computed even if requested.
  • [python/simulator] Do not forbid to render system at if no simulation is running.
  • [gym/common] Ensure float64 action buffer for compatibility with register_variable telemetry.
  • [gym/common/envs] Increment 'num_steps' only at the end of successful step, not right before integration.
  • [gym/common/envs] Set robot in neutral configuration at init.

Bug fixes

  • [core] Fix edge case in controller breakpoints management.
  • [gym/common/envs] Fix edge case for robot without sensors.
  • [gym/common/envs] Do not enforce position/velocity/effort bounds at _setup to avoid inconsistent observation/action spaces bounds.

Miscellaneous

  • [misc] Move to C++17 for dependencies.
  • [core] Rename 'rotorInertia' in 'armature' to be consistent with mujoco and clearer that it is joint side.
  • [core] Rename 'EffortLimit' in 'ControlLimit' to avoid redundancy with pinocchio::Data and explicit it is motor-side.
  • [core] Rename 'ControlLimit' in 'CommandLimit' for consistency.
  • [core] Rename 'u_command' in 'command' to clarify it does not have to be an effort.
  • [core] Add dedicated 'u_custom' field for controller's internal dynamics.
  • [core] Replace 'u' with more specific variable name when possible.
  • [core] Split evaluation of custom internal dynamics from position/velocity bounds and flexibility dynamics.
jiminy - [core] New type of pre-defined coupling force.

Published by duburcqa over 3 years ago

Another small release consisting mainly in bug fixes. In addition, a new type of pre-defined visco-elastic coupling force has been added, acting independently in each direction instead of only along coupling direction.

New features

  • [core] Add non-directional visco-elastic coupling force (acting independently in each direction).

Improvements

  • [core] Fix adaptive RK dopri stepper MAX_FACTOR wrongly scaled by SAFETY factor.
  • [gym/common/envs] Do not log internal steps in debug mode to keep log consistent with experience replay.

Bug fixes

  • [core] Fix visco-elastic directional coupling force.
  • [core] Fix pinocchio_data updated with joint forces not taking into account the external forces.
  • [core] Fix telemetry logging failed internal stepper steps.
  • [core] Fix wrong computation of multi-systems coupling forces.
  • [python/viewer] Fix replay using rigid instead of flexible model.
  • [python/viewer] Fix mesh path on windows.

Miscellaneous

  • [gym/common] Rename 'size' argument of 'sample' method in 'shape' for consistency with standard API.
jiminy - [HOT FIX] Fix Pinocchio data not properly updated.

Published by duburcqa over 3 years ago

Tiny release to fix a critical bug causing corruption of sensors data (IMU, Force Sensors, and Contact Sensors).

Bug fixes

  • [core] Fix joints accel/force restored right after computations instead of before sensor update.

Miscellaneous

  • [misc] Check no memory allocation by Eigen during simulation.
  • [misc] Update Eigen to latest release (3.3.9) on CI.
jiminy - [core] Simulation speedup (again!)

Published by duburcqa over 3 years ago

Simulation speed has been increased by at least 15%, mainly avoiding memory allocation during simulation, postponing accelerations and forces updates until successful stepper step, and not computing all terms for internal stepper steps.

  • [core] Avoid algebraic loop in internal stepper steps by postponing accel/force updates after successful outer step.
  • [core] Move centroidal kinematics computations in stepper outer loop for efficiency.
  • [core] Assume slow variation of subtree inertia during one integration step for efficiency.
  • [core] Avoid memory allocation for 'computeAcceleration', 'updateTelemetry' and 'computeAllEffort'.
  • [misc] Fix double_pendulum c++ example using Eigen::Ref for controller handles instead of vectorN_t.
jiminy - [core] Speedup simulation by preventing memory allocation.

Published by duburcqa over 3 years ago

Simulation speed has been increased by at least 15% by avoiding the stepper to allocate memory dynamically once a simulation has started.

Improvements

  • [gym] Use float32 action space instead of float64 because it is the usual dtype for neural networks.
  • [core] Avoid memory allocation during Lie algebra computations without relying on compiler optimizations.

Miscellaneous

  • [misc] Update Cmake to support RelWithDebInfo. Enable more Cmake warnings.
jiminy - [core] Efficient visco-elastic external forces computation.

Published by duburcqa over 3 years ago

This release makes it possible to add visco-elastic (spring-damper mechanism) coupling force between two frame on the same or different robots, without having to implement them manually. It brings a huge speedup wrt doing it in Python (even using Numba). In addition, a few redundant computations have been removed, resulting in a minor overall speedup.

New features

  • [core] Add viscoelastic coupling force between frames.

Improvements

  • [core] Disable stepper 'iterMax' by default.
  • [core] Abort simulation if 'nan' detected in 'q', 'v', 'a' instead of 'a' only.
  • [core] Increase maximum simulation timestep.
  • [core] Do not call rnea directly in 'computeAcceleration' to avoid redundant computations.
  • [python/controller] Improve efficiency by making controller/observer handles optional.
  • [gym/common/env] Return is_done=True if simulation is not running anymore.
  • [gym/common/env] Use OrderedDict instead of dict to avoid conflicts with ray[rllib].

Bug fixes

  • [core] Fix segfault when initializing sensor using unvalid robot.
  • [core] Fix Euler Explicit stepper not working as expected.
  • [python] Fix potential infinite recursion loop during custom attribute lookup.
  • [python/log] Fix 'Global.Time' not in seconds when reading hdf5 logfiles.
  • [python/viewer] Fix legend warning wrongly displayed.
  • [gym/common/wrapper] Rework 'PartialFrameStack' to be consistent with official 'FilterStack'.

Miscellaneous

  • [misc] Update gitignore to ignore log folders.
  • [misc] Increase stepper tolerance in unit test to be consistent with check accuracy.
  • [misc] Fix new Cmake policy CMP0111.
  • [misc] Fix type checking to support latest mypy/pylint releases.
  • [misc] Assume pip 21.0 for Cmake and install it on Windows CI. Minor improvements of Cmake files.
  • [misc] Remove useless boost submodules dependencies.
  • [misc] Do NOT support Numpy >= 1.20 explicitly, since not compatible with Python3.6.
  • [misc] Fix toy model learning unit tests.

Co-authored-by: Alexis Duburcq [email protected]

jiminy - [core/python] Improve usability and reliability.

Published by duburcqa almost 4 years ago

This release fixes the long lasting issue of robot getting deleted without letting know the others relying on it, causing erratic segfaults hard to diagnose. It also adds several mechanisms to ensure the consistency of the data, and proper update of low-level pinocchio::Data, to avoid having to manually update anything that the user may expect already having been computing. It comes at an addition computational burden, but it is the price to pay to avoid nasty mistakes.

New features

  • [core/python] Enable to define custom constraints directly in Python.

Improvements

  • [core] Use std::weak_ptr instead of raw pointer to avoid segfault if object gets destroyed in the meantime.
  • [core] Make sure controller's robot and system's robot are consistent when add system to engine.
  • [core] Refactor constraints to improve efficiency and make it more intuitive to define and use.
  • [core] Fix joint acceleration not properly updated after calling 'computeAcceleration' method of Engine.
  • [core/python] Add 'BaseControllerFunctor', allowing overloading of 'reset' method in Python.
  • [python/simulator] Avoid attribute lookup infinite loop.
  • [python/simulator] Ensure consistent model between robot model and log data before plotting them.
  • [gym/common/env] Set the controller before resetting it and getting sensors data since the robot may no longer exists.

Miscellaneous

  • [core/python] Rename 'AbstractControllerWrapper' in 'BaseController' to clarify it is not abstract but the base controller class.
  • [python/controller] Inherit from 'BaseController' instead of 'BaseControllerFunctor' since callbacks are handled manually.
jiminy - [core|python] More intuitive and straightforward control design.

Published by duburcqa almost 4 years ago

This release aims to make it easier and more intuitive to implement custom robot controllers. It also gets rid of custom file extensions for configuration files for clarity.

New features

  • [core/python] Enable direct inheritence of Python controllers from AbstractController.

Improvements

  • [core] Do not throw exception when calling addCollisionBodies with empty list and no geometry model.
  • [core/python] Add getters for controller's robot model and sensors data.
  • [core/python] Support engine init using callback only. Using single init method with default None args.
  • [python] Replace dedicated '.hdf'/'.config' extensions by '_hardware.toml'/'_options.toml' for clarity.
  • [python/robot] Enable to "fix" (aka override) relative mesh paths is URDF using 'mesh_path'.
  • [python/simulator] Move progress bar management at simulator level instead of controller. No controller by default.

Bug fixes

  • [core] Fix initialization of engine without controller.
  • [python/controller] Fix initialization throwing exception if OK.
  • [python/simulator] Fix 'build' method not fully compatible with derived classes overloading 'init'.
  • [python/simulator] Fix infinite recursive loop at exist if simulator constructor fails.

Miscellaneous

  • [misc] Disable compilation LTO since it is not really improving anything.
jiminy - [misc] Regular dependency update.

Published by duburcqa almost 4 years ago

The pre-compiled binaries of EigenPy, Hpp-Fcl and Pinocchio have been updated to the latest available releases. In addition, several bugs have been fixed (including a segfault!).

Bug fixes

  • [core] Fix flaky memory corruption segfault when adding frame to model.
  • [core] Fix special cmake linkage flags 'optimized'/'debug' not being properly detected for Boost.
  • [python/simulator] Fix progress bar glitches if simulate raises an exception during a simulation.

Miscellaneous

  • [misc] Update pre-compiled binaries of dependencies (EigenPy 2.6.0, Hpp-Fcl 1.6.0, Pinocchio 2.5.5).
  • [misc] Fix several cmake edge cases.
  • [misc] Enable linker optimizations.
  • [core] Take advantage of new features and improved Windows 10 support to simply codebase.
jiminy - Jiminy 1.5

Published by duburcqa almost 4 years ago

This release introduces a new (experimental!) high-performance and customizable viewer backend based on Panda3D, which supports both offscreen and onscreen rendering. Yet, some features of Viewer may not be working properly, and offscreen rendering requires X11 server on Linux for now. Notably, it is now possible to add flexibilities at fixed joint frames, and to add coupling forces between frames of the same robot.

Many important new features, breaking changes and critical bug fixes have been introduced since release 1.4.0, so it is time to bump up the minor version tag!

New features:

  • [core] Log robot input args, robot urdf content, and all options as constants.
  • [core] Enable to add flexible joints at any FIXED_JOINT frame.
  • [core] Add composite centroidal rigid-body inertia computation to 'computeForwardKinematics'.
  • [core] Enable to add coupling forces between frames of the same robot.
  • [python/viewer] Add partial support of Panda3d visualizer.

Improvements:

  • [core] Store constants in hdf5 datasets instead of attributes to get around 64K size limit.
  • [core] TMLC telemetry format now supports both attributes and dataset field.
  • [core] Do not enforce position/velocity limits at init if disable.
  • [core] Fallback to not loading/using collision model if meshes are missing.
  • [core|core/python] Expose 'computeForwardKinematics'.
  • [core/python] Enable to get system from 'Engine'.
  • [python/log] Fix print logged variables.
  • [python/robot] Fixes some edge cases when automatically generating HDF file.
  • [python/robot] Enable explicit robot initialization without hardware description file.
  • [python/robot] Skip collision bounding box handling if meshes are not available.
  • [python/simulator] Simulator's Viewer instance is no longer private attribute.
  • [gym] Make viewer instance directly accessible in pipeline environments.
  • [gym] Get access to simulator's attributes directly.
  • [gym/common] Add new random sampling utility.
  • [gym/common/env] Make sure robot shared memory is reset after calling '_setup'.
  • [gym/common/env] Do not log error is observation is out-of-bounds, and only warning in debug.
  • [gym/common/env] Make sure the low-level engine memory address does not change.
  • [core/python] Avoid memory allocation by 'compute_systems_dynamics' for efficiency.

Bug fixes:

  • [core] Fix body forces wrongly computed by 'aba'.
  • [core] Fix 'getRigidConfigurationFromFlexible' method of Model class.
  • [core] Fix computeSystemDynamics edge case and Python binding signature.
  • [core/python] Fix bindings of some system_state object fields.
  • [python/robot] Fix support of multiple collision boxes.
  • [python/simulator] Fix callback not working since scalar references are now ndarray in Python.
  • [python/simulator] Fix 'state' property for 'use_theoretical_state'=True.
  • [python/viewer] Fix viewer exception when closing backend during replay.
  • [gym/common/env] Fix 'replay' not working.

Miscellaneous:

  • [core] Double space before inline comments.
  • [core] Add constant for telemetry constant delimiter.
  • [core] Clarity telemetry namespace.
  • [core|core/python] Rename 'computeSystemDynamics' in 'computeSystemsDynamics' for consistency.
  • [core/python] Simplify C++ to Python log converter.
  • [python/viewer] Split viewer and replay tools in separated submodules to reduce file complexity.
  • [python/viewer] Rename 'replay_speed' in 'speed_ratio' for clarity.
jiminy - [gym] Add support of discrete action spaces.

Published by duburcqa almost 4 years ago

This release adds support of discrete action spaces. It also fixes several non-critical issues related to core, gym, unit tests, and docs.

Improvements:

  • [gym] Check if the action/observation are out-of-bounds in debug mode.
  • [gym] Forward debug argument for classic control envs.
  • [gym] Add back unit test for acrobot and test both continuous and discrete action space.
  • [gym] Fix convergence issues of classic control learning unit tests.

Bug fixes:

  • [core] Fix velocity bounds not taken into account for unbounded joints.
  • [core] Fix successful iteration failure counter not properly reset.
  • [gym] Fix support of Discrete space.
  • [gym] Fix invalid debug write log format.
  • [gym] Fix classic control envs observation space and discrete action space handling.

Miscellaneous:

  • [misc] Silent external projects warning for compatibility with Cmake < 2.8.12.
  • [misc] Fix Python bindings docstring substitution.
  • [core] Display error messages in red instead of green.
  • [core] Display warning messages if position/velocity bounds are enabled but not implemented.
  • [core/python] Remove useless include.
jiminy - [python/viewer] Improve stability and usability of replay.

Published by duburcqa almost 4 years ago

This release fix several bugs that has been introduced in the previous ones. It also makes it easier to use the newly added color names, legend and watermark options for simulation replay.

Improvements:

  • [python/viewer] Add support of 'jpeg', 'svg' formats and url path for watermark.
  • [python/viewer] Set max width/height of watermark instead of exact ones to preserve aspect ratio.

Bug fixes:

  • [core/python] Engine flag 'getIsSimulationRunning' is now returned by reference, fixing a bug with copy proxy.
  • [python/simulator] Fix low-level reset/simulate methods wrongly called.
  • [python/simulator] Fix generic time-series 'plot' method if data is missing.
  • [python/viewer] Fix tuple urdf_rgba support.
  • [python/viewer] Fix legend not showing up in some cases.
  • [python/viewer] Fix legend font on Windows.

Miscellaneous:

  • [core/python] Split bindings in multiple files to reduce compilation time.
  • [python/viewer] Rename logo in watermark for clarity.
jiminy - [python/viewer] Add dedicated widgets manager for Meshcat.

Published by duburcqa almost 4 years ago

This release introduces a new dedicated widgets manager for Meshcat that enables to display information on top of three.js rendering. Those are captured when taking screenshot or recording videos. In addition, the default format when capturing frames is now .png, which is about 30% faster.

New features:

  • [python/viewer] Add new dedicated widgets manager. Only legend and watermark are available for now.
  • [python/viewer] Enable to capture widgets on top of three.js rendering.

Bug fixes:

  • [python/viewer] Force disabling legend if not all robots have colors when replaying trajectories.
  • [python/viewer] Fix replay when at least one of the trajectories is empty.

Miscellaneous:

  • [python/viewer] Always capture frames in '.png' format.
jiminy - [viewer] New features for Meshcat

Published by duburcqa almost 4 years ago

This release introduces new options for the viewer to display a customizable matplotlib-like legend (draggable!) and a log/watermark on top of Meshcat web-based visualizer.

New features:

  • [python/viewer] Add 'legend' and 'logo_fullpath' optional argument to 'play_trajectories'.

Improvements:

  • [core/python] Do not use Eigenpy to convert systemState.q/v/a to improve efficiency and preserve constness.
  • [gym] Define shared memories/proxies at init when possible.
  • [gym/envs] Improve performance of classic control environments (acrobot, cartpole).

Miscellaneous:

  • [python|gym] Add Python native 'is_simulation_running' attribute to Simulator for fast access.
  • [gym] Replace 'engine' proxy by 'simulator' for greater flexibility.
jiminy - [gym] Overall performance improvement (3x).

Published by duburcqa almost 4 years ago

Gym Jiminy, and especially the pipeline design tools, have been heavily refactored to improves performance. The keystone was to share references to avoid copies and memory allocations as such as possible. It also removes automatic clamping of actions/observations. It is up to the user to re-enable it, e.g. using gym wrappers. In addition, the efficiency of computationally demanding gym space helpers and provided PID controller block have been greatly enhanced. 3 times speed-up is to be expected.

Improvements:

  • [core/python] Add extra parameter to convertToPython to return either reference or copy.
  • [python|gym] Add unsafe set handle for controller to avoid of the cost of handling initialization separately.
  • [gym] Refactor observation block chaining to use references for efficiency.
  • [gym] Refactor GoalEnv to make it easier to use.

Bug fixes:

  • [core] Fix segfault in some cases when 'start' method fails.

Miscellaneous:

  • [core] Print error and warning messages on stderr instead of stdout.
  • [core] Always remove robot lock when calling Engine.Stop.
  • [core/python] Preserve constness of systemState Python bindings.
  • [gym] Use np.core.umath.* directly in helper methods for efficiency.
  • [gym] Reorder branches in helper methods to find most frequent case first.
  • [gym] Add engine/stepper_state/system_state/sensors_state proxies to speed-up attribute lookup.
  • [gym] Use 'dict/{}' instead of OrderedDict in 'step' method and calles for efficiency.
  • [gym] Observe state as a dict instead of array to avoid memory allocation.
  • [gym] Do not clip observation/action by default for efficiency.
  • [gym] Pre-compiled PID law for efficiency.
  • [gym] Rename _clamp in clip for consistency with numpy.
  • [gym] No longer use 'encoder.fieldnames' to define state and pid target fields.
jiminy - [python] Improve stability and reliability.

Published by duburcqa almost 4 years ago

This release improves the general stability of jiminy_py, and especially the viewer. Additionally, it adds support of color names (e.g. 'orange') instead of RGBA color code for convenience.

Improvements:

  • [python/viewer] Do not refresh camera pose automatically if no camera motion nor travelling.
  • [python/viewer] Add support of string color to 'play_trajectories'.

Bug fixes:

  • [core/python] Fix segfault when reading log without data.
  • [python/simulation] Fix exception handling at reset.
  • [python/viewer] Fix color handling for robot with reference material.
  • [python/viewer] Fix exception if viewer arg is None for play_trajectories.
  • [gym/examples] Fix tianshou rendering update period.

Miscellaneous:

  • [misc] Fix telemetry format doc.
  • [python/simulator] Throw error and replaying simulation without data.
  • [python/simulator] Remove useless check for 'getattr'.
  • [python/viewer] Ensure unique robot names during replay.
  • [gym] More explicit error message for 'set_value' helper.
jiminy - [HOTFIX] Hot fix Python 3.6 on Windows 10.

Published by duburcqa almost 4 years ago

Jiminy_py viewer recorder is hanging on Windows 10 for Python 3.6 because the subprocess creation is silently failing.

jiminy - [python] Improve viewer stability and reliability.

Published by duburcqa almost 4 years ago

This release improves the stability of the viewer. In addition, it introduces a default color cycle when replying simulation for multiple robots at once (7 different colors).

Improvements:

  • [python/viewer] Add default colors if multiple robot are replayed at the same time.
  • [python/viewer] Redirect meshcat backend std_err to devnull to avoid flooding main thread.

Bug fixes:

  • [core] Fix jiminy.Robot multiple initialize.
  • [python/viewer] Fix edge case make the robot not appear in viewer if closed manually and reopen with same name.
  • [python/viewer] Handle backend process kill timeout exceptions.

Miscellaneous:

  • [misc] Disable automatic forward compatibility of numba to avoid potential install failure.
jiminy - [python] Improve plotting and replaying capability.

Published by duburcqa almost 4 years ago

This release adds camera motion planning capability, and significantly improves the stability of log plotting and replaying utilities.

New features:

  • [python/viewer] Add new camera motion planning when replying trajectories.

Improvements:

  • [python/viewer] Enable to change urdf color in already instantiated viewers.
  • [python/viewer] Enable to set relative camera pose in Meshcat.
  • [python/viewer] Rework travelling to be more flexible and more sure only is enable at a time.

Bug fixes:

  • [python/simulator] Catch more exceptions.
  • [python/simulator] Ensure proper argument forwarding for 'replay' method.
  • [python/simulator] Fix bugs and glitches for 'plot' method. Disable inter-tab sync of x-axis (time).
  • [python/viewer] Fix global attributes not reset if backend viewer is closed by user manually.
  • [python/viewer] Fix color not taken into account in some cases.

Miscellaneous:

  • [python/simulator] Forbid calling 'render' method if no simulation running.
  • [python/viewer] Improve typing of 'play_trajectories'.
  • [python|gym] Move 'replay' method from 'BaseJiminyEnv' to 'Simulator'.
jiminy - [core] Improve joints position/velocity bounds model.

Published by duburcqa almost 4 years ago

This release introduces a new position/velocity bounds model that should be both more strict and more stable numerically. It acts at kinematic level instead of dynamics and absorb more energy to reduce bouncing effect. In addition, motor inertia is now taken into account for any type of 1dof joints, and the associated custom aba, rnea and kinematicEnergy methods are exposed in Python.

New features:

  • [core/python] Expose custom pinocchio algorithms to support motor inertia.
  • [core] Bounds limits efforts are now proportional to joint's subtree inertia.

Improvements:

  • [core] Remove blending factor for joint bounds because it does more harm than good.
  • [core] Add support of translation joints.
  • [core] Support any 1D type of joints for rotor inertia.
  • [core/python] Ensure constness when passing C++ variables to Python handles.
  • [gym] Disable engine timeout if debug enable.

Bug fixes:

  • [core] Fix edge case when reading log after calling start and no actual data is available.
  • [python/simulator] Reset viewer when calling 'reset' method to avoid corrupted viewer internal state.
  • [python/viewer] Various minor bug fixes.

Miscellaneous:

  • [core] PRINT_* macros do not terminate by ;
  • [core] Use C++17 constexpr in some places.
  • [core] Add constexp 'is_pinocchio_joint_*_v' to determine the type of joint at compile type.
  • [core] Improve get joint type getter to use joint visitor instead of string comparison.