├── .gitignore ├── ACKNOWLEDGEMENTS.md ├── AUTHORS.md ├── LICENSE.md ├── README.md ├── examples ├── CMakeLists.txt ├── framework │ ├── CMakeLists.txt │ ├── python │ │ └── graph.py │ └── src │ │ ├── graph.cpp │ │ ├── hello.cpp │ │ ├── hyperparams.cpp │ │ ├── message.cpp │ │ ├── random.cpp │ │ └── tensorboard.cpp ├── gym │ ├── README.md │ ├── classic │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── acrobot.cpp │ │ │ ├── cartpole.cpp │ │ │ └── pendulum.cpp │ ├── core │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── Environment.hpp │ │ │ ├── simple.cpp │ │ │ ├── synchronized.cpp │ │ │ └── vectorized.cpp │ ├── mujoco │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── hopper.cpp │ └── raisim │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── capler.cpp │ │ └── kinova3.cpp ├── package.xml └── rl │ ├── classic │ ├── CMakeLists.txt │ └── src │ │ ├── acrobot │ │ ├── acrobot.cpp │ │ ├── graph.py │ │ └── parameters.xml │ │ ├── cartpole │ │ ├── cartpole.cpp │ │ ├── graph.py │ │ └── parameters.xml │ │ └── pendulum │ │ ├── graph.py │ │ ├── parameters.xml │ │ └── pendulum.cpp │ ├── mujoco │ ├── CMakeLists.txt │ ├── resources │ │ └── hyperparams │ │ │ ├── agent │ │ │ ├── model.xml │ │ │ ├── ppo.xml │ │ │ └── trpo.xml │ │ │ ├── environment │ │ │ ├── ant.xml │ │ │ ├── halfcheetah.xml │ │ │ ├── hopper.xml │ │ │ ├── humanoid.xml │ │ │ └── walker2d.xml │ │ │ ├── test.xml │ │ │ └── train.xml │ └── src │ │ ├── agents.hpp │ │ ├── environments.hpp │ │ ├── test_mujoco.cpp │ │ └── train_mujoco.cpp │ └── raisim │ ├── CMakeLists.txt │ └── src │ ├── capler │ ├── ppo │ │ ├── graph-baseline.py │ │ ├── graph-shared-layer.py │ │ ├── graph-shared-net.py │ │ ├── graph-state-dep-stddev-shared-layer.py │ │ ├── graph-state-dep-stddev-shared-net.py │ │ ├── graph-state-dep-stddev.py │ │ ├── parameters.xml │ │ ├── plot.py │ │ ├── run.sh │ │ ├── test.cpp │ │ └── train.cpp │ └── trpo │ │ ├── graph.py │ │ ├── parameters.xml │ │ ├── test.cpp │ │ └── train.cpp │ └── kinova3 │ ├── graph.py │ ├── mdp.hpp │ ├── perf.cpp │ ├── ppo.xml │ ├── sample.cpp │ ├── test.cpp │ ├── train.cpp │ └── train.sh ├── noesis ├── CMakeLists.txt ├── README.md ├── bin │ └── python.sh ├── cmake │ ├── GTestMacros.cmake │ └── noesis-config.cmake.in ├── include │ ├── noesis │ │ ├── framework │ │ │ ├── core │ │ │ │ ├── Graph.hpp │ │ │ │ ├── Graph.tpp │ │ │ │ ├── Object.hpp │ │ │ │ ├── Tensor.hpp │ │ │ │ ├── TensorAllocator.hpp │ │ │ │ ├── TensorMap.hpp │ │ │ │ ├── TensorTuple.hpp │ │ │ │ └── TensorsSpec.hpp │ │ │ ├── hyperparam │ │ │ │ ├── HyperParameter.hpp │ │ │ │ ├── HyperParameterManager.hpp │ │ │ │ ├── HyperParameterTuple.hpp │ │ │ │ └── hyper_parameters.hpp │ │ │ ├── log │ │ │ │ ├── message.hpp │ │ │ │ ├── metric.hpp │ │ │ │ ├── tensorboard.hpp │ │ │ │ ├── tensorboard.tpp │ │ │ │ └── timer.hpp │ │ │ ├── math │ │ │ │ ├── TensorStatistic.hpp │ │ │ │ ├── TensorTupleStatistic.hpp │ │ │ │ ├── ops.hpp │ │ │ │ ├── random.hpp │ │ │ │ └── statistics.hpp │ │ │ ├── system │ │ │ │ ├── filesystem.hpp │ │ │ │ ├── process.hpp │ │ │ │ ├── signal.hpp │ │ │ │ ├── tensorflow.hpp │ │ │ │ ├── time.hpp │ │ │ │ └── version.hpp │ │ │ └── utils │ │ │ │ ├── checksum.hpp │ │ │ │ ├── csv.hpp │ │ │ │ ├── dataset.hpp │ │ │ │ ├── filestream.hpp │ │ │ │ ├── macros.hpp │ │ │ │ ├── png.hpp │ │ │ │ ├── string.hpp │ │ │ │ └── xml.hpp │ │ ├── gym │ │ │ ├── core │ │ │ │ ├── Environment.hpp │ │ │ │ ├── Synchronizer.hpp │ │ │ │ └── Vector.hpp │ │ │ ├── envs │ │ │ │ ├── classic │ │ │ │ │ ├── acrobot │ │ │ │ │ │ ├── AcrobotEnvironment.hpp │ │ │ │ │ │ └── AcrobotVisualizer.hpp │ │ │ │ │ ├── cartpole │ │ │ │ │ │ ├── CartpoleEnvironment.hpp │ │ │ │ │ │ └── CartpoleVisualizer.hpp │ │ │ │ │ ├── common │ │ │ │ │ │ └── visualizer.hpp │ │ │ │ │ └── pendulum │ │ │ │ │ │ ├── PendulumEnvironment.hpp │ │ │ │ │ │ └── PendulumVisualizer.hpp │ │ │ │ ├── mujoco │ │ │ │ │ ├── ant │ │ │ │ │ │ ├── AntActions.hpp │ │ │ │ │ │ ├── AntEnvironment.hpp │ │ │ │ │ │ └── AntObservations.hpp │ │ │ │ │ ├── common │ │ │ │ │ │ ├── simulation.hpp │ │ │ │ │ │ └── visualizer.hpp │ │ │ │ │ ├── halfcheetah │ │ │ │ │ │ ├── HalfcheetahActions.hpp │ │ │ │ │ │ ├── HalfcheetahEnvironment.hpp │ │ │ │ │ │ └── HalfcheetahObservations.hpp │ │ │ │ │ ├── hopper │ │ │ │ │ │ ├── HopperActions.hpp │ │ │ │ │ │ ├── HopperEnvironment.hpp │ │ │ │ │ │ └── HopperObservations.hpp │ │ │ │ │ ├── humanoid │ │ │ │ │ │ ├── HumanoidActions.hpp │ │ │ │ │ │ ├── HumanoidEnvironment.hpp │ │ │ │ │ │ └── HumanoidObservations.hpp │ │ │ │ │ └── walker2d │ │ │ │ │ │ ├── Walker2dActions.hpp │ │ │ │ │ │ ├── Walker2dEnvironment.hpp │ │ │ │ │ │ └── Walker2dObservations.hpp │ │ │ │ └── raisim │ │ │ │ │ ├── capler │ │ │ │ │ ├── CaplerEnvironment.hpp │ │ │ │ │ ├── CaplerSimulation.hpp │ │ │ │ │ └── CaplerVisualizer.hpp │ │ │ │ │ ├── common │ │ │ │ │ ├── filters.hpp │ │ │ │ │ ├── logging.hpp │ │ │ │ │ ├── math.hpp │ │ │ │ │ ├── raisim.hpp │ │ │ │ │ ├── signals.hpp │ │ │ │ │ ├── trajectory.hpp │ │ │ │ │ ├── types.hpp │ │ │ │ │ ├── visualizer.hpp │ │ │ │ │ └── world.hpp │ │ │ │ │ └── kinova3 │ │ │ │ │ ├── Kinova3Simulation.hpp │ │ │ │ │ └── Kinova3Visualizer.hpp │ │ │ └── train │ │ │ │ ├── MonitorInterface.hpp │ │ │ │ ├── RunnerInterface.hpp │ │ │ │ ├── SamplerInterface.hpp │ │ │ │ └── VisualizerInterface.hpp │ │ ├── mdp │ │ │ ├── AgentInterface.hpp │ │ │ ├── EnvironmentInterface.hpp │ │ │ └── types.hpp │ │ ├── noesis.hpp │ │ └── rl │ │ │ ├── __legacy__ │ │ │ ├── RealTimeRunner.hpp │ │ │ ├── RealTimeRunner.tpp │ │ │ └── seqmem.h │ │ │ ├── agent │ │ │ ├── PpoAgent.hpp │ │ │ └── TrpoAgent.hpp │ │ │ ├── algorithm │ │ │ ├── policy_evaluation │ │ │ │ ├── ClippedPolicyEvaluation.hpp │ │ │ │ ├── DampedPolicyEvaluation.hpp │ │ │ │ ├── GeneralizedAdvantageEstimation.hpp │ │ │ │ └── value_estimation.hpp │ │ │ └── policy_optimization │ │ │ │ ├── ProximalPolicyOptimization.hpp │ │ │ │ └── TrustRegionPolicyOptimization.hpp │ │ │ ├── function │ │ │ ├── StateValueFunction.hpp │ │ │ └── StochasticPolicy.hpp │ │ │ ├── math │ │ │ └── optimization.hpp │ │ │ ├── memory │ │ │ ├── SequenceTensorMemory.hpp │ │ │ ├── SequenceVectorMemory.hpp │ │ │ └── TrajectoryMemory.hpp │ │ │ ├── sample │ │ │ ├── AdaptiveTrajectorySampler.hpp │ │ │ └── TrajectorySampler.hpp │ │ │ └── train │ │ │ ├── Runner.hpp │ │ │ └── Tester.hpp │ └── stb │ │ ├── stb_image.h │ │ └── stb_image_write.h ├── package.xml ├── resources │ ├── images │ │ ├── linear_arrow.png │ │ └── rotary_arrow.png │ └── materials │ │ └── grid │ │ ├── grid.material │ │ └── grid.png ├── src │ ├── framework │ │ ├── core │ │ │ └── Graph.cpp │ │ ├── hyperparam │ │ │ ├── HyperParameterManager.cpp │ │ │ ├── HyperParameterTuple.cpp │ │ │ └── hyper_parameters.cpp │ │ ├── log │ │ │ ├── message.cpp │ │ │ ├── tensorboard.cpp │ │ │ └── timer.cpp │ │ ├── noesis.cpp │ │ ├── system │ │ │ ├── process.cpp │ │ │ ├── signal.cpp │ │ │ ├── time.cpp │ │ │ └── version.cpp │ │ └── utils │ │ │ └── png.cpp │ └── gym │ │ ├── mujoco │ │ ├── simulation.cpp │ │ └── visualizer.cpp │ │ └── raisim │ │ └── visualizer.cpp └── test │ ├── CMakeLists.txt │ └── src │ ├── framework │ ├── core │ │ ├── TensorAllocatorTest.cpp │ │ ├── TensorMapTest.cpp │ │ ├── TensorTest.cpp │ │ ├── TensorTupleTest.cpp │ │ ├── TensorsSpecTest.cpp │ │ └── utils │ │ │ └── helpers.hpp │ ├── hyperparam │ │ ├── HyperParameterManagerTest.cpp │ │ ├── HyperParameterTest.cpp │ │ ├── HyperParameterTupleTest.cpp │ │ └── parameters.xml │ ├── log │ │ ├── TensorBoardTest.cpp │ │ └── TimerTest.cpp │ ├── math │ │ ├── RandomNumberGeneratorTest.cpp │ │ ├── StatisticsOperationsTest.cpp │ │ ├── TensorStatisticTest.cpp │ │ └── TensorTupleStatisticTest.cpp │ ├── system │ │ ├── TensorFlowTest.cpp │ │ └── TimeTest.cpp │ └── utils │ │ └── StringUtilsTest.cpp │ └── gym │ ├── mujoco │ ├── CMakeLists.txt │ ├── resources │ │ ├── ant_gym_episode │ │ │ ├── actions.txt │ │ │ ├── rewards.txt │ │ │ ├── state_init.txt │ │ │ ├── states_next.txt │ │ │ └── termination_stats.txt │ │ ├── halfcheetah_gym_episode │ │ │ ├── actions.txt │ │ │ ├── rewards.txt │ │ │ ├── state_init.txt │ │ │ ├── states_next.txt │ │ │ └── termination_stats.txt │ │ ├── hopper_gym_episode │ │ │ ├── actions.txt │ │ │ ├── rewards.txt │ │ │ ├── state_init.txt │ │ │ ├── states_next.txt │ │ │ └── termination_stats.txt │ │ ├── humanoid_gym_episode │ │ │ ├── actions.txt │ │ │ ├── rewards.txt │ │ │ ├── state_init.txt │ │ │ ├── states_next.txt │ │ │ └── termination_stats.txt │ │ └── walker2d_gym_episode │ │ │ ├── actions.txt │ │ │ ├── rewards.txt │ │ │ ├── state_init.txt │ │ │ ├── states_next.txt │ │ │ └── termination_stats.txt │ └── src │ │ ├── AntEnvironmentTest.cpp │ │ ├── HalfcheetahEnvironmentTest.cpp │ │ ├── HopperEnvironmentTest.cpp │ │ ├── HumanoidEnvironmentTest.cpp │ │ ├── MujocoSimulationTest.cpp │ │ ├── MujocoVisualizerTest.cpp │ │ └── Walker2dEnvironmentTest.cpp │ └── raisim │ ├── CMakeLists.txt │ └── src │ ├── CaplerSimulationTest.cpp │ └── Kinova3SimulationTest.cpp ├── noesis_py ├── .pylintrc ├── README.md ├── bin │ └── tfdevices ├── noesis │ ├── __init__.py │ ├── __legacy__ │ │ ├── cnn_full.py │ │ ├── cnn_simple.py │ │ ├── deterministic_model.py │ │ ├── mlp_combine.py │ │ ├── mlp_combine_trained.py │ │ ├── mlp_hlc_cnn.py │ │ ├── models.py │ │ ├── policies.py │ │ ├── regression.py │ │ └── tcn.py │ ├── core │ │ ├── __init__.py │ │ ├── device.py │ │ ├── gradient.py │ │ ├── graph.py │ │ ├── loss.py │ │ ├── message.py │ │ └── tensor.py │ ├── func │ │ ├── __init__.py │ │ ├── policy.py │ │ └── value.py │ ├── nn │ │ ├── __init__.py │ │ ├── deeploco.py │ │ └── mlp.py │ └── rl │ │ ├── __init__.py │ │ ├── cpe.py │ │ ├── dpe.py │ │ ├── ppo.py │ │ └── trpo.py └── setup.py └── utils ├── clang ├── .clang-format ├── README.md └── format.sh ├── install ├── README.md ├── ubuntu1804 │ ├── docker.sh │ ├── mujoco.sh │ ├── noesis.sh │ ├── nvidia.sh │ ├── raisim.sh │ └── singularity.sh └── ubuntu2004 │ ├── docker.sh │ ├── mujoco.sh │ ├── noesis.sh │ ├── nvidia.sh │ ├── raisim.sh │ └── singularity.sh ├── models ├── anymal │ └── anymal_c_simple_description │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── README.md │ │ ├── config │ │ └── rviz │ │ │ └── standalone.rviz │ │ ├── doc │ │ └── anymal_c_rviz.png │ │ ├── launch │ │ ├── load.launch │ │ └── standalone.launch │ │ ├── meshes │ │ ├── base.dae │ │ ├── base.jpg │ │ ├── battery.dae │ │ ├── battery.jpg │ │ ├── bottom_shell.dae │ │ ├── bottom_shell.jpg │ │ ├── depth_camera.dae │ │ ├── depth_camera.jpg │ │ ├── drive.dae │ │ ├── drive.jpg │ │ ├── face.dae │ │ ├── face.jpg │ │ ├── foot.dae │ │ ├── foot.jpg │ │ ├── handle.dae │ │ ├── handle.jpg │ │ ├── hatch.dae │ │ ├── hatch.jpg │ │ ├── hip.jpg │ │ ├── hip_l.dae │ │ ├── hip_r.dae │ │ ├── lidar.dae │ │ ├── lidar.jpg │ │ ├── lidar_cage.dae │ │ ├── lidar_cage.jpg │ │ ├── remote.dae │ │ ├── remote.jpg │ │ ├── shank.jpg │ │ ├── shank_l.dae │ │ ├── shank_r.dae │ │ ├── thigh.dae │ │ ├── thigh.jpg │ │ ├── top_shell.dae │ │ ├── top_shell.jpg │ │ ├── wide_angle_camera.dae │ │ └── wide_angle_camera.jpg │ │ ├── package.xml │ │ └── urdf │ │ └── anymal.urdf ├── capler │ ├── README.md │ ├── meshes │ │ ├── hip.dae │ │ ├── shank.dae │ │ └── thigh.dae │ └── urdf │ │ └── capler.urdf └── kinova3 │ ├── README.md │ ├── meshes │ ├── base_link.STL │ ├── bracelet_link.STL │ ├── forearm_link.STL │ ├── half_arm_1_link.STL │ ├── half_arm_2_link.STL │ ├── shoulder_link.STL │ ├── spherical_wrist_1_link.STL │ └── spherical_wrist_2_link.STL │ └── urdf │ └── kinova3.urdf ├── readthedocs ├── Makefile ├── images │ ├── erc-logo.png │ ├── fnsnf-logo.jpg │ ├── intel-logo.png │ ├── nccr-logo.jpg │ ├── noesis-logo.png │ └── rsl-logo.png ├── requirements.txt └── source │ ├── Doxyfile │ ├── conf.py │ ├── index.rst │ └── pages │ ├── Dependencies.rst │ └── Installation.rst └── workspace ├── CMakeLists.txt ├── ProjectHelper.cmake ├── README.md ├── bin └── .gitkeep ├── data └── .gitkeep ├── lib └── .gitkeep ├── setup.sh └── src └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | **/*.egg-info/ 2 | **/__pycache__/ 3 | **/.pytest_cache/ 4 | **/*.pyc 5 | **/cmake-build*/ 6 | **/.idea/ 7 | # Documentation 8 | docs/build 9 | docs/source/doxyoutput 10 | docs/source/api 11 | -------------------------------------------------------------------------------- /ACKNOWLEDGEMENTS.md: -------------------------------------------------------------------------------- 1 | ## Research Institute 2 | Noesis was developed at the [Robotic Systems Lab](https://rsl.ethz.ch/) of ETH Zurich. 3 | ![logo](utils/readthedocs/images/rsl-logo.png) 4 | ---- 5 | ## Financial Support 6 | This work was supported by Intel Labs, the Swiss National Science Foundation 7 | (SNSF) through project 166232, 188596, the National Centre of Competence 8 | in Research Robotics (NCCR Robotics), and the European Union’s Horizon 9 | 2020 research and innovation program under grant agreements No.780883 and 10 | European Research Council (ERC) No.852044. Additionally, this work has 11 | been conducted as part of ANYmal Research, a community to advance legged 12 | robotics. 13 | ![intel](utils/readthedocs/images/intel-logo.png) 14 | ![fnsnf](utils/readthedocs/images/fnsnf-logo.jpg) 15 | ![nccr](utils/readthedocs/images/nccr-logo.jpg) 16 | ![erc](utils/readthedocs/images/erc-logo.png) 17 | ---- 18 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | ### This is the official list of authors defined for copyrights purposes 2 | 3 | ---- 4 | **Organization:** 5 | Robotic Systems Lab, ETH Zurich 6 | 7 | **Authors:** 8 | Vassilios Tsounis, tsounisv@ethz.ch, vastsoun@gmail.com 9 | Joonho Lee, joonho.lee@mavt.ethz.ch 10 | 11 | **Contributors:** 12 | Jemin Hwangbo, jhwangbo@ethz.ch 13 | David Hoeller, dhoeller@ethz.ch 14 | Mayank Mittal, mittalma@ethz.ch 15 | HaoChih Lin, hlin@student.ethz.ch 16 | Murkus Staeuble, markus.staeuble@mavt.ethz.ch 17 | 18 | ---- 19 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | cmake_minimum_required(VERSION 3.10) 14 | project(noesis_examples VERSION 0.2.0 LANGUAGES CXX) 15 | 16 | # Include GNU standard install directories module 17 | include(GNUInstallDirs) 18 | 19 | #== 20 | # Options 21 | #== 22 | 23 | option(Noesis_USE_MUJOCO "Enables support for the MuJoCo physics engine." OFF) 24 | option(Noesis_USE_RAISIM "Enables support for the RaiSim physics engine." OFF) 25 | 26 | #== 27 | # Dependencies 28 | #== 29 | 30 | # Noesis: C++ library for robotic AI powered by TensorFlow 31 | find_package(noesis CONFIG REQUIRED) 32 | 33 | #== 34 | # Build configuration 35 | #== 36 | 37 | # Helper macro for adding target applications 38 | macro(add_noesis_example_app APP_NAME APP_SRC) 39 | add_executable(${APP_NAME} ${APP_SRC}) 40 | target_link_libraries(${APP_NAME} PUBLIC noesis::noesis) 41 | list(APPEND NOESIS_EXAMPLE_APPS ${APP_NAME}) 42 | endmacro() 43 | 44 | #== 45 | # Components 46 | #== 47 | 48 | # Examples for how to use the core elements of the framework 49 | add_subdirectory(framework) 50 | 51 | # Gym environment examples 52 | add_subdirectory(gym/core) 53 | add_subdirectory(gym/classic) 54 | add_subdirectory(rl/classic) 55 | 56 | # Example RL problems using the MuJoCo physics engine 57 | if(Noesis_USE_MUJOCO) 58 | add_subdirectory(gym/mujoco) 59 | add_subdirectory(rl/mujoco) 60 | endif() 61 | 62 | # Example RL problems using the RaiSim physics engine 63 | if (Noesis_USE_RAISIM) 64 | add_subdirectory(gym/raisim) 65 | add_subdirectory(rl/raisim) 66 | endif() 67 | 68 | # EOF 69 | -------------------------------------------------------------------------------- /examples/framework/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | add_noesis_example_app(noesis_hello_example ${CMAKE_CURRENT_LIST_DIR}/src/hello.cpp) 19 | add_noesis_example_app(noesis_message_example ${CMAKE_CURRENT_LIST_DIR}/src/message.cpp) 20 | add_noesis_example_app(noesis_prng_example ${CMAKE_CURRENT_LIST_DIR}/src/random.cpp) 21 | add_noesis_example_app(noesis_hyperparams_example ${CMAKE_CURRENT_LIST_DIR}/src/hyperparams.cpp) 22 | add_noesis_example_app(noesis_tensorboard_example ${CMAKE_CURRENT_LIST_DIR}/src/tensorboard.cpp) 23 | add_noesis_example_app(noesis_graph_example ${CMAKE_CURRENT_LIST_DIR}/src/graph.cpp) 24 | 25 | #== 26 | # Install 27 | #== 28 | 29 | install( 30 | TARGETS ${NOESIS_EXAMPLE_APPS} 31 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/framework 32 | ) 33 | 34 | # EOF 35 | -------------------------------------------------------------------------------- /examples/framework/src/graph.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Boost 11 | #include 12 | 13 | // Noesis 14 | #include 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | noesis::init("noesis_graph_example"); 20 | 21 | // Define paths to the files 22 | std::string srcFile = noesis::rootpath() + "/examples/framework/python/graph.py"; 23 | std::string buildFile = noesis::logpath() + "/graph/graph.py"; 24 | std::string protoFile = noesis::logpath() + "/graph/protos/graph.pb"; 25 | 26 | // We copy the builder file into the current 27 | // log directory and call it from there 28 | boost::filesystem::create_directories(noesis::logpath() + "/graph"); 29 | boost::filesystem::copy(srcFile, buildFile); 30 | 31 | // Step 1: Create an instance of a C++ graph front-end 32 | auto graph = std::make_unique(); 33 | 34 | // Step 2: We execute the Python script which will build the graph 35 | // and generate the *.pb protobuf file containing the MetaGraphDef 36 | graph->generateFrom(buildFile); 37 | 38 | // Step 3: We load the MetaGraphDef from the generated *.pb file. 39 | graph->loadFrom(protoFile); 40 | 41 | // Step 4: We launch the graph in order to be able to execute operations. 42 | graph->startup(); 43 | 44 | // TODO: Step 5: Execute an example operation 45 | 46 | // Success 47 | return 0; 48 | } 49 | 50 | /* EOF */ 51 | -------------------------------------------------------------------------------- /examples/framework/src/hello.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // C/C++ 11 | #include 12 | 13 | // Noesis 14 | #include 15 | 16 | int main(int argc, char **argv) 17 | { 18 | /* 19 | * Before calling any other noesis function, you should call noesis::init() once. This takes arguments to the name of the process and 20 | * the path of the logging directory. If the path is empty, a directory is created in ~/.noesis/proc to save all the logs. 21 | */ 22 | noesis::init("noesis_hello_example"); 23 | 24 | /* 25 | * Print a basic message to ensure that the noesis package has been installed properly. 26 | */ 27 | NINFO("Hello!"); 28 | 29 | /* 30 | * The noesis::tf::available_devices() function, checks which all CPU/GPU devices are present in the system. 31 | * @note If TensorFlow is built in the CPU mode (i.e. CPU_ONLY flag is enabled in CMake), then no GPU devices would be detected. 32 | */ 33 | NINFO("TensorFlow: Found the following compute devices: " << noesis::utils::vector_to_string(noesis::tf::available_devices())); 34 | 35 | /* 36 | * Print system/platform information in the form of dependency versions. 37 | */ 38 | NINFO("System:" 39 | << "\nCompiler: " << noesis::compiler_version() 40 | << "\nC++: " << noesis::cxx_version() 41 | << "\nEigen: " << noesis::eigen_version() 42 | << "\nTensorFlow: " << noesis::tensorflow_version() 43 | ); 44 | 45 | // Success 46 | return 0; 47 | } 48 | 49 | /* EOF */ 50 | -------------------------------------------------------------------------------- /examples/framework/src/message.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author HaoChih Lin 3 | * @email hlin@ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | 16 | // Noesis 17 | #include 18 | 19 | // function for multi-thread testing (thread 1) 20 | void info_thread() { 21 | for(int i=0; i<=200; i++) { 22 | NINFO("Extra thread 1, no. " + std::to_string(i)); 23 | } 24 | } 25 | 26 | // function for multi-thread testing (thread 2) 27 | void notify_thread() { 28 | for(int i=0; i<=200; i++) { 29 | NNOTIFY("Extra thread 2, no. " + std::to_string(i)); 30 | } 31 | } 32 | 33 | 34 | int main(int argc, char **argv) 35 | { 36 | noesis::init("noesis_message_example"); 37 | 38 | // General Testing 39 | NINFO("This is a info message!"); 40 | NNOTIFY("This is a notification message!"); 41 | NWARNING("This is a warning message!"); 42 | NERROR("This is a error message!"); 43 | 44 | // Manually call write() func 45 | noesis::log::message::logger->write(); 46 | 47 | // Test autosave (buffer size: 20 lines) 48 | for(int i=0; i<30; i++) { 49 | NERROR("Testing: " + std::to_string(i)); 50 | } 51 | 52 | // Multi-thread testing 53 | std::thread thread1(info_thread); 54 | std::thread thread2(notify_thread); 55 | for(int i=0; i<200; i++) { 56 | NERROR("Main thread, no. " + std::to_string(i)); 57 | } 58 | 59 | // Cleanup worker threads 60 | thread1.join(); 61 | thread2.join(); 62 | 63 | // Termination from fatal error 64 | sleep(5); 65 | NFATAL("This is a fatal error message!"); 66 | return 0; 67 | } 68 | 69 | /* EOF */ 70 | -------------------------------------------------------------------------------- /examples/framework/src/random.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | int main(int argc, char **argv) 14 | { 15 | /* 16 | * This is a simple example on the noesis::math::RandomNumberGenerator class. It provides several commonly known probability distribution 17 | * for scalar values. The first argument in the constructor sets the seed of the pseudo-random number generator. 18 | */ 19 | noesis::math::RandomNumberGenerator fprng0(42); 20 | noesis::math::RandomNumberGenerator fprng1(37); 21 | noesis::math::RandomNumberGenerator fprng2(42); 22 | 23 | const int numOfSamples = 10; 24 | std::vector samples0(numOfSamples, 0.0); 25 | std::vector samples1(numOfSamples, 0.0); 26 | std::vector samples2(numOfSamples, 0.0); 27 | 28 | for (int k=0; k 12 | 13 | // Noesis Environments 14 | #include 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | noesis::init("noesis_gym_acrobot_example"); 20 | 21 | // Configurations 22 | float reset_noise_factor = 1.0f; 23 | float randomization_factor = 0.0f; 24 | float action_noise_factor = 0.0f; 25 | float discount_factor = 0.99f; 26 | float time_step = 0.2f; 27 | float time_limit = 100.0f; 28 | bool verbose = true; 29 | 30 | // Create a simple single-instance environment 31 | noesis::gym::AcrobotEnvironment env( 32 | reset_noise_factor, 33 | randomization_factor, 34 | action_noise_factor, 35 | discount_factor, 36 | time_step, 37 | time_limit, 38 | "Acrobot", 39 | "/Example", 40 | verbose 41 | ); 42 | 43 | // Create an external visualizer 44 | auto senv = noesis::gym::make_synchronized_wrapper(&env); 45 | noesis::gym::AcrobotVisualizer vis(senv.get()); 46 | vis.launch(); 47 | 48 | // Execute demo episode for 10 seconds 49 | senv->seed(0); 50 | senv->reset(); 51 | for (size_t t = 0; t < 10 * static_cast(1.0/time_step); ++t) { 52 | senv->actions().setRandom(); 53 | senv->step(); 54 | } 55 | 56 | // Print info and internal state of the instance 57 | NINFO(env); 58 | 59 | // Success 60 | return 0; 61 | } 62 | 63 | /* EOF */ 64 | -------------------------------------------------------------------------------- /examples/gym/classic/src/cartpole.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | // Noesis Environments 14 | #include 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | noesis::init("noesis_gym_cartpole_example"); 20 | 21 | // Configurations 22 | float reset_noise_factor = 1.0f; 23 | float randomization_factor = 0.0f; 24 | float discount_factor = 0.99f; 25 | float time_step = 0.02f; 26 | float time_limit = 4.0f; 27 | bool verbose = true; 28 | 29 | // Create a simple single-instance environment 30 | noesis::gym::CartpoleEnvironment env( 31 | reset_noise_factor, 32 | randomization_factor, 33 | discount_factor, 34 | time_step, 35 | time_limit, 36 | "Cartpole", 37 | "/Example", 38 | verbose 39 | ); 40 | 41 | // Create an external visualizer 42 | auto senv = noesis::gym::make_synchronized_wrapper(&env); 43 | noesis::gym::CartpoleVisualizer vis(senv.get()); 44 | vis.launch(); 45 | 46 | // Execute demo episode for 10 seconds 47 | senv->seed(0); 48 | senv->reset(); 49 | for (size_t t = 0; t < 10 * static_cast(1.0/time_step); ++t) { 50 | senv->actions().setRandom(); 51 | senv->step(); 52 | } 53 | 54 | // Print info and internal state of the instance 55 | NINFO(env); 56 | 57 | // Success 58 | return 0; 59 | } 60 | 61 | /* EOF */ 62 | -------------------------------------------------------------------------------- /examples/gym/classic/src/pendulum.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | // Noesis Environments 14 | #include 15 | #include 16 | 17 | int main(int argc, char** argv) 18 | { 19 | noesis::init("noesis_gym_pendulum_example"); 20 | 21 | // Configurations 22 | float reset_noise_factor = 1.0f; 23 | float randomization_factor = 0.0f; 24 | float discount_factor = 0.99f; 25 | float time_step = 0.05f; 26 | float time_limit = 10.0f; 27 | bool verbose = true; 28 | 29 | // Create a simple single-instance environment 30 | noesis::gym::PendulumEnvironment env( 31 | reset_noise_factor, 32 | randomization_factor, 33 | discount_factor, 34 | time_step, 35 | time_limit, 36 | "Pendulum", 37 | "/Example", 38 | verbose 39 | ); 40 | 41 | // Create an external visualizer 42 | auto senv = noesis::gym::make_synchronized_wrapper(&env); 43 | noesis::gym::PendulumVisualizer vis(senv.get()); 44 | vis.launch(); 45 | 46 | // Execute demo episode for 10 seconds 47 | senv->seed(0); 48 | senv->reset(); 49 | for (size_t t = 0; t < 10 * static_cast(1.0/time_step); ++t) { 50 | senv->actions().setRandom(); 51 | senv->step(); 52 | } 53 | 54 | // Print info and internal state of the instance 55 | NINFO(env); 56 | 57 | // Success 58 | return 0; 59 | } 60 | 61 | /* EOF */ 62 | -------------------------------------------------------------------------------- /examples/gym/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | add_noesis_example_app(noesis_gym_simple_example ${CMAKE_CURRENT_LIST_DIR}/src/simple.cpp) 19 | add_noesis_example_app(noesis_gym_vectorized_example ${CMAKE_CURRENT_LIST_DIR}/src/vectorized.cpp) 20 | add_noesis_example_app(noesis_gym_synchronized_example ${CMAKE_CURRENT_LIST_DIR}/src/synchronized.cpp) 21 | 22 | #== 23 | # Install 24 | #== 25 | 26 | install( 27 | TARGETS ${NOESIS_EXAMPLE_APPS} 28 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/gym 29 | ) 30 | # EOF 31 | -------------------------------------------------------------------------------- /examples/gym/core/src/simple.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | // Example 14 | #include "Environment.hpp" 15 | 16 | int main(int argc, char** argv) 17 | { 18 | noesis::init("noesis_gym_simple_example"); 19 | 20 | // Create an simple environment 21 | example::Environment env; 22 | 23 | // Print info 24 | NNOTIFY(env); 25 | 26 | // Test env operations 27 | env.reset(); 28 | for (int t = 0; t < 10; ++t) { 29 | if (env.terminations().back().type != example::Environment::Termination::Type::Unterminated) { break; } 30 | env.actions()[0].setConstant(t+1); 31 | env.step(); 32 | } 33 | NINFO("env:" << env << env.actions() << env.observations() << env.rewards()); 34 | 35 | // Success 36 | return 0; 37 | } 38 | 39 | /* EOF */ 40 | -------------------------------------------------------------------------------- /examples/gym/core/src/synchronized.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | #include 13 | 14 | // Example 15 | #include "Environment.hpp" 16 | 17 | int main(int argc, char** argv) 18 | { 19 | using Termination = example::Environment::Termination; 20 | 21 | noesis::init("noesis_gym_synchronized_example"); 22 | 23 | // Create an simple environment 24 | example::Environment env; 25 | 26 | // Create a synchronization wrapper 27 | auto senv = noesis::gym::make_synchronized_wrapper(&env); 28 | 29 | // Print info 30 | NNOTIFY(*senv); 31 | 32 | // Test venv operations 33 | senv->reset(); 34 | for (int t = 0; t < 10; ++t) { 35 | if (senv->terminations().back().type != Termination::Type::Unterminated) { break; } 36 | senv->actions()[0].setConstant(t + 1); 37 | senv->step(); 38 | } 39 | NINFO("senv:" << *senv << senv->actions() << senv->observations() << senv->rewards()); 40 | 41 | // Success 42 | return 0; 43 | } 44 | 45 | /* EOF */ 46 | -------------------------------------------------------------------------------- /examples/gym/core/src/vectorized.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | #include 13 | 14 | // Example 15 | #include "Environment.hpp" 16 | 17 | int main(int argc, char** argv) 18 | { 19 | using Termination = example::Environment::Termination; 20 | 21 | noesis::init("noesis_gym_vectorized_example"); 22 | 23 | // Configurations 24 | size_t batch_size = 3; 25 | 26 | // Create a vectorized environment 27 | auto venv = noesis::gym::make_vectorized(batch_size, "baz", 0.333, 666, true); 28 | 29 | // Print info 30 | NNOTIFY(*venv); 31 | 32 | // Test venv operations 33 | venv->reset(); 34 | for (int t = 0; t < 10; ++t) { 35 | if (venv->terminations().back().type != Termination::Type::Unterminated) { break; } 36 | venv->actions()[0].setConstant(t + 1); 37 | venv->step(); 38 | } 39 | NINFO("venv:" << *venv << venv->actions() << venv->observations() << venv->rewards()); 40 | 41 | // Success 42 | return 0; 43 | } 44 | 45 | /* EOF */ 46 | -------------------------------------------------------------------------------- /examples/gym/mujoco/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | add_noesis_example_app(noesis_gym_hopper_example ${CMAKE_CURRENT_LIST_DIR}/src/hopper.cpp) 19 | #add_noesis_example_app(noesis_gym_halfcheetah_example ${CMAKE_CURRENT_LIST_DIR}/src/halfcheetah.cpp) 20 | #add_noesis_example_app(noesis_gym_walker2d_example ${CMAKE_CURRENT_LIST_DIR}/src/walker2d.cpp) 21 | #add_noesis_example_app(noesis_gym_ant_example ${CMAKE_CURRENT_LIST_DIR}/src/ant.cpp) 22 | #add_noesis_example_app(noesis_gym_humanoid_example ${CMAKE_CURRENT_LIST_DIR}/src/humanoid.cpp) 23 | 24 | #== 25 | # Install 26 | #== 27 | 28 | install( 29 | TARGETS ${NOESIS_EXAMPLE_APPS} 30 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/gym 31 | ) 32 | 33 | # EOF 34 | -------------------------------------------------------------------------------- /examples/gym/mujoco/src/hopper.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | // Noesis Environments 14 | #include 15 | 16 | int main(int argc, char** argv) 17 | { 18 | noesis::init("noesis_gym_hopper_example"); 19 | // Enable mujoco 20 | mujoco::init(); 21 | 22 | // Configurations 23 | int control_decimation = 4; 24 | double discount_factor = 0.995; 25 | double reset_noise_factor = 5e-3; 26 | bool enable_logging = false; 27 | bool visualize = true; 28 | std::string name = "HopperEnvironment"; 29 | std::string scope = "/Example"; 30 | bool verbose = false; 31 | 32 | noesis::gym::HopperEnvironment env( 33 | control_decimation, 34 | discount_factor, 35 | reset_noise_factor, 36 | enable_logging, visualize, 37 | name, scope, verbose); 38 | 39 | // Execute demo episode 40 | env.seed(0); 41 | env.reset(); 42 | for (size_t t = 0; t < 10*100; ++t) { 43 | env.actions().setRandom(); 44 | env.step(); 45 | } 46 | 47 | // Print info and internal state of the instance 48 | NINFO(env); 49 | 50 | // Disable mujoco 51 | mujoco::exit(); 52 | // Success 53 | return 0; 54 | } 55 | 56 | /* EOF */ 57 | -------------------------------------------------------------------------------- /examples/gym/raisim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | add_noesis_example_app(noesis_gym_capler_example ${CMAKE_CURRENT_LIST_DIR}/src/capler.cpp) 19 | add_noesis_example_app(noesis_gym_kinova3_example ${CMAKE_CURRENT_LIST_DIR}/src/kinova3.cpp) 20 | #add_noesis_example_app(noesis_gym_ballbot_example ${CMAKE_CURRENT_LIST_DIR}/src/ballbot.cpp) 21 | #add_noesis_example_app(noesis_gym_anymal_example ${CMAKE_CURRENT_LIST_DIR}/src/anymal.cpp) 22 | 23 | #== 24 | # Install 25 | #== 26 | 27 | install( 28 | TARGETS ${NOESIS_EXAMPLE_APPS} 29 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/gym 30 | ) 31 | 32 | # EOF 33 | -------------------------------------------------------------------------------- /examples/gym/raisim/src/capler.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int argc, char** argv) 16 | { 17 | noesis::init("noesis_gym_capler_example"); 18 | 19 | // Configurations 20 | double time_step = 0.01; 21 | double time_limit = 5.0; 22 | double discount_factor = 0.995; 23 | double randomization_factor = 1.0; 24 | double reset_noise_factor = 0.0; 25 | double state_noise_factor = 0.0; 26 | double goal_noise_factor = 0.0; 27 | bool use_pid_controller = true; 28 | bool enable_logging = false; 29 | bool visualize = false; 30 | bool verbose = true; 31 | 32 | // Create a simple single-instance environment 33 | noesis::gym::CaplerEnvironment env( 34 | time_step, 35 | time_limit, 36 | discount_factor, 37 | randomization_factor, 38 | reset_noise_factor, 39 | state_noise_factor, 40 | goal_noise_factor, 41 | use_pid_controller, 42 | enable_logging, 43 | visualize, // NOTE: we will use an externally managed visualizer 44 | "Capler", 45 | "/Example", 46 | verbose 47 | ); 48 | 49 | // Create an external visualizer 50 | noesis::gym::CaplerVisualizer vis(env.simulation()); 51 | vis.launch(); 52 | 53 | // Execute demo episode 54 | env.seed(0); 55 | env.reset(); 56 | for (size_t t = 0; t < 10*100; ++t) { 57 | env.actions().setRandom(); 58 | env.step(); 59 | } 60 | 61 | // Print info and internal state of the instance 62 | NINFO(env); 63 | 64 | // Success 65 | return 0; 66 | } 67 | 68 | /* EOF */ 69 | -------------------------------------------------------------------------------- /examples/gym/raisim/src/kinova3.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int argc, char** argv) 16 | { 17 | using namespace noesis::gym; 18 | 19 | noesis::init("noesis_gym_kinova3_example"); 20 | 21 | // Create a simple single-instance environment 22 | const Kinova3Simulation::World worldType = Kinova3Simulation::World::Empty; 23 | const bool usePidController = true; 24 | Kinova3Simulation sim(worldType, usePidController); 25 | 26 | // Print system description information to console. 27 | NINFO("Simulation:\n" << sim.info()); 28 | 29 | // Create an external visualizer 30 | Kinova3VisConfig config; 31 | config.show_goal_pose = true; 32 | config.show_goal_force = true; 33 | Kinova3Visualizer vis(config, sim); 34 | vis.launch(); 35 | vis.pause(); 36 | 37 | // Initialize 38 | const RotationMatrix R_G = math::rotation_z(M_PI_2) * math::rotation_x(M_PI_2); 39 | const Position r_G(0.5, 0.0, 0.5); 40 | auto q0 = sim.getNominalJointConfiguration(); 41 | auto u0 = sim.getGeneralizedVelocities(); 42 | auto tau = sim.getJointTorques(); 43 | sim.reset(q0, u0.setZero()); 44 | vis.update(R_G, r_G); 45 | 46 | // Execute demo episode 47 | for (size_t t = 0; t < 10 * static_cast(1.0/sim.getTimeStep()); ++t) { 48 | sim.step((usePidController) ? q0 : tau.setZero()); 49 | vis.update(R_G, r_G); 50 | } 51 | 52 | NINFO("[kinova3]: R_ee:\n" << sim.getOrientationWorldToEndEffector()) 53 | NINFO("[kinova3]: r_ee:\n" << sim.getPositionWorldToEndEffectorInWorldFrame()) 54 | 55 | // Success 56 | return 0; 57 | } 58 | 59 | /* EOF */ 60 | -------------------------------------------------------------------------------- /examples/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | noesis_examples 5 | 0.2.0 6 | Examples for using Noesis. 7 | Apache 2.0 8 | https://github.com/leggedrobotics/noesis 9 | Vassilios Tsounis 10 | Vassilios Tsounis 11 | 12 | cmake 13 | catkin 14 | noesis 15 | 16 | 17 | cmake 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/rl/classic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | add_noesis_example_app(noesis_rl_pendulum_example ${CMAKE_CURRENT_LIST_DIR}/src/pendulum/pendulum.cpp) 19 | add_noesis_example_app(noesis_rl_cartpole_example ${CMAKE_CURRENT_LIST_DIR}/src/cartpole/cartpole.cpp) 20 | add_noesis_example_app(noesis_rl_acrobot_example ${CMAKE_CURRENT_LIST_DIR}/src/acrobot/acrobot.cpp) 21 | 22 | #== 23 | # Install 24 | #== 25 | 26 | install( 27 | TARGETS ${NOESIS_EXAMPLE_APPS} 28 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/rl 29 | ) 30 | 31 | # EOF 32 | -------------------------------------------------------------------------------- /examples/rl/classic/src/acrobot/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/rl/classic/src/cartpole/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/rl/classic/src/pendulum/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/rl/mujoco/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | #add_noesis_example_app(train_mujoco_rl_agent ${CMAKE_CURRENT_LIST_DIR}/src/train_mujoco.cpp) 19 | #add_noesis_example_app(test_mujoco_rl_agent ${CMAKE_CURRENT_LIST_DIR}/src/test_mujoco.cpp) 20 | 21 | #== 22 | # Install 23 | #== 24 | 25 | install( 26 | TARGETS ${NOESIS_EXAMPLE_APPS} 27 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/rl 28 | ) 29 | 30 | # EOF 31 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/agent/model.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/environment/ant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/environment/halfcheetah.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/environment/hopper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/environment/humanoid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/environment/walker2d.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/rl/mujoco/resources/hyperparams/train.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/rl/mujoco/src/agents.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | /* EOF */ 15 | -------------------------------------------------------------------------------- /examples/rl/mujoco/src/environments.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | /* EOF */ 29 | -------------------------------------------------------------------------------- /examples/rl/raisim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 12 | #============================================================================= 13 | 14 | #== 15 | # Build targets 16 | #== 17 | 18 | # Capler agent trained w/ PPO 19 | add_noesis_example_app(noesis_rl_train_capler_ppo_example ${CMAKE_CURRENT_LIST_DIR}/src/capler/ppo/train.cpp) 20 | add_noesis_example_app(noesis_rl_test_capler_ppo_example ${CMAKE_CURRENT_LIST_DIR}/src/capler/ppo/test.cpp) 21 | 22 | # Capler agent trained w/ TRPO 23 | add_noesis_example_app(noesis_rl_train_capler_trpo_example ${CMAKE_CURRENT_LIST_DIR}/src/capler/trpo/train.cpp) 24 | add_noesis_example_app(noesis_rl_test_capler_trpo_example ${CMAKE_CURRENT_LIST_DIR}/src/capler/trpo/test.cpp) 25 | 26 | # Kinova3 agent trained w/ PPO 27 | add_noesis_example_app(noesis_rl_sample_kinova3_example ${CMAKE_CURRENT_LIST_DIR}/src/kinova3/sample.cpp) 28 | add_noesis_example_app(noesis_rl_train_kinova3_example ${CMAKE_CURRENT_LIST_DIR}/src/kinova3/train.cpp) 29 | add_noesis_example_app(noesis_rl_test_kinova3_example ${CMAKE_CURRENT_LIST_DIR}/src/kinova3/test.cpp) 30 | add_noesis_example_app(noesis_rl_perf_kinova3_example ${CMAKE_CURRENT_LIST_DIR}/src/kinova3/perf.cpp) 31 | 32 | #== 33 | # Install 34 | #== 35 | 36 | install( 37 | TARGETS ${NOESIS_EXAMPLE_APPS} 38 | RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/rl 39 | ) 40 | 41 | # EOF 42 | -------------------------------------------------------------------------------- /examples/rl/raisim/src/capler/ppo/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /examples/rl/raisim/src/capler/ppo/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================= 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 14 | #============================================================================= 15 | 16 | # Set paths 17 | #BUILD_DIR=${WORKSPACE_DIR}/cmake-build-release 18 | BUILD_DIR=~/Development/deepgait/deepgait_cpp/cmake-build-release 19 | APP_DIR=${BUILD_DIR}/src/noesis/examples/rl/raisim 20 | APP_NAME=noesis_rl_train_capler_ppo_example 21 | 22 | # Build experiment 23 | cd ${BUILD_DIR} 24 | make ${APP_NAME} -j 25 | 26 | # Run experiment 27 | #for GRAPH in "baseline" "shared-layer" "shared-net" "state-dep-stddev" "state-dep-stddev-shared-layer" "state-dep-stddev-shared-net" 28 | for GRAPH in "baseline" 29 | do 30 | # Create data directories 31 | DATA_DIR=~/.noesis/proc/${APP_NAME}/${GRAPH} 32 | DATA_DIR=$(eval realpath -m "${DATA_DIR}") 33 | mkdir -p ${DATA_DIR} 34 | # Run a set of experiments over random seeds 35 | for SEED in 1 36 | do 37 | ${APP_DIR}/${APP_NAME} \ 38 | --log_path=${DATA_DIR} \ 39 | --batch_size=16 \ 40 | --iterations=300 \ 41 | --goal_noise_factor=0.0 \ 42 | --reset_noise_factor=1.0 \ 43 | --state_noise_factor=1.0 \ 44 | --randomization_factor=1.0 \ 45 | --graph_file="graph-${GRAPH}.py" \ 46 | --seed=${SEED} 47 | done 48 | done 49 | 50 | ## Run experiment 51 | #for TERMINAL_VALUE in 0.0 -1.0 -2.0 -3.0 -5.0 1.0 52 | #do 53 | # # Create data directories 54 | # DATA_DIR=~/.noesis/proc/${APP_NAME}/"tv_${TERMINAL_VALUE}" 55 | # DATA_DIR=$(eval realpath -m "${DATA_DIR}") 56 | # mkdir -p ${DATA_DIR} 57 | # # Run a set of experiments over random seeds 58 | # for SEED in 1 2 3 59 | # do 60 | # ${APP_DIR}/${APP_NAME} \ 61 | # --log_path=${DATA_DIR} \ 62 | # --batch_size=16 \ 63 | # --iterations=300 \ 64 | # --goal_noise_factor=0.0 \ 65 | # --reset_noise_factor=1.0 \ 66 | # --state_noise_factor=1.0 \ 67 | # --randomization_factor=1.0 \ 68 | # --terminal_value="${TERMINAL_VALUE}" \ 69 | # --seed=${SEED} 70 | # done 71 | #done 72 | 73 | 74 | -------------------------------------------------------------------------------- /examples/rl/raisim/src/capler/trpo/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /examples/rl/raisim/src/kinova3/ppo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /examples/rl/raisim/src/kinova3/train.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #============================================================================= 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 14 | #============================================================================= 15 | 16 | # Set paths 17 | BUILD_DIR=~/cmake_ws/cmake-build-release 18 | APP_DIR=${BUILD_DIR}/src/noesis/examples/rl/raisim 19 | APP_NAME=noesis_rl_train_kinova3_example 20 | 21 | # Build experiment 22 | cd ${BUILD_DIR} 23 | make ${APP_NAME} -j 24 | 25 | # Create data directories 26 | DATA_DIR=~/.noesis/proc/${APP_NAME} 27 | DATA_DIR=$(eval realpath -m "${DATA_DIR}") 28 | mkdir -p ${DATA_DIR} 29 | 30 | # Run a set of experiments over random seeds 31 | for SEED in 0 32 | do 33 | ${APP_DIR}/${APP_NAME} \ 34 | --log_path=${DATA_DIR} \ 35 | --batch_size=64 \ 36 | --iterations=5000 \ 37 | --time_step=0.01 \ 38 | --time_limit=2.0 \ 39 | --discount_factor=0.995 \ 40 | --goal_noise_factor=1.0 \ 41 | --reset_noise_factor=1.0 \ 42 | --randomization_factor=1.0 \ 43 | --observations_noise_factor=1.0 \ 44 | --use_pid_controller=true \ 45 | --use_simulator_pid=false \ 46 | --seed=${SEED} 47 | done 48 | 49 | 50 | -------------------------------------------------------------------------------- /noesis/bin/python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Wrapper script to setup a target virtualenv and run a python script. 5 | # 6 | 7 | # Define usage 8 | function usage 9 | { 10 | echo -e "\e[1mUsage:\e[21m" 11 | echo -e " python.sh [-h] --script PYSCRIPT" 12 | echo -e " [--venv VIRTUALENV]" 13 | echo -e "" 14 | echo -e "\e[1mDescription:\e[21m" 15 | echo -e " TODO." 16 | echo -e "" 17 | echo -e "\e[1mArguments:\e[21m" 18 | echo -e " -h, --help show this help message and exit" 19 | echo -e " --script PYSCRIPT" 20 | echo -e " Python script to be executed." 21 | echo -e " --venv VIRTUALENV" 22 | echo -e " Run in a specific virtualenv environment." 23 | echo -e "" 24 | echo -e "\e[1mExample:\e[21m" 25 | echo -e "./python.sh \ " 26 | echo -e "--script graph.py \ " 27 | echo -e "--venv noesis" 28 | } 29 | 30 | # Parse arguments 31 | while [[ $# -gt 0 ]] 32 | do 33 | key="$1" 34 | case "$key" in 35 | --help) 36 | usage 37 | exit 38 | ;; 39 | --script) 40 | PYSCRIPT="$2" 41 | shift # past argument 42 | shift # past value 43 | ;; 44 | --venv) 45 | VIRTUALENV=$2 46 | shift # past argument 47 | shift # past value 48 | ;; 49 | *) # unknown option 50 | echo -e "\e[1m\e[31mERROR\e[97m:\e[0m Invalid argument.\e[33m" 51 | usage 52 | exit 53 | ;; 54 | esac 55 | done 56 | 57 | # Argument checks 58 | if ! [[ -v PYSCRIPT ]]; 59 | then 60 | echo -e "\e[1m\e[31mERROR\e[97m:\e[0m Missing argument: --script not specified.\e[33m" 61 | usage 62 | exit 63 | fi 64 | 65 | # Argument checks 66 | if ! [[ -v VIRTUALENV ]]; 67 | then 68 | echo -e "Using default virtualenv: 'noesis'" 69 | VIRTUALENV=noesis 70 | else 71 | echo -e "Using virtualenv: ${VIRTUALENV}" 72 | fi 73 | 74 | # Activate the Virtualenv python3.5 environment 75 | source $WORKON_HOME/${VIRTUALENV}/bin/activate 76 | 77 | # Run the generation script using the collected arguments 78 | python ${PYSCRIPT} 79 | 80 | # EOF 81 | -------------------------------------------------------------------------------- /noesis/cmake/GTestMacros.cmake: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # 6 | # This software is distributed WITHOUT ANY WARRANTY; without even the 7 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | # See the License for more information. 9 | #============================================================================= 10 | # Authors: Vassilios Tsounis, tsounisv@ethz.ch 11 | #============================================================================= 12 | 13 | # Helper macro function for finding and adding GTest to a project's build tree. 14 | macro(find_gtest) 15 | # Enables CMake unit-test integration for GTest. 16 | enable_testing() 17 | set(GOOGLETEST_VERSION 1.10.0) 18 | include(GoogleTest) 19 | # Set root directory for GTest 20 | set(GOOGLETEST_ROOT "/usr/src/gtest") 21 | # Check if Google's Testing framework exists in the current system. 22 | if (NOT EXISTS "${GOOGLETEST_ROOT}") 23 | message(FATAL_ERROR 24 | "'${GOOGLETEST_ROOT}' directory not found!\n" 25 | "Please install the Google Testing framework using APT:\n" 26 | "sudo apt install libgtest-dev googletest" 27 | ) 28 | else() 29 | message(STATUS "Adding GoogleTest from: ${GOOGLETEST_ROOT}") 30 | endif() 31 | # Add the GTest CMake package to the current build tree if `gtest` is not already defined. 32 | if(NOT TARGET gtest) 33 | # GTest: Google Testing Framework 34 | add_subdirectory("${GOOGLETEST_ROOT}" ${CMAKE_BINARY_DIR}/googletest) 35 | set(GTEST_FROM_SOURCE_FOUND "True" CACHE INTERNAL "") 36 | set(GTEST_INCLUDE_DIRS "${gtest_SOURCE_DIR}/include" CACHE INTERNAL "") 37 | set(GTEST_LIBRARIES gtest gtest_main CACHE INTERNAL "") 38 | message(STATUS "Found GoogleTest") 39 | message(STATUS "GoogleTest:") 40 | message(STATUS " Includes: ${GTEST_INCLUDE_DIRS}") 41 | message(STATUS " Libraries: ${GTEST_LIBRARIES}") 42 | endif() 43 | endmacro() 44 | 45 | # Helper macro function for adding tests to the CMake build. 46 | macro(add_gtest TEST_NAME FILES LIBRARIES) 47 | add_executable(${TEST_NAME} ${FILES}) 48 | target_link_libraries(${TEST_NAME} PUBLIC gtest gtest_main ${LIBRARIES}) 49 | gtest_discover_tests(${TEST_NAME}) 50 | endmacro() 51 | 52 | # EOF 53 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/core/TensorsSpec.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_CORE_TENSORS_SPEC_HPP_ 10 | #define NOESIS_FRAMEWORK_CORE_TENSORS_SPEC_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | 16 | // Noesis 17 | #include "noesis/framework/utils/string.hpp" 18 | 19 | namespace noesis { 20 | 21 | /*! 22 | * @brief The input/output specification provides name-to-dimensions mappings for parameterized functions. 23 | */ 24 | using TensorsSpec = std::vector>>; 25 | 26 | static inline std::vector names_from_spec(const TensorsSpec& spec) { 27 | std::vector names; 28 | for (auto& elem: spec) { 29 | names.push_back(elem.first); 30 | } 31 | return names; 32 | } 33 | 34 | static inline std::vector> dimensions_from_spec(const TensorsSpec& spec) { 35 | std::vector> dims; 36 | for (auto& elem: spec) { 37 | dims.push_back(elem.second); 38 | } 39 | return dims; 40 | } 41 | 42 | static inline std::vector batched_dimensions_from_spec(const std::pair>& spec) { 43 | auto newDims = spec.second; 44 | newDims.insert(newDims.end(), {1, 1}); 45 | return newDims; 46 | } 47 | 48 | } // namespace noesis 49 | 50 | /*! 51 | * @brief Custom stream operator for TensorsSpec objects. 52 | * @param os The target output stream to direct output. 53 | * @param spec the input-output specification to be written. 54 | * @return The augmented output stream. 55 | */ 56 | inline std::ostream &operator<<(std::ostream &os, const noesis::TensorsSpec &spec) { 57 | std::string out = "{"; 58 | for (auto& field: spec) { 59 | out += " '" + field.first + "': " + noesis::utils::vector_to_string(field.second, "[]") + ","; 60 | } 61 | if (!spec.empty()) { 62 | out.pop_back(); 63 | out += " "; 64 | } 65 | out += "}"; 66 | return os << out; 67 | } 68 | 69 | #endif // NOESIS_FRAMEWORK_CORE_TENSORS_SPEC_HPP_ 70 | 71 | /* EOF */ 72 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/hyperparam/hyper_parameters.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author David Hoeller 5 | * @email dhoeller@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | #ifndef NOESIS_FRAMEWORK_HYPERPARAM_HYPER_PARAMETERS_HPP_ 12 | #define NOESIS_FRAMEWORK_HYPERPARAM_HYPER_PARAMETERS_HPP_ 13 | 14 | // Noesis 15 | #include "noesis/framework/hyperparam/HyperParameter.hpp" 16 | #include "noesis/framework/hyperparam/HyperParameterManager.hpp" 17 | 18 | namespace noesis { 19 | namespace hyperparam { 20 | 21 | /*! 22 | * @brief Declaration of the global hyper-parameter manager instance. 23 | */ 24 | extern std::shared_ptr manager; 25 | 26 | } // namespace hyperparam 27 | } // namespace noesis 28 | 29 | #endif // NOESIS_FRAMEWORK_HYPERPARAM_HYPER_PARAMETERS_HPP_ 30 | 31 | /* EOF */ 32 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/system/filesystem.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_SYSTEM_FILESYSTEM_HPP_ 10 | #define NOESIS_FRAMEWORK_SYSTEM_FILESYSTEM_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | 15 | // Boost 16 | #include 17 | #include 18 | 19 | namespace noesis { 20 | namespace filesystem { 21 | 22 | static inline void set_symlink(const std::string& path, const std::string& link) { 23 | ::boost::filesystem::remove(link); 24 | ::boost::filesystem::create_symlink(path, link); 25 | } 26 | 27 | static inline std::pair expand_relative_path(std::string path) { 28 | bool result = false; 29 | if (!path.empty()) { 30 | if (path[0] == '~') { 31 | path.replace(0, 1, getenv("HOME")); 32 | result = true; 33 | } else if (path[0] == '.') { 34 | path.replace(0, 1, getenv("PWD")); 35 | result = true; 36 | } 37 | } 38 | return {result, path}; 39 | } 40 | 41 | static inline std::pair filename_from_path(std::string path) { 42 | bool result = false; 43 | std::string filename; 44 | if (!path.empty()) { 45 | boost::filesystem::path filePath(path); 46 | filePath = boost::filesystem::change_extension(filePath, "").filename(); 47 | filename = filePath.string(); 48 | result = true; 49 | } 50 | return {result, filename}; 51 | } 52 | 53 | static inline void copy_directory(const boost::filesystem::path& source, const boost::filesystem::path& destination) { 54 | if (!boost::filesystem::exists(source) || !boost::filesystem::is_directory(source)) { 55 | throw std::runtime_error("noesis::filesystem::copy: path '" + source.string() + "' does not exist or is not a directory!"); 56 | } 57 | if (boost::filesystem::exists(destination)) { 58 | throw std::runtime_error("noesis::filesystem::copy: destination path '" + destination.string() + "' already exists!"); 59 | } 60 | if (!boost::filesystem::create_directories(destination)) { 61 | throw std::runtime_error("noesis::filesystem::copy: cannot create destination path '" + destination.string() + "'!"); 62 | } 63 | for (const auto& dirEnt : boost::filesystem::recursive_directory_iterator{source}) { 64 | const auto& path = dirEnt.path(); 65 | auto relativePathStr = path.string(); 66 | boost::replace_first(relativePathStr, source.string(), ""); 67 | boost::filesystem::copy(path, destination / relativePathStr); 68 | } 69 | } 70 | 71 | } // filesystem 72 | } // noesis 73 | 74 | #endif // NOESIS_FRAMEWORK_SYSTEM_FILESYSTEM_HPP_ 75 | 76 | /* EOF */ 77 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/system/version.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_SYSTEM_VERSION_HPP_ 10 | #define NOESIS_FRAMEWORK_SYSTEM_VERSION_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | 15 | namespace noesis { 16 | 17 | std::string cxx_version(); 18 | 19 | std::string compiler_version(); 20 | 21 | std::string eigen_version(); 22 | 23 | std::string tensorflow_version(); 24 | 25 | } // noesis 26 | 27 | #endif // NOESIS_FRAMEWORK_SYSTEM_VERSION_HPP_ 28 | 29 | /* EOF */ 30 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/utils/csv.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_UTILS_CSV_HPP_ 10 | #define NOESIS_FRAMEWORK_UTILS_CSV_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | // Boost 19 | #include 20 | 21 | namespace noesis { 22 | namespace utils { 23 | 24 | template 25 | class CsvReader 26 | { 27 | public: 28 | 29 | using ScalarType = ScalarType_; 30 | using ChannelType = std::pair>; 31 | using DataSetType = std::vector; 32 | 33 | explicit CsvReader(std::string filename, std::string delimiter=",") : 34 | fileName_(std::move(filename)), 35 | delimiter_(std::move(delimiter)) 36 | { 37 | } 38 | 39 | ~CsvReader() = default; 40 | 41 | bool parse(DataSetType& data) { 42 | // Ensure that data is empty before proceeding 43 | if (!data.empty()) { 44 | std::cout << "Error: argument must be an empty data set!"; 45 | } 46 | // Parse and load the data into process memory 47 | std::ifstream file(fileName_); 48 | std::string line; 49 | while (getline(file, line)) { 50 | // Allocate new buffers 51 | std::vector charBuffer; 52 | std::vector valueBuffer; 53 | // Split using the delimiter 54 | boost::algorithm::split(charBuffer, line, boost::is_any_of(delimiter_)); 55 | // Store into contiguous memory 56 | valueBuffer.resize(charBuffer.size()-1); 57 | for (size_t k = 1; k < charBuffer.size(); ++k) { 58 | if (!charBuffer[k].empty()) { 59 | valueBuffer[k-1] = static_cast(std::stod(charBuffer[k])); 60 | } 61 | } 62 | // Create a new data channel element 63 | data.push_back(std::make_pair(charBuffer[0], valueBuffer)); 64 | } 65 | // Close the File 66 | file.close(); 67 | // Success 68 | return true; 69 | } 70 | 71 | int find(const DataSetType& data, const std::string& channel_name) { 72 | int index = -1; 73 | for (int k = 0; k < data.size(); ++k) { 74 | if (data[k].first == channel_name) { 75 | index = k; 76 | } 77 | } 78 | return index; 79 | } 80 | 81 | private: 82 | std::string fileName_; 83 | std::string delimiter_; 84 | }; 85 | 86 | } // utils 87 | } //noesis 88 | 89 | #endif // NOESIS_FRAMEWORK_UTILS_CSV_HPP_ 90 | 91 | /* EOF */ 92 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/utils/dataset.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_UTILS_DATASET_HPP_ 10 | #define NOESIS_FRAMEWORK_UTILS_DATASET_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | 15 | // Noesis 16 | #include "noesis/framework/core/TensorTuple.hpp" 17 | #include "noesis/framework/utils/filestream.hpp" 18 | 19 | namespace noesis { 20 | namespace utils { 21 | 22 | template 23 | bool load_data_from_path(const std::string& path, TensorTuple& output) { 24 | // Check if the path exists 25 | if (!boost::filesystem::exists(path)) { 26 | return false; 27 | } 28 | // Check if the output buffer already contains data 29 | // TODO: support for non-empty tensor-tuples? 30 | if (!output.empty()) { 31 | return false; 32 | } 33 | // Check if the output buffer is batched 34 | // TODO: support for batched tensor tuples? 35 | if (output.isBatched()) { 36 | return false; 37 | } 38 | // Iterate over all entities in the specified path 39 | for (const auto& entry : boost::filesystem::directory_iterator(path)) { 40 | // Check if the filename extension indicates the entity to be a binary dataset file 41 | if (entry.path().filename().extension() == ".bin") { 42 | std::string name = entry.path().stem().string(); 43 | // Load data into buffer 44 | Eigen::Matrix buffer; 45 | load_eigen_from_binary(make_namescope({path, name + ".bin"}) , buffer); 46 | // Configure dimensions 47 | std::vector dims; 48 | dims.push_back(static_cast(buffer.rows())); 49 | dims.push_back(static_cast(buffer.cols())); 50 | output.addTensor(name, dims); 51 | output.get().back().asEigenMatrix() = buffer; 52 | } 53 | } 54 | // Success 55 | return true; 56 | } 57 | 58 | } // utils 59 | } // noesis 60 | 61 | #endif // NOESIS_FRAMEWORK_UTILS_DATASET_HPP_ 62 | 63 | /* EOF */ 64 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/utils/filestream.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author David Hoeller 3 | * @email dhoeller@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_UTILS_FILE_STREAM_HPP_ 10 | #define NOESIS_FRAMEWORK_UTILS_FILE_STREAM_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | 16 | // Eigen 17 | #include 18 | 19 | namespace noesis { 20 | namespace utils { 21 | 22 | template 23 | bool write_eigen_to_binary(const std::string& filename, const Eigen::Matrix& data) { 24 | std::ofstream out(filename, std::ios::out | std::ios::binary | std::ios::trunc); 25 | if (!out.is_open()) { 26 | return false; 27 | } 28 | auto rows = static_cast(data.rows()); 29 | auto cols = static_cast(data.cols()); 30 | out.write((char*) (&rows), sizeof(size_t)); 31 | out.write((char*) (&cols), sizeof(size_t)); 32 | out.write((char*) data.data(), rows * cols * sizeof(ScalarType_)); 33 | out.close(); 34 | return true; 35 | } 36 | 37 | template 38 | bool load_eigen_from_binary(const std::string& filename, Eigen::Matrix& data) { 39 | std::ifstream in(filename, std::ios::in | std::ios::binary); 40 | if (!in.is_open()) { 41 | return false; 42 | } 43 | size_t rows = 0; 44 | size_t cols = 0; 45 | in.read((char*) (&rows), sizeof(size_t)); 46 | in.read((char*) (&cols), sizeof(size_t)); 47 | data.resize(rows, cols); 48 | in.read((char*) data.data(), rows * cols * sizeof(ScalarType_)); 49 | in.close(); 50 | return true; 51 | } 52 | 53 | } // utils 54 | } // noesis 55 | 56 | #endif // NOESIS_FRAMEWORK_UTILS_FILE_STREAM_HPP_ 57 | 58 | /* EOF */ 59 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/utils/macros.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_FRAMEWORK_UTILS_MACROS_HPP_ 10 | #define NOESIS_FRAMEWORK_UTILS_MACROS_HPP_ 11 | 12 | //! @brief Helper macro which suppresses unused variable warnings in stub functions. 13 | #define UNUSED_VARIABLE(var) do { (void)(var); } while (0) 14 | 15 | //! @brief Helper macros for converting macros to strings. 16 | #define MAKE_STRING(x) _MAKE_STRING(x) 17 | #define _MAKE_STRING(x) #x 18 | 19 | #endif // NOESIS_FRAMEWORK_UTILS_MACROS_HPP_ 20 | 21 | /* EOF */ 22 | -------------------------------------------------------------------------------- /noesis/include/noesis/framework/utils/png.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Mayank Mittal 3 | * @email mittalma@student.ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | #ifndef NOESIS_FRAMEWORK_UTILS_IMAGE_ENCODING_HPP_ 12 | #define NOESIS_FRAMEWORK_UTILS_IMAGE_ENCODING_HPP_ 13 | 14 | // C/C++ 15 | #include 16 | 17 | // Eigen 18 | #include 19 | 20 | namespace noesis { 21 | namespace utils { 22 | 23 | //! @brief Convert eigen matrices for RGBA channels into png string 24 | extern int png_image_to_string(const Eigen::Matrix& red, 25 | const Eigen::Matrix& green, 26 | const Eigen::Matrix& blue, 27 | const Eigen::Matrix& alpha, 28 | std::string& output); 29 | 30 | //! @brief Convert eigen matrices for RGB channels into png string 31 | extern int png_image_to_string(const Eigen::Matrix& red, 32 | const Eigen::Matrix& green, 33 | const Eigen::Matrix& blue, 34 | std::string& output); 35 | 36 | //! @brief Convert eigen matrices for grey-scale image into png string 37 | extern int png_image_to_string(const Eigen::Matrix& grey, 38 | std::string& output); 39 | 40 | } // namespace utils 41 | } // namespace noesis 42 | 43 | #endif // NOESIS_FRAMEWORK_UTILS_IMAGE_ENCODING_HPP_ 44 | 45 | /* EOF */ 46 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/ant/AntActions.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_ACTIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_ACTIONS_HPP_ 15 | 16 | // Noesis 17 | #include "noesis/mdp/types.hpp" 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class AntActions : public noesis::mdp::Actions 24 | { 25 | public: 26 | //! Helper index for accessing each tensor instance 27 | enum Index { 28 | Ctrl = 0, 29 | }; 30 | 31 | //! Explicit constructor ensures that each instantiation properly configures all tensors 32 | explicit AntActions(const std::string &scope = "", size_t time_size = 0, size_t batch_size = 0) : 33 | noesis::mdp::Actions(scope, time_size, batch_size) 34 | { 35 | // Joint commands are the torques 36 | this->addTensor("ctrl", {8}); 37 | } 38 | }; 39 | 40 | } // namespace gym 41 | } // namespace noesis 42 | 43 | #endif // NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_ACTIONS_HPP_ 44 | 45 | /* EOF */ 46 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/ant/AntObservations.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_OBSERVATIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_OBSERVATIONS_HPP_ 15 | 16 | // Noesis 17 | #include "noesis/mdp/types.hpp" 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class AntObservations : public noesis::mdp::Observations 24 | { 25 | public: 26 | //! Helper index for accessing each observation Tensor 27 | enum Index { 28 | GenCoord = 0, 29 | GenVel, 30 | CartExtFrc 31 | }; 32 | 33 | //! The unique constructor defines the observations type 34 | explicit AntObservations(const std::string &scope = "", size_t time_size = 0, size_t batch_size = 0) : 35 | noesis::mdp::Observations(scope, time_size, batch_size) 36 | { 37 | // Generalized coordinates, except for absolute X-Y position 38 | this->addTensor("qpos", {7 + 8 - 2}); 39 | // Generalized velocities 40 | this->addTensor("qvel", {6 + 8}); 41 | // COM-based external force on body := 14x6, 14 bodies x 6D wrench 42 | this->addTensor("cfrc_ext", {14u * 6u}); 43 | } 44 | }; 45 | 46 | } // namespace gym 47 | } // namespace noesis 48 | 49 | #endif // NOESIS_GYM_ENVS_MUJOCO_ANT_ANT_OBSERVATIONS_HPP_ 50 | 51 | /* EOF */ 52 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/halfcheetah/HalfcheetahActions.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_ACTIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_ACTIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class HalfcheetahActions : public noesis::mdp::Actions 24 | { 25 | public: 26 | //! Helper index for accessing each action Tensor 27 | enum Index { 28 | Ctrl = 0, 29 | }; 30 | 31 | //! 32 | explicit HalfcheetahActions(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 33 | noesis::mdp::Actions(name_scope, time_size, batch_size) 34 | { 35 | this->addTensor("ctrl", {6}); 36 | } 37 | }; 38 | 39 | } // namespace gym 40 | } // namespace noesis 41 | 42 | #endif // NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_ACTIONS_HPP_ 43 | 44 | /* EOF */ 45 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/halfcheetah/HalfcheetahObservations.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_OBSERVATIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_OBSERVATIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class HalfcheetahObservations : public noesis::mdp::Observations 24 | { 25 | public: 26 | //! Helper index for accessing each observation Tensor 27 | enum Index { 28 | GenCoord = 0, 29 | GenVel, 30 | }; 31 | 32 | //! The unique constructor defines the observations type 33 | explicit HalfcheetahObservations(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 34 | noesis::mdp::Observations(name_scope, time_size, batch_size) 35 | { 36 | // Generalized coordinates, except for absolute X position 37 | this->addTensor("qpos", {3 + 6 - 1}); 38 | // Generalized velocities 39 | this->addTensor("qvel", {3 + 6}); 40 | } 41 | }; 42 | 43 | } // namespace gym 44 | } // namespace noesis 45 | 46 | #endif // NOESIS_GYM_ENVS_MUJOCO_HALFCHEETAH_HALFCHEETAH_OBSERVATIONS_HPP_ 47 | 48 | /* EOF */ 49 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/hopper/HopperActions.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Mayank Mittal 3 | * @email mittalma@ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_ACTIONS_HPP_ 12 | #define NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_ACTIONS_HPP_ 13 | 14 | // noesis 15 | #include 16 | 17 | namespace noesis { 18 | namespace gym { 19 | 20 | template 21 | class HopperActions : public noesis::mdp::Actions 22 | { 23 | public: 24 | //! Helper index for accessing each action Tensor 25 | enum Index { 26 | Ctrl = 0, 27 | }; 28 | //! 29 | explicit HopperActions(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 30 | noesis::mdp::Actions(name_scope, time_size, batch_size) 31 | { 32 | this->addTensor("ctrl", {3}); 33 | } 34 | }; 35 | 36 | } // namespace gym 37 | } // namespace noesis 38 | 39 | #endif // NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_ACTIONS_HPP_ 40 | 41 | /* EOF */ 42 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/hopper/HopperObservations.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Mayank Mittal 3 | * @email mittalma@ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_OBSERVATIONS_HPP_ 12 | #define NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_OBSERVATIONS_HPP_ 13 | 14 | // noesis 15 | #include 16 | 17 | namespace noesis { 18 | namespace gym { 19 | 20 | template 21 | class HopperObservations : public noesis::mdp::Observations 22 | { 23 | public: 24 | //! Helper index for accessing each observation Tensor 25 | enum Index { 26 | GenCoord = 0, 27 | GenVel, 28 | }; 29 | 30 | //! The unique constructor defines the observations type 31 | explicit HopperObservations(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 32 | noesis::mdp::Observations(name_scope, time_size, batch_size) 33 | { 34 | // Generalized coordinates, except for absolute X position 35 | this->addTensor("qpos", {3 + 3 - 1}); 36 | // Generalized velocities 37 | this->addTensor("qvel", {3 + 3}); 38 | } 39 | }; 40 | 41 | } // namespace gym 42 | } // namespace noesis 43 | 44 | #endif // NOESIS_GYM_ENVS_MUJOCO_HOPPER_HOPPER_OBSERVATIONS_HPP_ 45 | 46 | /* EOF */ 47 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/humanoid/HumanoidActions.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_ACTIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_ACTIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class HumanoidActions : public noesis::mdp::Actions 24 | { 25 | public: 26 | //! Helper index for accessing each action Tensor 27 | enum Index { 28 | Ctrl = 0, 29 | }; 30 | 31 | //! 32 | explicit HumanoidActions(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 33 | noesis::mdp::Actions(name_scope, time_size, batch_size) 34 | { 35 | this->addTensor("ctrl", {17}); 36 | } 37 | }; 38 | 39 | } // namespace gym 40 | } // namespace noesis 41 | 42 | #endif // NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_ACTIONS_HPP_ 43 | 44 | /* EOF */ 45 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/humanoid/HumanoidObservations.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Mayank Mittal 3 | * @email mittalma@ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * @author Markus Staeuble 7 | * @email markus.staeuble@mavt.ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_OBSERVATIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_OBSERVATIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class HumanoidObservations : public noesis::mdp::Observations 24 | { 25 | public: 26 | //! Helper index for accessing each observation Tensor 27 | enum Index { 28 | GenCoord = 0, 29 | GenVel, 30 | ComInert, 31 | ComVel, 32 | ActForces, 33 | CartExtFrc 34 | }; 35 | 36 | //! The unique constructor defines the observations type 37 | explicit HumanoidObservations(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 38 | noesis::mdp::Observations(name_scope, time_size, batch_size) 39 | { 40 | // Generalized coordinates, except for absolute X-Y position 41 | this->addTensor("qpos", {7 + 17 - 2}); 42 | // Generalized velocities 43 | this->addTensor("qvel", {6 + 17}); 44 | // COM-based body inertia and mass := 14x10, 14 bodies x 10 45 | this->addTensor("cinert", {14u * 10u}); 46 | // COM-based velocity [3D rot; 3D tran] := 14 * 6D 47 | this->addTensor("cvel", {14u * 6u}); 48 | // Actuator Forces 49 | this->addTensor("qfrc_actuator", {6 + 17}); 50 | // COM-based external force on body := 14x6, 14 bodies x 6D wrench 51 | this->addTensor("cfrc_ext", {14u * 6u}); 52 | } 53 | }; 54 | 55 | } // namespace gym 56 | } // namespace noesis 57 | 58 | #endif // NOESIS_GYM_ENVS_MUJOCO_HUMANOID_HUMANOID_OBSERVATIONS_HPP_ 59 | 60 | /* EOF */ 61 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/walker2d/Walker2dActions.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Markus Staeuble 5 | * @email markus.staeuble@mavt.ethz.ch 6 | * @author Mayank Mittal 7 | * @email mittalma@ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_ACTIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_ACTIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class Walker2dActions : public noesis::mdp::Actions 24 | { 25 | public: 26 | //! Helper index for accessing each action Tensor 27 | enum Index { 28 | Ctrl = 0, 29 | }; 30 | 31 | //! 32 | explicit Walker2dActions(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 33 | noesis::mdp::Actions(name_scope, time_size, batch_size) 34 | { 35 | this->addTensor("ctrl", {6}); 36 | } 37 | }; 38 | 39 | } // namespace gym 40 | } // namespace noesis 41 | 42 | #endif // NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_ACTIONS_HPP_ 43 | 44 | /* EOF */ 45 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/mujoco/walker2d/Walker2dObservations.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Mayank Mittal 3 | * @email mittalma@ethz.ch 4 | * @author Vassilios Tsounis 5 | * @email tsounisv@ethz.ch 6 | * @author Markus Staeuble 7 | * @email markus.staeuble@mavt.ethz.ch 8 | * 9 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 10 | * All rights reserved. 11 | * http://www.rsl.ethz.ch/ 12 | */ 13 | #ifndef NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_OBSERVATIONS_HPP_ 14 | #define NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_OBSERVATIONS_HPP_ 15 | 16 | // noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class Walker2dObservations : public noesis::mdp::Observations 24 | { 25 | public: 26 | //! Helper index for accessing each observation Tensor 27 | enum Index { 28 | GenCoord = 0, 29 | GenVel, 30 | }; 31 | 32 | //! The unique constructor defines the observations type 33 | explicit Walker2dObservations(const std::string& name_scope = "", size_t time_size = 0, size_t batch_size = 0): 34 | noesis::mdp::Observations(name_scope, time_size, batch_size) 35 | { 36 | // Generalized coordinates, except for absolute X position 37 | this->addTensor("qpos", {3 + 6 - 1}); 38 | // Generalized velocities 39 | this->addTensor("qvel", {3 + 6}); 40 | } 41 | }; 42 | 43 | } // namespace gym 44 | } // namespace noesis 45 | 46 | #endif // NOESIS_GYM_ENVS_MUJOCO_WALKER2D_WALKER2D_OBSERVATIONS_HPP_ 47 | 48 | /* EOF */ 49 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/raisim/common/signals.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_ENVS_RAISIM_COMMON_SIGNALS_HPP_ 10 | #define NOESIS_GYM_ENVS_RAISIM_COMMON_SIGNALS_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | #include 16 | 17 | namespace noesis { 18 | namespace gym { 19 | namespace signals { 20 | 21 | 22 | /*! 23 | * @brief Scalar step signal. 24 | * @tparam Scalar Scalar floating-point type used for the operation. 25 | * @param t The current physical time. 26 | * @param t0 The starting time of the signal. 27 | * @return The value of the signal output. 28 | */ 29 | template 30 | static inline Scalar step(Scalar t, Scalar t0=0) { 31 | return (t > t0) ? 1 : 0; 32 | } 33 | 34 | /*! 35 | * @brief Scalar sinusoidal signal 36 | * @tparam Scalar Scalar floating-point type used for the operation. 37 | * @param t The current physical time. 38 | * @param f The signal frequency. 39 | * @return The value of the signal output. 40 | */ 41 | template 42 | static inline Scalar sine(Scalar t, Scalar f) { 43 | return std::sin(2.0 * M_PI * f * t); 44 | } 45 | 46 | /*! 47 | * @brief Scalar exponential chirp signal. 48 | * @tparam Scalar Scalar floating-point type used for the operation. 49 | * @param t The current physical time. 50 | * @param T The ending physical time of the signal. 51 | * @param f0 The initial frequency of the chirp. 52 | * @param f1 The final frequency of the chirp. 53 | * @return The value of the signal output. 54 | */ 55 | template 56 | static inline Scalar chirp(Scalar t, Scalar T=1, Scalar f0=1, Scalar f1=10) { 57 | constexpr auto eps = std::numeric_limits::epsilon(); 58 | auto k = std::pow(f1/f0, t/T); 59 | return std::sin(2.0 * M_PI * f0 * (k - 1.0)/(std::log(k) + eps)); 60 | } 61 | 62 | } // namespace signals 63 | } // namespace gym 64 | } // namespace noesis 65 | 66 | #endif // NOESIS_GYM_ENVS_RAISIM_COMMON_SIGNALS_HPP_ 67 | 68 | /* EOF */ 69 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/envs/raisim/common/types.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_ENVS_RAISIM_COMMON_TYPES_HPP_ 10 | #define NOESIS_GYM_ENVS_RAISIM_COMMON_TYPES_HPP_ 11 | 12 | // Eigen 13 | #include 14 | #include 15 | 16 | namespace noesis { 17 | namespace gym { 18 | 19 | /* 20 | * Common algebraic types 21 | */ 22 | using Vector2i = Eigen::Vector2i; 23 | using Vector2 = Eigen::Vector2d; 24 | using Vector3 = Eigen::Vector3d; 25 | using Vector4 = Eigen::Vector4d; 26 | using Vector6 = Eigen::Matrix; 27 | using Matrix3 = Eigen::Matrix3d; 28 | 29 | /* 30 | * Common kinematics types 31 | */ 32 | using Position = Vector3; 33 | using RotationMatrix = Matrix3; 34 | using Quaternion = Vector4; 35 | using EulerRpy = Vector3; 36 | using AngleAxis = Eigen::AngleAxis; 37 | using LinearVelocity = Vector3; 38 | using AngularVelocity = Vector3; 39 | using LinearAcceleration = Vector3; 40 | using AngularAcceleration = Vector3; 41 | using LinearImpulse = Vector3; 42 | using LinearForce = Vector3; 43 | 44 | /* 45 | * Aggregate types 46 | */ 47 | using Pose = std::pair; 48 | using Trajectory3 = std::vector>; 49 | using Trajectory6 = std::vector>; 50 | 51 | } // namespace gym 52 | } // namespace noesis 53 | 54 | #endif // NOESIS_GYM_ENVS_RAISIM_COMMON_TYPES_HPP_ 55 | 56 | /* EOF */ 57 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/train/MonitorInterface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_TRAIN_MONITOR_INTERFACE_HPP_ 10 | #define NOESIS_GYM_TRAIN_MONITOR_INTERFACE_HPP_ 11 | 12 | // Noesis 13 | #include 14 | 15 | namespace noesis { 16 | namespace gym { 17 | 18 | template 19 | class MonitorInterface 20 | { 21 | public: 22 | 23 | // Aliases 24 | using Scalar = ScalarType_; 25 | using Metrics = ::noesis::log::Metrics; 26 | 27 | /* 28 | * Instantiation 29 | */ 30 | 31 | MonitorInterface() = default; 32 | 33 | ~MonitorInterface() = default; 34 | 35 | /* 36 | * Properties 37 | */ 38 | 39 | virtual const Metrics& metrics() const = 0; 40 | 41 | virtual std::string info() const = 0; 42 | 43 | /* 44 | * Operations 45 | */ 46 | 47 | virtual void configure() = 0; 48 | 49 | virtual void reset() = 0; 50 | 51 | virtual bool update() = 0; 52 | }; 53 | 54 | } // namespace gym 55 | } // namespace noesis 56 | 57 | #endif // NOESIS_GYM_TRAIN_MONITOR_INTERFACE_HPP_ 58 | 59 | /* EOF */ 60 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/train/RunnerInterface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_TRAIN_RUNNER_INTERFACE_HPP_ 10 | #define NOESIS_GYM_TRAIN_RUNNER_INTERFACE_HPP_ 11 | 12 | // Noesis 13 | #include "noesis/framework/log/metric.hpp" 14 | #include "noesis/framework/log/tensorboard.hpp" 15 | #include "noesis/framework/core/Graph.hpp" 16 | #include "noesis/gym/train/SamplerInterface.hpp" 17 | #include "noesis/gym/train/MonitorInterface.hpp" 18 | 19 | namespace noesis { 20 | namespace gym { 21 | 22 | template 23 | class RunnerInterface 24 | { 25 | public: 26 | 27 | // Ensure that ScalarType_ is one of the supported types 28 | static_assert( 29 | std::is_arithmetic::value, 30 | "ScalarType_ must be an arithmetic type, e.g. {int, float, double, etc..}" 31 | ); 32 | 33 | //! @brief Defines the modes in which a runner operate for sample collection. 34 | enum class RunMode { 35 | Samples, 36 | Batches, 37 | Iterations 38 | }; 39 | 40 | // Aliases 41 | using Scalar = ScalarType_; 42 | using Metrics = ::noesis::log::Metrics; 43 | using SamplerPtr = ::noesis::gym::SamplerInterface*; 44 | using MonitorPtr = ::noesis::gym::MonitorInterface*; 45 | using LoggerPtr = ::noesis::log::TensorBoardLogger*; 46 | using GraphPtr = ::noesis::core::Graph*; 47 | 48 | /* 49 | * Instantiation 50 | */ 51 | 52 | RunnerInterface() = default; 53 | 54 | virtual ~RunnerInterface() = default; 55 | 56 | 57 | /* 58 | * Configurations 59 | */ 60 | 61 | virtual void setSampler(SamplerPtr sampler) = 0; 62 | 63 | virtual void setMonitor(MonitorPtr monitor) = 0; 64 | 65 | virtual void setLogger(LoggerPtr logger) = 0; 66 | 67 | virtual void setGraph(GraphPtr graph) = 0; 68 | 69 | /* 70 | * Properties 71 | */ 72 | 73 | virtual const std::vector& getSampleCounters() const = 0; 74 | 75 | virtual const std::vector& getBatchCounters() const = 0; 76 | 77 | virtual size_t getTotalSamples() const = 0; 78 | 79 | virtual size_t getTotalBatches() const = 0; 80 | 81 | virtual size_t getTotalIterations() const = 0; 82 | 83 | virtual std::string info() const = 0; 84 | 85 | /* 86 | * Operations 87 | */ 88 | 89 | virtual void configure() = 0; 90 | 91 | virtual void reset() = 0; 92 | 93 | virtual void run(RunMode mode, size_t duration) = 0; 94 | }; 95 | 96 | } // namespace gym 97 | } // namespace noesis 98 | 99 | #endif // NOESIS_GYM_TRAIN_RUNNER_INTERFACE_HPP_ 100 | 101 | /* EOF */ 102 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/train/SamplerInterface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_TRAIN_SAMPLER_INTERFACE_HPP_ 10 | #define NOESIS_GYM_TRAIN_SAMPLER_INTERFACE_HPP_ 11 | 12 | // Noesis 13 | #include 14 | 15 | namespace noesis { 16 | namespace gym { 17 | 18 | template 19 | class SamplerInterface 20 | { 21 | public: 22 | 23 | // Ensure that ScalarType_ is one of the supported types 24 | static_assert( 25 | std::is_arithmetic::value, 26 | "ScalarType_ must be an arithmetic type, e.g. {int, float, double, etc..}" 27 | ); 28 | 29 | // Aliases 30 | using Scalar = ScalarType_; 31 | using Metrics = ::noesis::log::Metrics; 32 | 33 | /* 34 | * Instantiation 35 | */ 36 | 37 | SamplerInterface() = default; 38 | 39 | virtual ~SamplerInterface() = default; 40 | 41 | /* 42 | * Properties 43 | */ 44 | 45 | virtual const std::vector& getSampleCounters() const = 0; 46 | 47 | virtual const std::vector& getBatchCounters() const = 0; 48 | 49 | virtual size_t getTotalSamples() const = 0; 50 | 51 | virtual size_t getTotalBatches() const = 0; 52 | 53 | virtual const Metrics& metrics() const = 0; 54 | 55 | virtual std::string info() const = 0; 56 | 57 | /* 58 | * Operations 59 | */ 60 | 61 | virtual void configure() = 0; 62 | 63 | virtual void reset() = 0; 64 | 65 | virtual bool sample() = 0; 66 | 67 | virtual void process() = 0; 68 | }; 69 | 70 | } // namespace gym 71 | } // namespace noesis 72 | 73 | #endif // NOESIS_GYM_TRAIN_SAMPLER_INTERFACE_HPP_ 74 | 75 | /* EOF */ 76 | -------------------------------------------------------------------------------- /noesis/include/noesis/gym/train/VisualizerInterface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_GYM_TRAIN_VISUALIZER_INTERFACE_HPP_ 10 | #define NOESIS_GYM_TRAIN_VISUALIZER_INTERFACE_HPP_ 11 | 12 | // C/C++ 13 | #include 14 | 15 | namespace noesis { 16 | namespace gym { 17 | 18 | class VisualizerInterface 19 | { 20 | public: 21 | 22 | /* 23 | * Instantiation 24 | */ 25 | 26 | VisualizerInterface() = default; 27 | 28 | virtual ~VisualizerInterface() = default; 29 | 30 | /* 31 | * Properties 32 | */ 33 | 34 | virtual bool isActive() const = 0; 35 | 36 | virtual bool isEnabled() const = 0; 37 | 38 | /* 39 | * Operations 40 | */ 41 | 42 | virtual void launch() = 0; 43 | 44 | virtual void enable() = 0; 45 | 46 | virtual void disable() = 0; 47 | 48 | virtual void render() = 0; 49 | 50 | virtual void startRecording(const std::string& directory, const std::string& filename) = 0; 51 | 52 | virtual void stopRecording() = 0; 53 | }; 54 | 55 | } // namespace gym 56 | } // namespace noesis 57 | 58 | #endif // NOESIS_GYM_TRAIN_VISUALIZER_INTERFACE_HPP_ 59 | 60 | /* EOF */ 61 | -------------------------------------------------------------------------------- /noesis/include/noesis/mdp/AgentInterface.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | #ifndef NOESIS_MDP_AGENT_INTERFACE_HPP_ 10 | #define NOESIS_MDP_AGENT_INTERFACE_HPP_ 11 | 12 | // Noesis 13 | #include "noesis/mdp/types.hpp" 14 | 15 | namespace noesis { 16 | namespace mdp { 17 | 18 | template 19 | class AgentInterface 20 | { 21 | public: 22 | 23 | // Ensure that ScalarType_ is one of the supported types 24 | static_assert( 25 | std::is_arithmetic::value, 26 | "ScalarType_ must be an arithmetic type, e.g. {int, float, double, etc..}" 27 | ); 28 | 29 | // Aliases 30 | using Scalar = ScalarType_; 31 | using Observations = ::noesis::mdp::Observations; 32 | using Actions = ::noesis::mdp::Actions; 33 | using Rewards = ::noesis::mdp::Rewards; 34 | using Metrics = ::noesis::mdp::Metrics; 35 | using Termination = ::noesis::mdp::Termination; 36 | using Terminations = ::noesis::mdp::Terminations; 37 | using Names = std::vector; 38 | 39 | /* 40 | * Instantiation 41 | */ 42 | 43 | AgentInterface() = default; 44 | 45 | virtual ~AgentInterface() = default; 46 | 47 | /* 48 | * Properties 49 | */ 50 | 51 | virtual size_t batch_size() const = 0; 52 | 53 | virtual TensorsSpec actions_spec() const = 0; 54 | 55 | virtual TensorsSpec observations_spec() const = 0; 56 | 57 | virtual Names tasks() const = 0; 58 | 59 | virtual const Metrics& metrics() const = 0; 60 | 61 | virtual std::ostream& info(std::ostream& os) const = 0; 62 | 63 | virtual bool ready() const = 0; 64 | 65 | /* 66 | * Operations 67 | */ 68 | 69 | virtual void configure() = 0; 70 | 71 | virtual void initialize() = 0; 72 | 73 | virtual void seed(int seed) = 0; 74 | 75 | virtual void reset() = 0; 76 | 77 | virtual void act(const Observations& observations, Actions& actions) = 0; 78 | 79 | virtual void explore(const Observations& observations, Actions& actions) = 0; 80 | 81 | virtual void learn() = 0; 82 | 83 | friend std::ostream& operator<<(std::ostream& os, const AgentInterface& interface) { return interface.info(os); } 84 | }; 85 | 86 | } // namespace mdp 87 | } // namespace noesis 88 | 89 | #endif // NOESIS_MDP_AGENT_INTERFACE_HPP_ 90 | 91 | /* EOF */ 92 | -------------------------------------------------------------------------------- /noesis/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | noesis 5 | 0.2.0 6 | A framework for the development of robotic agents using TensorFlow C/C++. 7 | Apache 2.0 8 | https://github.com/leggedrobotics/noesis 9 | Vassilios Tsounis 10 | Vassilios Tsounis 11 | 12 | cmake 13 | catkin 14 | tensorflow 15 | sfml-dev 16 | tinyxml 17 | mujoco 18 | mujoco_cpp 19 | raisim 20 | raisim_ogre 21 | 22 | 23 | cmake 24 | 25 | 26 | -------------------------------------------------------------------------------- /noesis/resources/images/linear_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/noesis/resources/images/linear_arrow.png -------------------------------------------------------------------------------- /noesis/resources/images/rotary_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/noesis/resources/images/rotary_arrow.png -------------------------------------------------------------------------------- /noesis/resources/materials/grid/grid.material: -------------------------------------------------------------------------------- 1 | material terrain/grid 2 | { 3 | technique 4 | { 5 | pass 6 | { 7 | scene_blend alpha_blend 8 | depth_write on 9 | emissive 1 1 1 1 10 | texture_unit 11 | { 12 | texture grid.png 13 | scale 0.0025 0.0025 14 | filtering anisotropic 15 | max_anisotropy 8 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /noesis/resources/materials/grid/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/noesis/resources/materials/grid/grid.png -------------------------------------------------------------------------------- /noesis/src/framework/hyperparam/hyper_parameters.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Noesis 11 | #include 12 | 13 | namespace noesis { 14 | namespace hyperparam { 15 | 16 | /*! 17 | * @brief The instantiation of the global hyper-parameter manager. 18 | */ 19 | std::shared_ptr manager = std::make_shared(); 20 | 21 | } // namespace hyperparam 22 | } // namespace noesis 23 | 24 | /* EOF */ 25 | -------------------------------------------------------------------------------- /noesis/src/framework/system/time.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * @author Philipp Leemann 5 | * @email pleeman@ethz.ch 6 | * 7 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 8 | * All rights reserved. 9 | * http://www.rsl.ethz.ch/ 10 | */ 11 | 12 | // C/C++ 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | // Noesis 20 | #include "noesis/framework/system/time.hpp" 21 | 22 | namespace noesis { 23 | 24 | void Time::clear() { 25 | time_.tv_sec = 0; 26 | time_.tv_nsec = 0; 27 | } 28 | 29 | Time& Time::reset() { 30 | *this = Now(); 31 | return *this; 32 | } 33 | 34 | Time Time::elapsed() const { 35 | return (Now() - *this); 36 | } 37 | 38 | Time Time::operator-(const Time& other) const { 39 | int64_t sec = seconds() - other.seconds(); 40 | int64_t nsec = nanoseconds() - other.nanoseconds(); 41 | if (nsec < 0) { 42 | nsec += static_cast(1e9); 43 | sec--; 44 | } 45 | return {sec, nsec}; 46 | } 47 | 48 | Time Time::operator+(const Time& other) const { 49 | auto sec = static_cast(seconds() + other.seconds()); 50 | auto nsec = static_cast(nanoseconds() + other.nanoseconds()); 51 | if (nsec > static_cast(1e9)) { 52 | nsec -= static_cast(1e9); 53 | sec++; 54 | } 55 | return {static_cast(sec), static_cast(nsec)}; 56 | } 57 | 58 | double Time::toSeconds() const { 59 | return static_cast(seconds()) + 1e-9 * static_cast(nanoseconds()); 60 | } 61 | 62 | double Time::toMiliSeconds() const { 63 | return 1e+3 * static_cast(seconds()) + 1e-6 * static_cast(nanoseconds()); 64 | } 65 | 66 | double Time::toMicroSeconds() const { 67 | return 1e+6 * static_cast(seconds()) + 1e-3 * static_cast(nanoseconds()); 68 | } 69 | 70 | double Time::toNanoSeconds() const { 71 | return 1e+9 * static_cast(seconds()) + static_cast(nanoseconds()); 72 | } 73 | 74 | std::string Time::toString() const { 75 | std::time_t epoch = seconds(); 76 | std::stringstream ss; 77 | ss << std::put_time(std::gmtime(&epoch), "%H:%M:%S"); 78 | return ss.str(); 79 | } 80 | 81 | Time::Time(int64_t seconds, int64_t nanoseconds): 82 | time_{seconds, nanoseconds} 83 | { 84 | } 85 | 86 | } // namespace noesis 87 | 88 | /* EOF */ 89 | -------------------------------------------------------------------------------- /noesis/src/framework/system/version.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // Header 11 | #include "noesis/framework/system/version.hpp" 12 | 13 | // Eigen 14 | #include 15 | 16 | // TensorFlow 17 | #include 18 | 19 | 20 | #if defined(__GNUC__) 21 | #define CXX_COMPILER_VERSION ("GCC " TF_STR(__GNUC__) "." TF_STR(__GNUC_MINOR__) "." TF_STR(__GNUC_PATCHLEVEL__)) 22 | #elif defined(__clang__) 23 | #define CXX_COMPILER_VERSION ("clang " TF_STR(__clang_major__) "." TF_STR(__clang_minor__) "." TF_STR(__clang_patchlevel__)) 24 | #else 25 | #define CXX_COMPILER_VERSION ("Unknown") 26 | #endif 27 | 28 | 29 | namespace noesis { 30 | 31 | std::string compiler_version() { 32 | return std::string(CXX_COMPILER_VERSION); 33 | } 34 | 35 | std::string cxx_version() { 36 | return std::string(TF_STR(__cplusplus)); 37 | } 38 | 39 | std::string eigen_version() { 40 | return std::string(TF_STR(EIGEN_WORLD_VERSION) "." TF_STR(EIGEN_MAJOR_VERSION) "." TF_STR(EIGEN_MINOR_VERSION)); 41 | } 42 | 43 | std::string tensorflow_version() { 44 | return std::string(TF_VERSION_STRING); 45 | } 46 | 47 | } // namespace noesis 48 | 49 | /* EOF */ 50 | -------------------------------------------------------------------------------- /noesis/test/src/framework/core/TensorsSpecTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // C/C++ 11 | //#include 12 | 13 | // google test 14 | #include 15 | 16 | // Noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace tests { 21 | 22 | template 23 | struct Dummy {}; 24 | 25 | /* 26 | * Tests 27 | */ 28 | 29 | TEST(TensorsSpecTest, Streaming) { 30 | std::stringstream ss; 31 | noesis::TensorsSpec spec; 32 | ss << spec; 33 | std::cout << "Spec before: " << ss.str() << std::endl; 34 | EXPECT_EQ("{}", ss.str()); 35 | spec = {{"command", {1,2}}, {"motion", {3,4}}}; 36 | ss.str(std::string()); 37 | ss << spec; 38 | std::cout << "Spec after: " << ss.str() << std::endl; 39 | auto specStr = ss.str(); 40 | EXPECT_EQ("{ 'command': [1, 2], 'motion': [3, 4] }", specStr); 41 | } 42 | 43 | } // namespace tests 44 | } // namespace noesis 45 | 46 | /* EOF */ 47 | -------------------------------------------------------------------------------- /noesis/test/src/framework/hyperparam/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /noesis/test/src/framework/math/RandomNumberGeneratorTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // google test 11 | #include 12 | 13 | // Base classes 14 | #include 15 | 16 | namespace noesis { 17 | namespace tests { 18 | 19 | /** 20 | * Define Test Fixture 21 | */ 22 | 23 | template 24 | class RandomNumberGeneratorTest : public ::testing::Test 25 | { 26 | protected: 27 | // Declare fixture aliases 28 | using ScalarType = ScalarType_; 29 | // We use default constructor/destructor 30 | RandomNumberGeneratorTest() = default; 31 | ~RandomNumberGeneratorTest() = default; 32 | }; 33 | 34 | // Test over the supported arithmetic types 35 | using ScalarTypes = ::testing::Types; 36 | 37 | // Declare the typed-test 38 | TYPED_TEST_CASE(RandomNumberGeneratorTest, ScalarTypes); 39 | 40 | /* 41 | * Tests 42 | */ 43 | 44 | TYPED_TEST(RandomNumberGeneratorTest, MultiInstance) { 45 | using ScalarType = typename RandomNumberGeneratorTest_MultiInstance_Test::ScalarType; 46 | 47 | static constexpr size_t num_of_instances = 3; 48 | static constexpr size_t num_of_samples = 20; 49 | 50 | // Create a generator 51 | std::vector> generators; 52 | generators.resize(num_of_instances); 53 | 54 | // Create a data buffer 55 | Eigen::Matrix samples; 56 | samples.setZero(); 57 | 58 | NNOTIFY("Starting multi-instance test ..."); 59 | for (size_t t = 0; t < num_of_samples; ++t) { 60 | for (size_t instance = 0; instance < num_of_instances; ++instance) { 61 | samples(t, instance) = generators[instance].sampleUnitUniform(); 62 | } 63 | } 64 | NINFO("Samples:\n" << samples); 65 | 66 | // Check that all samples match 67 | for (size_t t = 0; t < num_of_samples; ++t) { 68 | for (size_t instance = 1; instance < num_of_instances; ++instance) { 69 | EXPECT_TRUE(samples(t, 0) == samples(t, instance)); 70 | } 71 | } 72 | } 73 | 74 | } // namespace tests 75 | } // namespace noesis 76 | 77 | /* EOF */ 78 | -------------------------------------------------------------------------------- /noesis/test/src/framework/system/TensorFlowTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author David Hoeller 3 | * @email dhoeller@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // google test 11 | #include 12 | 13 | // Noesis 14 | #include 15 | #include 16 | 17 | namespace noesis { 18 | namespace tests { 19 | 20 | TEST(TensorFlowTest, CreateSession) { 21 | tensorflow::Session* session = nullptr; 22 | tensorflow::Status status = NewSession(tensorflow::SessionOptions(), &session); 23 | EXPECT_TRUE(status.ok()); 24 | std::cout << "Status string: " << status.ToString() << std::endl; 25 | } 26 | 27 | TEST(TensorFlowTest, ListAvailableDevices) { 28 | auto devices = tf::available_devices(); 29 | EXPECT_EQ("/device:CPU:0", devices[0]); 30 | std::cout << "Devices: " << utils::vector_to_string(devices) << std::endl; 31 | } 32 | 33 | TEST(TensorFlowTest, FilterdDeviceLists) { 34 | std::vector devices = {"/device:CPU:0", "/device:GPU:0", "/device:GPU:1"}; 35 | auto filtered = tf::filter_gpu_devices(devices); 36 | EXPECT_EQ(2, filtered.size()); 37 | EXPECT_EQ((std::vector{"0","1"}), filtered); 38 | std::cout << "Filtered devices: " << utils::vector_to_string(filtered) << std::endl; 39 | } 40 | 41 | } // namespace tests 42 | } // namespace noesis 43 | 44 | /* EOF */ 45 | -------------------------------------------------------------------------------- /noesis/test/src/framework/system/TimeTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // C/C++ 11 | #include 12 | 13 | // google test 14 | #include 15 | 16 | // Noesis 17 | #include 18 | #include 19 | 20 | namespace noesis { 21 | namespace tests { 22 | 23 | /* 24 | * Tests 25 | */ 26 | 27 | TEST(TimeTest, Creation) { 28 | Time time; 29 | NINFO("Time now is: " << time); 30 | EXPECT_EQ(0.0, time.toSeconds()); 31 | } 32 | 33 | TEST(TimeTest, NowAndResettingToNow) { 34 | Time now = Time::Now(); 35 | Time time; 36 | time.reset(); 37 | NINFO("Time is: " << time); 38 | NINFO("Now is: " << now); 39 | EXPECT_NEAR(now.toSeconds(), time.toSeconds(), 1.0e-5); 40 | } 41 | 42 | TEST(TimeTest, MeasureElapsed) { 43 | Time now = Time::Now(); 44 | usleep(10000); 45 | auto dt = now.elapsed().toSeconds(); 46 | NINFO("dt is: " << dt); 47 | EXPECT_NEAR(0.01, dt, 1.0e-3); 48 | } 49 | 50 | TEST(TimeTest, CovertToMiliSeconds) { 51 | Time now = Time::Now(); 52 | usleep(10000); 53 | auto dt_s = now.elapsed().toSeconds(); 54 | auto dt_ms = now.elapsed().toMiliSeconds(); 55 | NINFO("dt in seconds is: " << dt_s); 56 | NINFO("dt in mili-seconds is: " << dt_ms); 57 | EXPECT_NEAR(dt_s*1000.0, dt_ms, 1.0e-2); 58 | } 59 | 60 | TEST(TimeTest, CovertToMicroSeconds) { 61 | Time now = Time::Now(); 62 | usleep(10000); 63 | auto dt_s = now.elapsed().toSeconds(); 64 | auto dt_us = now.elapsed().toMicroSeconds(); 65 | NINFO("dt in seconds is: " << dt_s); 66 | NINFO("dt in micro-seconds is: " << dt_us); 67 | EXPECT_NEAR(dt_s*1.0e+6, dt_us, 10.0); 68 | } 69 | 70 | TEST(TimeTest, CovertToNanoSeconds) { 71 | Time now = Time::Now(); 72 | usleep(10000); 73 | auto dt_s = now.elapsed().toSeconds(); 74 | auto dt_ns = now.elapsed().toNanoSeconds(); 75 | NINFO("dt in seconds is: " << dt_s); 76 | NINFO("dt in nano-seconds is: " << dt_ns); 77 | EXPECT_NEAR(dt_s*1.0e+9, dt_ns, 10000.0); 78 | } 79 | 80 | TEST(TimeTest, CovertToString) { 81 | Time now = Time::Now(); 82 | NINFO("Time now is: " << now.toString()); 83 | } 84 | 85 | } // namespace tests 86 | } // namespace noesis 87 | 88 | /* EOF */ 89 | -------------------------------------------------------------------------------- /noesis/test/src/framework/utils/StringUtilsTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | * @author Vassilios Tsounis 3 | * @email tsounisv@ethz.ch 4 | * 5 | * Copyright (C) 2023 Robotic Systems Lab, ETH Zurich. 6 | * All rights reserved. 7 | * http://www.rsl.ethz.ch/ 8 | */ 9 | 10 | // C/C++ 11 | //#include 12 | 13 | // google test 14 | #include 15 | 16 | // Noesis 17 | #include 18 | 19 | namespace noesis { 20 | namespace tests { 21 | 22 | template 23 | struct Dummy {}; 24 | 25 | /* 26 | * Tests 27 | */ 28 | 29 | TEST(StringUtilsTest, MakeNameScope) { 30 | auto namescope = utils::make_namescope({"dog", "cat", "mouse"}); 31 | std::cout << "Scope: " << namescope << std::endl; 32 | EXPECT_EQ("dog/cat/mouse", namescope); 33 | } 34 | 35 | TEST(StringUtilsTest, RemoveNameScope) { 36 | auto name = utils::remove_namescope({"dog/cat/mouse"}); 37 | std::cout << "Name: " << name << std::endl; 38 | EXPECT_EQ("mouse", name); 39 | } 40 | 41 | TEST(StringUtilsTest, VecToString) { 42 | std::vector ints = {1,2,3,4}; 43 | std::vector floats = {0.0, 10.0}; 44 | std::vector strings = {"dog", "cat", "mouse"}; 45 | std::vector vectors = { 46 | Eigen::VectorXd::Constant(2, 1.0), 47 | Eigen::VectorXd::Constant(3, 2.0), 48 | Eigen::VectorXd::Constant(2, 3.0) 49 | }; 50 | auto intsStr = utils::vector_to_string(ints, "[]"); 51 | auto floatsStr = utils::vector_to_string(floats, "(]"); 52 | auto stringsStr = utils::vector_to_string(strings); 53 | auto vectorStr = utils::vector_to_string(vectors); 54 | std::cout << "Integers: " << stringsStr << std::endl; 55 | std::cout << "Floats: " << floatsStr << std::endl; 56 | std::cout << "Strings: " << intsStr << std::endl; 57 | std::cout << "Vectors: " << vectorStr << std::endl; 58 | EXPECT_EQ("[1, 2, 3, 4]", intsStr); 59 | EXPECT_EQ("(0.000000, 10.000000]", floatsStr); 60 | EXPECT_EQ("{dog, cat, mouse}", stringsStr); 61 | } 62 | 63 | TEST(StringUtilsTest, TypenameToString) { 64 | using Type = Dummy; 65 | auto raw = utils::type_name().raw; 66 | auto scoped = utils::type_name().scoped; 67 | auto name = utils::type_name().name; 68 | std::cout << "raw: " << raw << std::endl; 69 | std::cout << "scoped_name: " << scoped << std::endl; 70 | std::cout << "name: " << name << std::endl; 71 | EXPECT_EQ("noesis::tests::Dummy", raw); 72 | EXPECT_EQ("noesis::tests::Dummy", scoped); 73 | EXPECT_EQ("Dummy", name); 74 | } 75 | 76 | } // namespace tests 77 | } // namespace noesis 78 | 79 | /* EOF */ 80 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | 12 | #== 13 | # Unit tests for MuJoCo environments 14 | #== 15 | 16 | message(STATUS "${PROJECT_NAME}: Including tests for MuJoCo environments") 17 | 18 | ## MuJoCo wrappers. 19 | set(TEST_MUJOCO_SRC 20 | ${CMAKE_CURRENT_SOURCE_DIR}/src/MujocoSimulationTest.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/src/MujocoVisualizerTest.cpp 22 | ) 23 | add_gtest(test_${PROJECT_NAME}_mujoco_wrapper "${TEST_MUJOCO_SRC}" noesis::noesis) 24 | 25 | # Hopper: Plannar (2D) single-legged hopping system. 26 | set(TEST_HOPPER_SRC 27 | ${CMAKE_CURRENT_SOURCE_DIR}/src/HopperEnvironmentTest.cpp 28 | ) 29 | add_gtest(test_${PROJECT_NAME}_mujoco_hopper "${TEST_HOPPER_SRC}" noesis::noesis) 30 | 31 | # HalfCheetah: Plannar (2D) simplified runner. 32 | set(TEST_HALFCHEETAH_SRC 33 | ${CMAKE_CURRENT_SOURCE_DIR}/src/HalfcheetahEnvironmentTest.cpp 34 | ) 35 | add_gtest(test_${PROJECT_NAME}_mujoco_halfcheetah "${TEST_HALFCHEETAH_SRC}" noesis::noesis) 36 | 37 | # Walker2D: Plannar (2D) bipedal walker. 38 | set(TEST_WALKER2D_SRC 39 | ${CMAKE_CURRENT_SOURCE_DIR}/src/Walker2dEnvironmentTest.cpp 40 | ) 41 | add_gtest(test_${PROJECT_NAME}_mujoco_walker2d "${TEST_WALKER2D_SRC}" noesis::noesis) 42 | 43 | # Ant: Simplified 8-DoF quadrupedal walker. 44 | set(TEST_ANT_SRC 45 | ${CMAKE_CURRENT_SOURCE_DIR}/src/AntEnvironmentTest.cpp 46 | ) 47 | add_gtest(test_${PROJECT_NAME}_mujoco_ant "${TEST_ANT_SRC}" noesis::noesis) 48 | 49 | # Humanoid: Standard MuJoCo rag-doll humanoid walker. 50 | set(TEST_HUMANOID_SRC 51 | ${CMAKE_CURRENT_SOURCE_DIR}/src/HumanoidEnvironmentTest.cpp 52 | ) 53 | add_gtest(test_${PROJECT_NAME}_mujoco_humanoid "${TEST_HUMANOID_SRC}" noesis::noesis) 54 | 55 | # EOF 56 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/ant_gym_episode/rewards.txt: -------------------------------------------------------------------------------- 1 | -8.279036816877136662e-01 2 | 3.917149545655789211e-01 3 | -1.192552625739077277e+00 4 | -4.022195738518825614e-01 5 | 1.057042220647496089e-01 6 | 6.146258695801378735e-01 7 | 2.356389458597267783e-01 8 | 2.488940459444268782e-01 9 | -4.609850570185434204e-01 10 | -5.967233018545758938e-02 11 | -5.153813708007597416e-01 12 | -5.725781903499480574e-01 13 | -7.673810801070825027e-01 14 | -7.350415180847358343e-02 15 | -1.352386905074784540e+00 16 | -1.929815828993870053e+00 17 | -2.267605400774571400e+00 18 | -2.227509804033707574e+00 19 | -1.528565769940473551e+00 20 | -1.885269544503570760e+00 21 | -2.616003418885629817e+00 22 | -2.105962281533376057e+00 23 | -1.492166196410429357e+00 24 | -1.919617909515461296e+00 25 | -6.336080074797401096e-01 26 | -1.467907915762729276e+00 27 | -1.036626574056633165e+00 28 | 2.727201366540841221e-01 29 | 7.922812409848192239e-01 30 | 1.029615170252099254e+00 31 | 2.079907790964181658e-01 32 | 4.674560883017910839e-01 33 | 7.532285788340380428e-01 34 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/ant_gym_episode/state_init.txt: -------------------------------------------------------------------------------- 1 | -8.912798874984335928e-02 2 | 9.307818744846407810e-02 3 | 7.765381891168205986e-01 4 | 9.956803557719515752e-01 5 | -8.262989211047257199e-02 6 | 3.597663796169692924e-02 7 | -2.232961219153767329e-02 8 | 3.396921345769463030e-02 9 | -8.803220624881061274e-02 10 | 5.397448894720380252e-03 11 | -9.194186139473350949e-02 12 | 9.558881502602259439e-02 13 | -7.412651774425099704e-03 14 | 2.592958722383725823e-02 15 | 8.940968621409325912e-02 16 | -4.298222544789361693e-02 17 | 1.840846875514338121e-01 18 | -4.267549831952003637e-03 19 | -2.830967518230000091e-02 20 | 7.686569898133335799e-02 21 | 4.120936204873700687e-02 22 | 6.595624886344418625e-02 23 | 7.713414314232219793e-02 24 | 1.921429074659663106e-03 25 | -1.007089023975125397e-01 26 | -8.684192378099667153e-02 27 | -1.120632900507835122e-01 28 | 2.211159437671376959e-02 29 | -2.084706486358687827e-01 30 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/ant_gym_episode/termination_stats.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00 2 | 0.000000000000000000e+00 3 | 0.000000000000000000e+00 4 | 0.000000000000000000e+00 5 | 0.000000000000000000e+00 6 | 0.000000000000000000e+00 7 | 0.000000000000000000e+00 8 | 0.000000000000000000e+00 9 | 0.000000000000000000e+00 10 | 0.000000000000000000e+00 11 | 0.000000000000000000e+00 12 | 0.000000000000000000e+00 13 | 0.000000000000000000e+00 14 | 0.000000000000000000e+00 15 | 0.000000000000000000e+00 16 | 0.000000000000000000e+00 17 | 0.000000000000000000e+00 18 | 0.000000000000000000e+00 19 | 0.000000000000000000e+00 20 | 0.000000000000000000e+00 21 | 0.000000000000000000e+00 22 | 0.000000000000000000e+00 23 | 0.000000000000000000e+00 24 | 0.000000000000000000e+00 25 | 0.000000000000000000e+00 26 | 0.000000000000000000e+00 27 | 0.000000000000000000e+00 28 | 0.000000000000000000e+00 29 | 0.000000000000000000e+00 30 | 0.000000000000000000e+00 31 | 0.000000000000000000e+00 32 | 0.000000000000000000e+00 33 | 1.000000000000000000e+00 34 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/halfcheetah_gym_episode/state_init.txt: -------------------------------------------------------------------------------- 1 | -8.912798874984335928e-02 2 | 9.307818744846407810e-02 3 | 2.653818911682065407e-02 4 | -4.199653123045835046e-02 5 | -7.950314858277296448e-02 6 | 3.461526961155150794e-02 7 | -2.148465198872646920e-02 8 | 3.396921345769463030e-02 9 | -8.803220624881061274e-02 10 | -5.727510457667883692e-02 11 | 3.362336211197233370e-03 12 | -3.173373363900766023e-03 13 | 4.092179272969335979e-02 14 | 5.138553542843286165e-02 15 | 1.490225253385474985e-02 16 | -4.298222544789361693e-02 17 | 1.840846875514338121e-01 18 | -4.267549831952003637e-03 19 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/hopper_gym_episode/rewards.txt: -------------------------------------------------------------------------------- 1 | 9.993869260777943353e-01 2 | 1.017088669028636039e+00 3 | 9.910054662875371623e-01 4 | 9.528557589839105058e-01 5 | 9.391915628063008947e-01 6 | 9.048105924379628018e-01 7 | 8.978954523498438034e-01 8 | 8.699848569106410912e-01 9 | 8.880639782050895326e-01 10 | 9.637044429476920859e-01 11 | 9.165648427946370136e-01 12 | 8.847311073411091575e-01 13 | 8.341207706927232790e-01 14 | 7.952941648951382669e-01 15 | 7.821449425865050209e-01 16 | 7.966589227718749999e-01 17 | 7.451917742319540405e-01 18 | 7.470753842732452688e-01 19 | 8.179395043405196519e-01 20 | 8.944160558070888278e-01 21 | 1.060810237695908320e+00 22 | 1.140437724315250145e+00 23 | 1.150584928711645416e+00 24 | 1.190223817007072915e+00 25 | 1.228133133843085867e+00 26 | 1.229390393893583955e+00 27 | 1.266615277407307838e+00 28 | 1.237069242228760801e+00 29 | 1.244303956054129578e+00 30 | 1.292354436432959552e+00 31 | 1.325061462190302519e+00 32 | 1.349126578576725466e+00 33 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/hopper_gym_episode/state_init.txt: -------------------------------------------------------------------------------- 1 | -4.456399437492168138e-03 2 | 1.254653909372423159e+00 3 | 1.326909455841033571e-03 4 | -2.099826561522917089e-03 5 | -3.975157429138648224e-03 6 | 1.730763480577574877e-03 7 | -1.074232599436323113e-03 8 | 1.698460672884732035e-03 9 | -4.401610312440530290e-03 10 | 2.698724447360188392e-04 11 | -4.597093069736675648e-03 12 | 4.779440751301129199e-03 13 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/hopper_gym_episode/termination_stats.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00 2 | 0.000000000000000000e+00 3 | 0.000000000000000000e+00 4 | 0.000000000000000000e+00 5 | 0.000000000000000000e+00 6 | 0.000000000000000000e+00 7 | 0.000000000000000000e+00 8 | 0.000000000000000000e+00 9 | 0.000000000000000000e+00 10 | 0.000000000000000000e+00 11 | 0.000000000000000000e+00 12 | 0.000000000000000000e+00 13 | 0.000000000000000000e+00 14 | 0.000000000000000000e+00 15 | 0.000000000000000000e+00 16 | 0.000000000000000000e+00 17 | 0.000000000000000000e+00 18 | 0.000000000000000000e+00 19 | 0.000000000000000000e+00 20 | 0.000000000000000000e+00 21 | 0.000000000000000000e+00 22 | 0.000000000000000000e+00 23 | 0.000000000000000000e+00 24 | 0.000000000000000000e+00 25 | 0.000000000000000000e+00 26 | 0.000000000000000000e+00 27 | 0.000000000000000000e+00 28 | 0.000000000000000000e+00 29 | 0.000000000000000000e+00 30 | 0.000000000000000000e+00 31 | 0.000000000000000000e+00 32 | 1.000000000000000000e+00 33 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/humanoid_gym_episode/rewards.txt: -------------------------------------------------------------------------------- 1 | 4.910946469579198670e+00 2 | 4.928144981284672710e+00 3 | 4.942777567201088296e+00 4 | 4.922519723166506544e+00 5 | 4.930402375945559967e+00 6 | 4.912476419103800396e+00 7 | 4.917333383496735877e+00 8 | 4.917251220894657493e+00 9 | 4.933403961224301248e+00 10 | 1.736701357780644273e+00 11 | 4.603644472507395946e+00 12 | 4.845208005815452523e+00 13 | 4.931243457621661719e+00 14 | 4.422007001874121990e+00 15 | 5.035260258639641329e+00 16 | 5.016060649929645621e+00 17 | 4.288929650174885921e+00 18 | 4.878744977675927075e+00 19 | 4.755702194950719885e+00 20 | 4.419050045457888487e+00 21 | 4.754427578799269583e+00 22 | 4.829988276751407739e+00 23 | 4.739379545007690986e+00 24 | 4.171029815359864834e+00 25 | 4.612317704131394080e+00 26 | 4.561747646332362294e+00 27 | 4.578650837902567439e+00 28 | 4.548660280856320348e+00 29 | 4.570862894527788711e+00 30 | 4.114330715141351291e+00 31 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/humanoid_gym_episode/state_init.txt: -------------------------------------------------------------------------------- 1 | -8.912798874984336275e-03 2 | 9.307818744846407463e-03 3 | 1.402653818911681949e+00 4 | 9.999597623608159624e-01 5 | -7.983522983607644827e-03 6 | 3.475985611310463200e-03 7 | -2.157439246173147116e-03 8 | 3.396921345769464071e-03 9 | -8.803220624881060580e-03 10 | 5.397448894720376783e-04 11 | -9.194186139473351296e-03 12 | 9.558881502602258398e-03 13 | -7.412651774425099704e-04 14 | 2.592958722383725129e-03 15 | 8.940968621409325565e-03 16 | 3.985556489487292187e-03 17 | -9.305939013455107739e-04 18 | 8.055637158064935313e-03 19 | -9.182154742402985972e-03 20 | 8.443535852413768319e-03 21 | 5.632188173066701373e-03 22 | -9.687718556086926183e-03 23 | -1.460377818883480672e-03 24 | 3.906745065127510685e-03 25 | 7.287050205187642696e-03 26 | 5.874897887518550424e-03 27 | 5.023537065830046069e-03 28 | -7.758226377357577488e-03 29 | 1.480195034834833057e-04 30 | -4.782322346572993703e-03 31 | -3.705995714823700354e-03 32 | -3.314372048103795577e-03 33 | 3.515413360141474153e-04 34 | 8.076704451067817300e-03 35 | -1.817429012418745465e-03 36 | -1.966838038144251913e-03 37 | 8.145446976554266902e-03 38 | -3.055370059747005047e-03 39 | -1.066197261013583641e-04 40 | -4.873042858515292883e-03 41 | -2.803334916467894837e-03 42 | 9.120235753216908089e-03 43 | -9.964816948358410503e-03 44 | -4.441770931716985948e-03 45 | 9.415094497399240439e-03 46 | -4.826729929923305983e-03 47 | 8.382986417742080767e-03 48 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/humanoid_gym_episode/termination_stats.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00 2 | 0.000000000000000000e+00 3 | 0.000000000000000000e+00 4 | 0.000000000000000000e+00 5 | 0.000000000000000000e+00 6 | 0.000000000000000000e+00 7 | 0.000000000000000000e+00 8 | 0.000000000000000000e+00 9 | 0.000000000000000000e+00 10 | 0.000000000000000000e+00 11 | 0.000000000000000000e+00 12 | 0.000000000000000000e+00 13 | 0.000000000000000000e+00 14 | 0.000000000000000000e+00 15 | 0.000000000000000000e+00 16 | 0.000000000000000000e+00 17 | 0.000000000000000000e+00 18 | 0.000000000000000000e+00 19 | 0.000000000000000000e+00 20 | 0.000000000000000000e+00 21 | 0.000000000000000000e+00 22 | 0.000000000000000000e+00 23 | 0.000000000000000000e+00 24 | 0.000000000000000000e+00 25 | 0.000000000000000000e+00 26 | 0.000000000000000000e+00 27 | 0.000000000000000000e+00 28 | 0.000000000000000000e+00 29 | 0.000000000000000000e+00 30 | 1.000000000000000000e+00 31 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/walker2d_gym_episode/rewards.txt: -------------------------------------------------------------------------------- 1 | 7.556941536695176431e-01 2 | 6.048748813352271547e-01 3 | 8.333666036272190381e-01 4 | 6.622737839580211672e-01 5 | 5.925046654457777340e-01 6 | 5.342695097864817999e-01 7 | 4.857446108746014124e-01 8 | 3.270445022582162964e-01 9 | 1.967702319321115445e-01 10 | 1.429147239592372665e-01 11 | -7.353250956427251177e-03 12 | -1.426851554989889137e-01 13 | -1.102235630514277198e-01 14 | -2.710113625359167333e-01 15 | -5.472642973916470588e-01 16 | -7.561720157114425467e-01 17 | -5.611010493776282804e-01 18 | -4.443750393645869851e-02 19 | 5.698915484638555906e-02 20 | 3.677870037143108478e-02 21 | 1.862014580500255881e-02 22 | -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/walker2d_gym_episode/state_init.txt: -------------------------------------------------------------------------------- 1 | -4.456399437492168138e-03 2 | 1.254653909372423159e+00 3 | 1.326909455841033571e-03 4 | -2.099826561522917089e-03 5 | -3.975157429138648224e-03 6 | 1.730763480577574877e-03 7 | -1.074232599436323113e-03 8 | 1.698460672884732035e-03 9 | -4.401610312440530290e-03 10 | 2.698724447360188392e-04 11 | -4.597093069736675648e-03 12 | 4.779440751301129199e-03 13 | -3.706325887212549852e-04 14 | 1.296479361191862564e-03 15 | 4.470484310704662782e-03 16 | 1.992778244743646093e-03 17 | -4.652969506727553869e-04 18 | 4.027818579032467657e-03 -------------------------------------------------------------------------------- /noesis/test/src/gym/mujoco/resources/walker2d_gym_episode/termination_stats.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00 2 | 0.000000000000000000e+00 3 | 0.000000000000000000e+00 4 | 0.000000000000000000e+00 5 | 0.000000000000000000e+00 6 | 0.000000000000000000e+00 7 | 0.000000000000000000e+00 8 | 0.000000000000000000e+00 9 | 0.000000000000000000e+00 10 | 0.000000000000000000e+00 11 | 0.000000000000000000e+00 12 | 0.000000000000000000e+00 13 | 0.000000000000000000e+00 14 | 0.000000000000000000e+00 15 | 0.000000000000000000e+00 16 | 0.000000000000000000e+00 17 | 0.000000000000000000e+00 18 | 0.000000000000000000e+00 19 | 0.000000000000000000e+00 20 | 0.000000000000000000e+00 21 | 1.000000000000000000e+00 22 | -------------------------------------------------------------------------------- /noesis/test/src/gym/raisim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # https://bitbucket.org/leggedrobotics/noesis 6 | # 7 | # This software is distributed WITHOUT ANY WARRANTY; without even the 8 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | # See the License for more information. 10 | #============================================================================= 11 | 12 | #== 13 | # Unit tests for RaiSim environments 14 | #== 15 | 16 | message(STATUS "${PROJECT_NAME}: Including tests for RaiSim environments") 17 | 18 | ## MuJoCo wrappers. 19 | set(TEST_RAISIM_SRC 20 | ${CMAKE_CURRENT_SOURCE_DIR}/src/CaplerSimulationTest.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/src/Kinova3SimulationTest.cpp 22 | ) 23 | add_gtest(test_${PROJECT_NAME}_gym_raisim "${TEST_RAISIM_SRC}" noesis::noesis) 24 | 25 | # EOF 26 | -------------------------------------------------------------------------------- /noesis_py/.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | optimize-ast=no 4 | max-line-length=140 5 | contextmanager-decorators=contextmanager-decorators=contextlib.contextmanager,tensorflow.python.util.tf_contextlib.contextmanager 6 | -------------------------------------------------------------------------------- /noesis_py/README.md: -------------------------------------------------------------------------------- 1 | # Noesis Python 2 | 3 | ## Install 4 | 5 | First we must install virtualenv: 6 | ```bash 7 | pip install virtualenv 8 | ``` 9 | 10 | Then we create a virtualenv for Python3 and activate it: 11 | ```bash 12 | virtualenv ~/.virtualenvs/noesis -p /usr/bin/python3.7 13 | source ~/.virtualenvs/noesis/bin/activate 14 | ``` 15 | 16 | Before installing any Python packages, first we must upgrade PIP: 17 | ```bash 18 | pip install -U pip 19 | ``` 20 | 21 | If your machine does not have an NVIDIA graphics card, you can install the CPU-ony version: 22 | ```bash 23 | cd $NOESIS_ROOT/noesis_py 24 | pip install -e .[cpu] 25 | ``` 26 | 27 | And if you do have an NVIDIA GPU, then you can run: 28 | ```bash 29 | cd $NOESIS_ROOT/noesis_py 30 | pip install -e .[gpu] 31 | ``` 32 | 33 | ---- 34 | -------------------------------------------------------------------------------- /noesis_py/bin/tfdevices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ============================================================================== 17 | 18 | """Helper script for checking devices usable by TensorFlow.""" 19 | 20 | from __future__ import absolute_import 21 | from __future__ import print_function 22 | from __future__ import division 23 | 24 | import os 25 | import argparse 26 | from noesis.core import device 27 | 28 | # Reduce the verbosity of the console output 29 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' 30 | 31 | 32 | # Argument parser 33 | def parse_args(): 34 | """ Parses CLI arguments applicable for this helper script 35 | """ 36 | # Create parser instance 37 | parser = argparse.ArgumentParser(description='Display TensorFlow device nodes available on the system.', ) 38 | # Define arguments 39 | parser.add_argument("--cpu", help='Display CPU devices only.', action='store_true') 40 | parser.add_argument("--gpu", help='Display GPU devices only.', action='store_true') 41 | # Retrieve arguments 42 | args = parser.parse_args() 43 | return args 44 | 45 | 46 | # Main function 47 | def main(args): 48 | """ Reports all device nodes available for use with TensorFlow 49 | """ 50 | if args.cpu is True: 51 | print("CPUs: ", device.available_cpus()) 52 | elif args.gpu is True: 53 | print("GPUs: ", device.available_gpus()) 54 | else: 55 | print("ALL: ", device.available_devices()) 56 | 57 | 58 | # Main program entry-point 59 | if __name__ == '__main__': 60 | # Retrieve arguments 61 | ARGS = parse_args() 62 | # Run tensorflow devices check 63 | main(ARGS) 64 | 65 | # EOF 66 | -------------------------------------------------------------------------------- /noesis_py/noesis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Primary package module.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | # NOTE: 1) Currently we lazily import all modules. 23 | # NOTE: 2) In the future we might consider optimizing these. 24 | from noesis.core import * 25 | from noesis.nn import * 26 | from noesis.func import * 27 | from noesis.rl import * 28 | 29 | # EOF 30 | -------------------------------------------------------------------------------- /noesis_py/noesis/core/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Core building-blocks and utilities.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | # Export message logging functions 23 | from noesis.core.message import * 24 | from noesis.core.device import * 25 | from noesis.core.graph import * 26 | from noesis.core.tensor import * 27 | from noesis.core.loss import * 28 | from noesis.core.gradient import * 29 | 30 | # EOF 31 | -------------------------------------------------------------------------------- /noesis_py/noesis/core/device.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Device availability and identification functions""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | from tensorflow.python.client import device_lib 23 | 24 | 25 | def available_devices(): 26 | local_device_protos = device_lib.list_local_devices() 27 | return [x.name for x in local_device_protos] 28 | 29 | 30 | def available_cpus(): 31 | local_device_protos = device_lib.list_local_devices() 32 | return [x.name for x in local_device_protos if x.device_type == 'CPU'] 33 | 34 | 35 | def available_gpus(): 36 | local_device_protos = device_lib.list_local_devices() 37 | return [x.name for x in local_device_protos if x.device_type == 'GPU'] 38 | 39 | 40 | def assert_device_exists(device): 41 | for dev in device_lib.list_local_devices(): 42 | if device == dev.name: 43 | return 44 | # Fall-through means that no valid device matched 45 | raise ValueError("Device '%s' does not exist on current system. Please run available_devices()'." % device) 46 | 47 | 48 | def check_device(device_name): 49 | if device_name == "CPU": 50 | device = available_cpus()[0] 51 | elif device_name == "GPU": 52 | gpus = available_gpus() 53 | if not gpus: 54 | raise ValueError("There are no GPUs available on the current system. Please use '/device:CPU:0' instead.") 55 | else: 56 | device = gpus[0] 57 | else: 58 | assert_device_exists(device_name) 59 | device = device_name 60 | return device 61 | 62 | # EOF 63 | -------------------------------------------------------------------------------- /noesis_py/noesis/core/loss.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """A collection of common loss functions.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | import tensorflow as tf 23 | import tensorflow.compat.v1 as tf1 24 | 25 | 26 | def huber(target, value, extra_cost=0, delta=1e-1, name=None): 27 | with tf.name_scope("huber"): 28 | cutoff_line = tf.constant(value=delta, dtype=target.dtype) 29 | residual = tf.sqrt(tf.reduce_sum(tf.square(target - value), axis=1)) 30 | condition = tf.less(residual, delta) 31 | small_res = 0.5 * tf.square(residual) 32 | large_res = cutoff_line * residual - 0.5 * tf.square(cutoff_line) 33 | return tf.add(tf.reduce_mean(tf.where(condition, small_res, large_res), 0), extra_cost, name=name) 34 | 35 | 36 | def infimum(target, value, extra_cost=0, under_est_error=1e-3, name=None): 37 | with tf.name_scope("infimum"): 38 | residual = target - value 39 | condition = tf.less(residual, 0) 40 | small_res = 0.5 * tf.square(residual) 41 | large_res = under_est_error * residual 42 | return tf.add(tf.reduce_mean(tf.where(condition, small_res, large_res), 0), extra_cost, name=name) 43 | 44 | 45 | def squared(target, value, extra_cost=0, name=None): 46 | with tf.name_scope("squared"): 47 | return tf.add(tf.reduce_mean(tf.square(target - value)), extra_cost, name=name) 48 | 49 | 50 | def squared_clipped(target, value, value_prev, extra_cost=0, clip_range=0.2, name=None): 51 | """ 52 | Clipping-based trust region loss 53 | (https://github.com/openai/baselines/blob/master/baselines/pposgd/pposgd_simple.py) 54 | """ 55 | with tf.name_scope("squared_clipped"): 56 | clipped_value = value_prev + tf.clip_by_value(value - value_prev, -clip_range, clip_range) 57 | loss1 = tf.square(value - target) 58 | loss2 = tf.square(clipped_value - target) 59 | loss = tf.add(0.5 * tf.reduce_mean(tf.maximum(loss1, loss2)), extra_cost, name=name) 60 | return loss 61 | 62 | 63 | # EOF 64 | -------------------------------------------------------------------------------- /noesis_py/noesis/core/message.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Message logging and console output.""" 17 | 18 | import time 19 | import inspect 20 | 21 | from os.path import basename, splitext 22 | from termcolor import colored 23 | 24 | 25 | def __message(level, color, *msg): 26 | """Appends date-time to message and applies colored formatting.""" 27 | module = inspect.getmodule(inspect.stack()[2][0]) 28 | out = "[%s] [%s]: [%s]: " % (level, time.strftime("%Y.%m.%d::%H%M%S"), splitext(basename(module.__file__))[0]) 29 | out += ''.join(msg[0]) 30 | print(colored(out, color)) 31 | # TODO use python.logging to actually log messages and output them to appropriate files 32 | 33 | 34 | def info(*msg): 35 | """Output an INFO (general-purpose) message.""" 36 | __message("INFO", None, msg) 37 | 38 | 39 | def notify(*msg): 40 | """Output a NOTIFICATION message. Indicates correct operation, but should capture users attention.""" 41 | __message("INFO", 'blue', msg) 42 | 43 | 44 | def warn(*msg): 45 | """Output a WARNING message. Indicates possible problem or misbehavior.""" 46 | __message("INFO", 'yellow', msg) 47 | 48 | 49 | def error(*msg): 50 | """Output an ERROR message.""" 51 | __message("INFO", 'red', msg) 52 | 53 | # EOF 54 | -------------------------------------------------------------------------------- /noesis_py/noesis/func/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Modules for constructing abstract functions.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | # NOTE: We currently lazily import all modules. 23 | from noesis.func.policy import * 24 | from noesis.func.value import * 25 | 26 | # EOF 27 | -------------------------------------------------------------------------------- /noesis_py/noesis/nn/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Modules for build neural-network models.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | # NOTE: We currently lazily import all modules. 23 | from noesis.nn.mlp import * 24 | from noesis.nn.deeploco import * 25 | 26 | # EOF 27 | -------------------------------------------------------------------------------- /noesis_py/noesis/rl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Modules for graph construction and python-side interfaces""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | # NOTE: We currently lazily import all modules. 23 | from noesis.rl.dpe import * 24 | from noesis.rl.cpe import * 25 | from noesis.rl.trpo import * 26 | from noesis.rl.ppo import * 27 | 28 | # EOF 29 | -------------------------------------------------------------------------------- /noesis_py/setup.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Noesis Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | 16 | """Installation script for the 'noesis' python package.""" 17 | 18 | from __future__ import absolute_import 19 | from __future__ import print_function 20 | from __future__ import division 21 | 22 | from setuptools import setup, find_packages 23 | 24 | # Minimum dependencies required prior to installation 25 | INSTALL_REQUIRES = [ 26 | # TODO: what else is need here? 27 | ] 28 | 29 | # Dependencies required during setup 30 | SETUP_REQUIRES = [ 31 | # TODO: what else is need here? 32 | ] 33 | 34 | # Required for package testing 35 | TESTS_REQUIRE = [ 36 | 'pytest' 37 | ] 38 | 39 | # Allows the package to install appropriate version of TensorFlow depending on the 40 | # computing resources available 41 | EXTRAS_REQUIRE = { 42 | 'cpu': ['tensorflow==1.15.2', 'tensorflow-probability==0.8'], 43 | 'gpu': ['tensorflow-gpu==1.15.2', 'tensorflow-probability==0.8'], 44 | # TODO: add simulation packages 45 | } 46 | 47 | # Helper scripts provided by this package 48 | SCRIPTS = [ 49 | 'bin/tfdevices' 50 | ] 51 | 52 | # Installation operation 53 | setup(name='noesis-py', 54 | version='0.2.0', 55 | description='Robotic AI using TensorFlow', 56 | url='https://github.com/leggedrobotics/noesis', 57 | author='Robotic Systems Lab, ETH Zurich', 58 | author_email='tsounisv@ethz.ch', 59 | license='Apache 2.0', 60 | keywords=["robotics", "reinforcement learning", "machine learning", "tensorflow"], 61 | packages=[package for package in find_packages() if package.startswith('noesis')], 62 | scripts=SCRIPTS, 63 | install_requires=INSTALL_REQUIRES, 64 | setup_requires=SETUP_REQUIRES, 65 | tests_require=TESTS_REQUIRE, 66 | extras_require=EXTRAS_REQUIRE, 67 | zip_safe=False) 68 | 69 | # EOF 70 | -------------------------------------------------------------------------------- /utils/clang/README.md: -------------------------------------------------------------------------------- 1 | ## Clang Format 2 | 3 | The repository is based on the Google coding guidelines. To ensure, the code follows 4 | the same style and formatting, we use the tool [__Clang-Format__](https://clang.llvm.org/docs/ClangFormat.html). 5 | The configuration settings for Clang is present in the top directory. 6 | 7 | To run the Clang-Format follow the instructions below: 8 | ```bash 9 | # install clang-format 10 | sudo apt-get install clang-format 11 | # make the script executable 12 | chmod +x format.sh 13 | # run on all the C++ files in the directory 14 | ./format.sh 15 | ``` 16 | -------------------------------------------------------------------------------- /utils/clang/format.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script reformats source files using the clang-format utility. 4 | # 5 | # The file .clang-format in this directory specifies the formatting parameters. 6 | # 7 | # Files are changed in-place, so make sure you don't have anything open in an 8 | # editor, and you may want to commit before formatting in case of awryness. 9 | 10 | # Check for path to NOESIS_ROOT 11 | if [ -d "$NOESIS_ROOT" ]; then 12 | ## declare an array variable 13 | declare -a directories=("noesis" "noesis_environments" "noesis_examples") 14 | 15 | for DIRECTORY in "${directories[@]}" 16 | do 17 | echo "Formatting code under $NOESIS_ROOT/$DIRECTORY" 18 | find "$NOESIS_ROOT/$DIRECTORY" \( -name '*.hpp' -or -name '*.cpp' -or -name '*.cc' -or -name '*.cxx' -or -name '*.tpp' \) -print0 | xargs -0 clang-format -style=file -i 19 | done 20 | else 21 | echo "Path of the environment variable NOESIS_ROOT has not been set!" 22 | fi 23 | -------------------------------------------------------------------------------- /utils/install/ubuntu1804/docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #======================================================================================== 13 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 14 | #======================================================================================== 15 | 16 | #== 17 | # Configurations 18 | #== 19 | 20 | # Exits if error occurs 21 | set -e 22 | 23 | #== 24 | # APT dependencies 25 | #== 26 | 27 | # Remove current installation 28 | sudo apt remove docker docker-engine docker.io containerd runc 29 | 30 | # Install system APT dependencies 31 | sudo apt update && sudo apt install -y \ 32 | apt-transport-https \ 33 | ca-certificates \ 34 | curl \ 35 | gnupg \ 36 | lsb-release 37 | 38 | # Add the official docker APT repository 39 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 40 | echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ 41 | $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 42 | 43 | # Install docker and configure the necessary user group 44 | sudo apt update && sudo apt install -y \ 45 | docker-ce \ 46 | docker-ce-cli \ 47 | containerd.io 48 | 49 | # Create the `docker` group and add current user to that group 50 | sudo groupadd docker 51 | sudo usermod -aG docker "$USER" 52 | newgrp docker 53 | 54 | # Check installation 55 | docker run hello-world 56 | 57 | # EOF 58 | -------------------------------------------------------------------------------- /utils/install/ubuntu1804/mujoco.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #======================================================================================== 13 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 14 | #======================================================================================== 15 | 16 | # TODO 17 | 18 | # EOF 19 | -------------------------------------------------------------------------------- /utils/install/ubuntu1804/singularity.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #======================================================================================== 13 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 14 | #======================================================================================== 15 | 16 | #== 17 | # Configurations 18 | #== 19 | 20 | # Exits if error occurs 21 | set -e 22 | 23 | #== 24 | # APT dependencies 25 | #== 26 | 27 | # Install system APT dependencies 28 | sudo apt update && sudo apt install -y \ 29 | build-essential \ 30 | libssl-dev \ 31 | uuid-dev \ 32 | libgpgme11-dev \ 33 | squashfs-tools \ 34 | libseccomp-dev \ 35 | pkg-config 36 | 37 | #== 38 | # Go 39 | #== 40 | 41 | # Download and install GO 42 | PREFIX= 43 | GO_INSTALL_DIR=$HOME/.local 44 | export VERSION=1.11 OS=linux ARCH=amd64 && \ 45 | wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \ 46 | $PREFIX rm -rf "$GO_INSTALL_DIR"/go && 47 | $PREFIX tar -C "$GO_INSTALL_DIR" -xzvf go$VERSION.$OS-$ARCH.tar.gz && \ 48 | rm go$VERSION.$OS-$ARCH.tar.gz 49 | 50 | # Configure binary paths 51 | echo "export GOPATH=$HOME/.go" >> ~/.bashrc && \ 52 | echo "export PATH=$GO_INSTALL_DIR/go/bin:$PATH:$GOPATH/bin" >> ~/.bashrc && \ 53 | source ~/.bashrc 54 | 55 | # Check installation 56 | go version 57 | 58 | #== 59 | # Singularity 60 | #== 61 | 62 | # 63 | UBUNTU=focal 64 | sudo wget -O- http://neuro.debian.net/lists/$UBUNTU.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list && \ 65 | sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 && \ 66 | sudo apt update 67 | 68 | # 69 | sudo apt install -y singularity-container 70 | 71 | # Check installation 72 | singularity --version 73 | 74 | # EOF 75 | -------------------------------------------------------------------------------- /utils/install/ubuntu2004/docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # 8 | # This software is distributed WITHOUT ANY WARRANTY; without even the 9 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | # See the License for more information. 11 | #======================================================================================== 12 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 13 | #======================================================================================== 14 | 15 | #== 16 | # Configurations 17 | #== 18 | 19 | # Exits if error occurs 20 | set -e 21 | 22 | # Default argument values 23 | NVIDIA=false 24 | 25 | # Iterate over arguments list to configure the installation. 26 | for i in "$@" 27 | do 28 | case $i in 29 | --nvidia) 30 | NVIDIA=true 31 | shift # past argument with no value 32 | ;; 33 | *) 34 | echo "[docker install]: Error: Unknown arguments: ${i#*=}" 35 | exit 1 36 | ;; 37 | esac 38 | done 39 | 40 | #== 41 | # APT dependencies 42 | #== 43 | 44 | # Remove existing installations 45 | sudo apt remove docker docker-engine docker.io containerd runc 46 | 47 | # Install system APT dependencies 48 | sudo apt update && sudo apt install -y \ 49 | apt-transport-https \ 50 | ca-certificates \ 51 | curl \ 52 | gnupg \ 53 | lsb-release 54 | 55 | # Add the official docker APT repository 56 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 57 | echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ 58 | $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 59 | 60 | # Install docker APT packages 61 | sudo apt update && sudo apt install -y \ 62 | docker-ce \ 63 | docker-ce-cli \ 64 | containerd.io 65 | 66 | # (Optionally) Install NVIDIA docker support 67 | if [[ ${NVIDIA} == true ]] 68 | then 69 | distribution=$(. /etc/os-release;echo $ID$VERSION_ID) 70 | curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - 71 | curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list 72 | sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit 73 | fi 74 | 75 | #== 76 | # System configurations 77 | #== 78 | 79 | # Create the `docker` group and add current user to that group 80 | sudo groupadd docker 81 | sudo usermod -aG docker "$USER" 82 | newgrp docker 83 | 84 | # Restart the docker service 85 | sudo systemctl restart docker 86 | 87 | # Check installation 88 | docker run hello-world 89 | 90 | # EOF 91 | -------------------------------------------------------------------------------- /utils/install/ubuntu2004/mujoco.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #======================================================================================== 13 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 14 | #======================================================================================== 15 | 16 | # TODO 17 | 18 | # EOF 19 | -------------------------------------------------------------------------------- /utils/install/ubuntu2004/singularity.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #======================================================================================== 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # https://bitbucket.org/leggedrobotics/noesis 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #======================================================================================== 13 | # Authors: Vassilios Tsounis, tsounsiv@ethz.ch 14 | #======================================================================================== 15 | 16 | # Instructions based on https://github.com/hpcng/singularity/blob/master/INSTALL.md 17 | 18 | #== 19 | # Configurations 20 | #== 21 | 22 | # Exits if error occurs 23 | set -e 24 | 25 | #== 26 | # APT dependencies 27 | #== 28 | 29 | # Install system APT dependencies 30 | sudo apt update && sudo apt install -y \ 31 | build-essential \ 32 | uuid-dev \ 33 | libgpgme-dev \ 34 | squashfs-tools \ 35 | libseccomp-dev \ 36 | wget \ 37 | pkg-config \ 38 | git \ 39 | cryptsetup-bin 40 | 41 | #== 42 | # Go 43 | #== 44 | 45 | # Download and install GO 46 | PREFIX= 47 | GO_INSTALL_DIR=$HOME/.local 48 | export VERSION=1.15.8 OS=linux ARCH=amd64 && \ 49 | wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \ 50 | $PREFIX rm -rf "$GO_INSTALL_DIR"/go && 51 | $PREFIX tar -C "$GO_INSTALL_DIR" -xzvf go$VERSION.$OS-$ARCH.tar.gz && \ 52 | rm go$VERSION.$OS-$ARCH.tar.gz 53 | 54 | # Configure binary paths 55 | echo "export GOPATH=$HOME/.go" >> ~/.bashrc && \ 56 | echo "export PATH=$GO_INSTALL_DIR/go/bin:$PATH:$GOPATH/bin" >> ~/.bashrc && \ 57 | source ~/.bashrc 58 | 59 | # Check installation 60 | go version 61 | 62 | #== 63 | # Singularity 64 | #== 65 | 66 | # Installs golangci-lint 67 | curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.21.0 68 | 69 | # Retrieves the Singularity source files 70 | rm -rf ${GOPATH}/src/github.com/sylabs && \ 71 | mkdir -p ${GOPATH}/src/github.com/sylabs && \ 72 | cd ${GOPATH}/src/github.com/sylabs && \ 73 | git clone https://github.com/sylabs/singularity.git && \ 74 | cd singularity && \ 75 | git checkout v3.7.3 76 | 77 | # Builds and installs Singularity 78 | cd ${GOPATH}/src/github.com/sylabs/singularity && \ 79 | ./mconfig -p $HOME/.local --without-suid && \ 80 | cd ./builddir && \ 81 | make && make install 82 | 83 | # Check installation 84 | singularity exec library://alpine cat /etc/alpine-release 85 | 86 | # EOF 87 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.1) 2 | project(anymal_c_simple_description) 3 | 4 | find_package(catkin) 5 | 6 | catkin_package() 7 | 8 | install(DIRECTORY config launch meshes urdf 9 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 10 | ) 11 | 12 | if(CATKIN_ENABLE_TESTING) 13 | find_package(catkin REQUIRED 14 | COMPONENTS 15 | roslaunch 16 | ) 17 | roslaunch_add_file_check(launch/load.launch) 18 | endif() 19 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020, ANYbotics AG. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/README.md: -------------------------------------------------------------------------------- 1 | # ANYmal C Robot Description (URDF) 2 | ## Overview 3 | 4 | This package contains a simplified robot description (URDF) of the [ANYmal C robot](https://www.anybotics.com/anymal) developed by [ANYbotics](https://www.anybotics.com). 5 | 6 | The extended ANYmal C robot description, simulation, and control software is available exclusively to members of the [ANYmal Research community](https://www.anymal-research.org). For more information and membership applications, contact info@anybotics.com. 7 | 8 | **Author & Maintainer: Linus Isler, [ANYbotics](https://www.anybotics.com)** 9 | 10 | [![ANYmal C Robot Description](doc/anymal_c_rviz.png)](doc/anymal_c_rviz.png) 11 | 12 | ## License 13 | 14 | This software is released under a [BSD 3-Clause license](LICENSE). 15 | 16 | 17 | ## Usage 18 | 19 | Load the ANYmal description to the ROS parameter server: 20 | 21 | roslaunch anymal_c_simple_description load.launch 22 | 23 | To visualize and debug the robot description, start the standalone visualization (note that you have to provide the following additional dependencies: `joint_state_publisher`, `robot_state_publisher`, `rviz`): 24 | 25 | roslaunch anymal_c_simple_description standalone.launch 26 | 27 | ### Launch files 28 | 29 | * **`load.launch`:** Loads the URDF to the parameter server. Meant to be included in higher level launch files. 30 | 31 | * **`standalone.launch`:** A standalone launch file that starts RViz and a joint state publisher to debug the description. 32 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/doc/anymal_c_rviz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/doc/anymal_c_rviz.png -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/launch/load.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/launch/standalone.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/base.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/base.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/battery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/battery.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/bottom_shell.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/bottom_shell.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/depth_camera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/depth_camera.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/drive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/drive.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/face.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/face.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/foot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/foot.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/handle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/handle.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/hatch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/hatch.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/hip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/hip.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/lidar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/lidar.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/lidar_cage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/lidar_cage.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/remote.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/remote.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/shank.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/shank.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/thigh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/thigh.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/top_shell.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/top_shell.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/meshes/wide_angle_camera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/anymal/anymal_c_simple_description/meshes/wide_angle_camera.jpg -------------------------------------------------------------------------------- /utils/models/anymal/anymal_c_simple_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | anymal_c_simple_description 6 | 1.0.0 7 | ANYmal C Description Package 8 | 9 | BSD-3 10 | 11 | Linus Isler 12 | Linus Isler 13 | Remo Diethelm 14 | 15 | catkin 16 | 17 | roslaunch 18 | 19 | 20 | -------------------------------------------------------------------------------- /utils/models/capler/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/capler/README.md -------------------------------------------------------------------------------- /utils/models/kinova3/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/README.md -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/base_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/base_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/bracelet_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/bracelet_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/forearm_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/forearm_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/half_arm_1_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/half_arm_1_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/half_arm_2_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/half_arm_2_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/shoulder_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/shoulder_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/spherical_wrist_1_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/spherical_wrist_1_link.STL -------------------------------------------------------------------------------- /utils/models/kinova3/meshes/spherical_wrist_2_link.STL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/models/kinova3/meshes/spherical_wrist_2_link.STL -------------------------------------------------------------------------------- /utils/readthedocs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile clean 16 | 17 | clean: 18 | rm -rf source/doxyoutput/ source/api/ 19 | @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | 21 | # Catch-all target: route all unknown targets to Sphinx using the new 22 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 23 | %: Makefile 24 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 25 | -------------------------------------------------------------------------------- /utils/readthedocs/images/erc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/erc-logo.png -------------------------------------------------------------------------------- /utils/readthedocs/images/fnsnf-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/fnsnf-logo.jpg -------------------------------------------------------------------------------- /utils/readthedocs/images/intel-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/intel-logo.png -------------------------------------------------------------------------------- /utils/readthedocs/images/nccr-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/nccr-logo.jpg -------------------------------------------------------------------------------- /utils/readthedocs/images/noesis-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/noesis-logo.png -------------------------------------------------------------------------------- /utils/readthedocs/images/rsl-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/readthedocs/images/rsl-logo.png -------------------------------------------------------------------------------- /utils/readthedocs/requirements.txt: -------------------------------------------------------------------------------- 1 | # for testing the master branch 2 | # git+git://github.com/svenevs/exhale.git#egg=exhale 3 | # See: https://exhale.readthedocs.io/en/latest/#exhale-version-compatibility-with-python-sphinx-and-breathe 4 | sphinx>=2.0 5 | breathe>=4.13.0 6 | exhale 7 | sphinx_rtd_theme 8 | -------------------------------------------------------------------------------- /utils/readthedocs/source/index.rst: -------------------------------------------------------------------------------- 1 | ================================== 2 | Welcome to Noesis's documentation! 3 | ================================== 4 | 5 | .. image:: ../images/noesis-logo.png 6 | :align: center 7 | 8 | A software for robotic artificial intelligence. Noesis provides a suite of C++ and python libraries, mostly targeting applications of 9 | Reinforcement Learning (RL) in robotics. 10 | 11 | The core of the software suite consists of two components: 12 | 13 | 1. **``noesis``:** A CMake package providing the primary C++ library for the implementations of main infrastructure. 14 | 2. **``noesis_py``:** A ``pip`` package providing the Python back-end for building and generating computation-graphs using TensorFlow. 15 | 16 | In addition, the following packages are also provided: 17 | 18 | 3. **``noesis_environments``:** A CMake package providing C++ wrappers for physics engines, and implementations of RL environments. 19 | 4. **``noesis_agents``:** A CMake package providing C++ library for the runtime implementations of all RL algorithms and relevant components. 20 | algorithms. 21 | 22 | Noesis currently uses ``C++14`` and Python ``3.5.2``. 23 | 24 | Lastly, all C++ components are built using CMake, but also support `catkin `__. 25 | The latter is typically the tool of choice in the robotics community due to the ubiquity of `ROS `__. For python, we use 26 | ``virtualenv`` and ``virtualenvwrapper`` for encapsulating ``pip`` package management on a per-user basis. 27 | 28 | .. toctree:: 29 | :maxdepth: 3 30 | :caption: Table of Contents 31 | :glob: 32 | 33 | pages/* 34 | 35 | api/library_root 36 | -------------------------------------------------------------------------------- /utils/readthedocs/source/pages/Dependencies.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Dependencies 3 | ============ 4 | 5 | Noesis has ``apt``, ``pip`` and source dependencies. 6 | 7 | APT 8 | ~~~ 9 | 10 | All ``apt`` dependencies are installed by the ``install.sh`` script (see 11 | installation instructions below): 12 | 13 | - `GCC 7.3 `__: GNU C/C++ 14 | Compiler (GCC) v7 provided by the advanced Ubuntu toolchain 15 | repository. 16 | - `OpenMP 4.5 `__: 17 | OpenMP 4.5 provided by GCC 7. 18 | - `Boost `__: Free peer-reviewed portable 19 | C++ source libraries. 20 | - `CMake `__: CMake is an open-source, 21 | cross-platform family of tools designed to build, test and package 22 | software. 23 | - `Python 3.5 `__: 24 | Current default version of Python 3.5 provided in Ubuntu 16.04 LTS. 25 | - `SDL2 `__: SDL is a 26 | cross-platform development library providing abstractions based on 27 | OpenGL. 28 | - `SFML `__: Simple and Fast Multimedia 29 | Library used for drawing 2D graphics. 30 | 31 | PIP 32 | ~~~ 33 | 34 | All ``pip`` dependencies are automatically installed when by the 35 | ``noesis_py`` package via the ``install.sh`` script: 36 | 37 | - `TensorFlow Python `__: 38 | Computation using data flow graphs for scalable machine learning. 39 | 40 | Source 41 | ~~~~~~ 42 | 43 | All source dependencies are provided with the source repository in 44 | ``thirdparty/`` directory and are integrated via respective CMake 45 | packages: 46 | 47 | - `Eigen3 `__: Eigen is a C++ 48 | template library for linear algebra: matrices, vectors, numerical 49 | solvers, and related algorithms. 50 | - `TensorFlow C/C++ `__: 51 | CMake package providing the headers and libraries for the C/C++ API 52 | of TensorFlow. 53 | - `TinyXML `__: TinyXML 54 | is a simple, small, minimal, C++ XML parser that can be easily 55 | integrating into other programs. 56 | - `STB `__: STB is a set of 57 | single-file public domain libraries for C/C++. Only the parts for 58 | image processing are used. -------------------------------------------------------------------------------- /utils/workspace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #============================================================================= 2 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 3 | # All rights reserved. 4 | # http://www.rsl.ethz.ch 5 | # 6 | # This software is distributed WITHOUT ANY WARRANTY; without even the 7 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | # See the License for more information. 9 | #============================================================================= 10 | cmake_minimum_required(VERSION 3.10) 11 | project(deepgait_ws) 12 | 13 | # Include our project helper utility 14 | include(ProjectHelper.cmake) 15 | 16 | # Initialize the CMake Project 17 | project_init() 18 | 19 | # Build Options 20 | project_enable_option(TF_USE_GPU) 21 | project_enable_option(TF_USE_IN_SOURCE) 22 | #project_enable_option(Noesis_USE_RAISIM) 23 | #project_enable_option(Noesis_USE_CXX17) 24 | #project_enable_option(Noesis_USE_SIMD) 25 | #project_enable_option(Noesis_USE_TCMALLOC) 26 | #project_enable_option(Noesis_USE_SANITIZERS) 27 | project_enable_option(Noesis_BUILD_TESTS) 28 | 29 | ## TensorFlow 30 | project_add_module(src/tensorflow-cpp/tensorflow) 31 | project_add_module(src/tensorflow-cpp/examples) 32 | 33 | ## MuJoCo 34 | if(Noesis_USE_MUJOCO) 35 | project_add_module(src/mujoco-cpp/mujoco) 36 | project_add_module(src/mujoco-cpp/mujoco_cpp) 37 | endif() 38 | 39 | ## raisim 40 | if(Noesis_USE_RAISIM) 41 | project_add_module(src/raisim/raisimLib) 42 | project_add_module(src/raisim/raisimOgre) 43 | endif() 44 | 45 | ## Noesis 46 | project_add_module(src/noesis/noesis) 47 | project_add_module(src/noesis/examples) 48 | 49 | # THIS STEP IS NECESSARY, DO NOT REMOVE 50 | project_build() 51 | 52 | # EOF 53 | -------------------------------------------------------------------------------- /utils/workspace/bin/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/workspace/bin/.gitkeep -------------------------------------------------------------------------------- /utils/workspace/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/workspace/data/.gitkeep -------------------------------------------------------------------------------- /utils/workspace/lib/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/workspace/lib/.gitkeep -------------------------------------------------------------------------------- /utils/workspace/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #============================================================================= 4 | # Copyright (C) 2023, Robotic Systems Lab, ETH Zurich 5 | # All rights reserved. 6 | # http://www.rsl.ethz.ch 7 | # 8 | # This software is distributed WITHOUT ANY WARRANTY; without even the 9 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | # See the License for more information. 11 | #============================================================================= 12 | 13 | # Configurations 14 | WS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null 2>&1 && pwd )" 15 | echo "[setup.sh]: Activating workspace: ${WS_DIR}" 16 | 17 | # Workspace paths 18 | export WORKSPACE_DIR=${WS_DIR} 19 | export SOURCE_DIR=${WS_DIR}/src 20 | export DATA_DIR=${WS_DIR}/data 21 | export BIN_DIR=${WS_DIR}/bin 22 | export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${WS_DIR}/lib 23 | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${WS_DIR}/lib/lib 24 | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BIN_DIR}/lib 25 | export PATH=${PATH}:${BIN_DIR}/bin 26 | 27 | # EOF 28 | -------------------------------------------------------------------------------- /utils/workspace/src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leggedrobotics/noesis/3828d7555008925f44043e193d2d6ed42aec4093/utils/workspace/src/.gitkeep --------------------------------------------------------------------------------