From 293bc5019139fc047c748be64f7f71c751c54203 Mon Sep 17 00:00:00 2001 From: Valerio Modugno Date: Wed, 24 May 2023 15:26:42 +0100 Subject: [PATCH] added readme and tested on mambaforge --- .gitignore | 1 + README.md | 18 ++++++++++++++++-- environment.yml | 18 ++++++++++++------ horizon/examples/spot_walk.py | 8 ++++---- setup.py | 2 +- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index be2344cd..468551d1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ venv *.so* *.mat +.vscode/launch.json diff --git a/README.md b/README.md index 0d574da7..d56a89f8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,22 @@ A framework for trajectory optimization and optimal control for robotics based on CasADi ## Install -pip package: ```pip install casadi-horizon``` -conda package: ```conda install horizon -c francesco_ruscelli``` +here we assume that a mambaforge python package manager is already installed in your system. if it is not the case follow the instruction [here](https://github.com/conda-forge/miniforge#mambaforge). +aftert installing mambaforge **assuming that you are in the project folder** you can create the environment for horizon by doing + +``` +mamba env create -f environment.yml +conda activate hori +``` +one important dependencies of horizon is **casadi-kin-dyn**. you need to install it in the environment that you have just created (all the casadi-kin-dyn dependencies are already satisfied in the newly created environment) +to install casadi-kin-dyn follow the instruction provided [here](https://github.com/ADVRHumanoids/casadi_kin_dyn/tree/collision) +after installing casadi-kin-dyn you can install horizon by doing + +``` +pip install -e . +``` +### installing libhsl.so +to do ## Documentations Don't forget to check the [**documentation**](https://advrhumanoids.github.io/horizon/)! diff --git a/environment.yml b/environment.yml index c6f8cc81..1fff2d0c 100644 --- a/environment.yml +++ b/environment.yml @@ -1,11 +1,11 @@ name: hori channels: - conda-forge -- robostack -- francesco_ruscelli +- robostack-staging +#- francesco_ruscelli dependencies: -- python=3.8 -- nodejs=14 +- python=3.9 +- nodejs - jupyterlab=3.2 - yaml-cpp - pip @@ -20,8 +20,14 @@ dependencies: - conda-verify - anaconda-client - ros-noetic-ros-base -- ros-noetic-pinocchio -- francesco_ruscelli::casadi_kin_dyn +- pinocchio +- ros-noetic-tf2-msgs +- ros-noetic-rviz +- ros-noetic-ros-numpy # maybe not necessary (bugged) +- ros-noetic-robot-state-publisher +- catkin_tools +#- ros-noetic-pinocchio +#- francesco_ruscelli::casadi_kin_dyn #- ros-noetic-catkin #- ros-noetic-robot-state-publisher #- ros-noetic-joint-state-publisher diff --git a/horizon/examples/spot_walk.py b/horizon/examples/spot_walk.py index 24cd4d4e..becebe59 100644 --- a/horizon/examples/spot_walk.py +++ b/horizon/examples/spot_walk.py @@ -146,9 +146,9 @@ def z_trj(tau): # contact velocity is zero, and normal force is positive for i, frame in enumerate(contacts_name): - FK = cs.Function.deserialize(kindyn.fk(frame)) - DFK = cs.Function.deserialize(kindyn.frameVelocity(frame, cas_kin_dyn.CasadiKinDyn.LOCAL_WORLD_ALIGNED)) - DDFK = cs.Function.deserialize(kindyn.frameAcceleration(frame, cas_kin_dyn.CasadiKinDyn.LOCAL_WORLD_ALIGNED)) + FK = kindyn.fk(frame) + DFK = kindyn.frameVelocity(frame, cas_kin_dyn.CasadiKinDyn.LOCAL_WORLD_ALIGNED) + DDFK = kindyn.frameAcceleration(frame, cas_kin_dyn.CasadiKinDyn.LOCAL_WORLD_ALIGNED) p = FK(q=q)['ee_pos'] v = DFK(q=q, qdot=q_dot)['ee_vel_linear'] @@ -411,7 +411,7 @@ def set_initial_guess(): ax = fig.add_subplot(gs[i]) ax.set_title('{}'.format(contact)) i += 1 - FK = cs.Function.deserialize(kindyn.fk(contact)) + FK = kindyn.fk(contact) pos = FK(q=solution['q'])['ee_pos'] for dim in range(n_f): ax.plot(np.atleast_2d(cumulative_dt), np.array(pos[dim, :]), marker="x", markersize=3, diff --git a/setup.py b/setup.py index c4bdd00a..25beecea 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ def run(self): long_description_content_type="text/markdown", url="https://github.com/ADVRHumanoids/horizon", packages=['horizon', 'horizon.utils', 'horizon.solvers', 'horizon.transcriptions', 'horizon.examples', 'horizon.ros', 'horizon.rhc', 'horizon.rhc.tasks'], - install_requires=['casadi', 'numpy', 'matplotlib', 'scipy', 'casadi-kin-dyn', 'rospkg'], + install_requires=['casadi', 'numpy', 'matplotlib', 'scipy', 'rospkg'], #for now removed casadi-kin-dyn due to the installation issue related to the library python_requires=">=3.6", cmdclass={'build_py': CustomBuild, 'develop': CustomDevelop},