ami-iit / paper_ramadoss_2022_humanoids_human-base-estimation

[Humanoids 2022] https://ieeexplore.ieee.org/abstract/document/10000199
BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

Impossible to load irrlicht device (MacOS) #3

Open lrapetti opened 2 years ago

lrapetti commented 2 years ago

Hi @prashanthr05, I have tried to run the docker image on my laptop (MacOS 11.3.1), but I am getting a Segmentation Fault with the following error displayed

Screenshot 2022-11-30 at 12 05 53 (2)

I am not sure if it corresponds to the "known issue" mentioned in the readme, and in case what is your suggestion?

prashanthr05 commented 2 years ago

Ciao @lrapetti! Thanks for reporting this error in an issue. yes, this is exactly the same thing that corresponds to the known issue mentioned in the README.

For this what I did was not run Docker Desktop GUI,

Instead, I ran the docker Daemon on Linux using sudo to give root privileges. (Could you report the equivalent mac commands so I can update the README)

sudo dockerd 

and then I ran the docker run command also using sudo.

sudo docker run -it --net=host --env="DISPLAY=$DISPLAY"  --volume="/tmp/.X11-unix:/tmp/.X11-unix" ghcr.io/ami-iit/human-base-estimation-docker:latest

By doing this, things should work fine. But then I am not sure if there are better alternatives to this.

traversaro commented 2 years ago

@lrapetti can you try to install xquartz and launch it?

An alternative may be to avoid use a irrlicht device that uses the xserver, @prashanthr05 here for what you are using irrlicht? Saving images to a file/movie?

prashanthr05 commented 2 years ago

It's for visualizing the output trajectory using iDynTree Visualizer as the experiment runs in the background.

traversaro commented 2 years ago

@lrapetti some references:

In general, I would first try glxgears to check if it is working, and once that is working I would try the irrlicht visualizer.

lrapetti commented 1 year ago

I try to document here for reference what I have tested:

But nothing worked out

prashanthr05 commented 1 year ago

I don't have a solution for this at the moment. I would suggest following the manual instructions below forgoing the Docker-based launching, and instead preparing the environment in the host system itself.

  1. Install tmuxinator to manage multiple shell sessions
brew install tmuxinator
# in linux, run 
# sudo apt install tmuxinator
  1. Install Mambaforge and run init to add conda and mambaforge to the path by automatically applying changes to the .bashrc equivalent (Please ignore this step if you already have Mambaforge setup in your system),
# Download
curl -LO https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh

# Install with default options
sh ./Mambaforge-$(uname)-$(uname -m).sh -b

# init conda and mambaforge
~/mambaforge/condabin/conda init
~/mambaforge/condabin/mamba init
  1. Create a virtual environment
mamba create -n humanoids22 python=3.8
  1. Clone this repository in a workspace folder of your choice and install dependencies from the deps/robotology-deps.yml into the virtual environment and copy the tmux config file and datasets to given locations,
git clone https://github.com/ami-iit/paper_ramadoss_2022_humanoids_human-base-estimation
cd paper_ramadoss_2022_humanoids_human-base-estimation

# update the virtual environment and remove unwanted files to keep the size small
mamba env update --name humanoids22 --file deps/robotology-deps.yml && \
mamba clean --tarballs --index-cache --packages --yes && \
find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete && \
mamba clean --all --yes

# activate environment
mamba activate humanoids22

# copy the tmuxinator config (create the .config/tmuxinator folder in home if it is not created automatically)
cp conf/tmux-humanoids.yml ~/.config/tmuxinator/humanoids22.yml
  1. Clone KinDynFusion repo in desired location and install
git clone https://github.com/ami-iit/kindynfusion
git fetch origin humanoids2022:humanoids2022
git checkout humanoids2022
cd kindynfusion/src/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release \
      -DALLOW_IDL_GENERATION=ON \
      -DCMAKE_INSTALL_PREFIX=<where-you-want-to-install> ..
make && make install
  1. Add KinDynFusion library and binaries to path
export KinDynFusion_DIR=<where-you-installed-kindynfusion>
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:${KinDynFusion_DIR}/share/yarp
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${KinDynFusion_DIR}/lib

# to check if correctly, installed run
yarpdev --list | grep WholeBodyKinematics

# this should print
#[INFO] |yarp.dev.Drivers| Device "WholeBodyKinematicsDevice", available on request (found in <where-you-installed-kindynfusion>/lib/yarp/WholeBodyKinematicsDevice.so library).
#[INFO] |yarp.dev.Drivers| Device "WholeBodyKinematicsLogger", available on request (found in <where-you-installed-kindynfusion>/lib/yarp/WholeBodyKinematicsLogger.so library).
#[INFO] |yarp.dev.Drivers| Device "WholeBodyKinematicsRemapper", available on request (found in <where-you-installed-kindynfusion>/lib/yarp/WholeBodyKinematicsRemapper.so library).
#[INFO] |yarp.dev.Drivers| Device "WholeBodyKinematicsVisualizerDevice", available on request (found in <where-you-installed-kindynfusion>/lib/yarp/WholeBodyKinematicsVisualizerDevice.so library).

# Also add `yarp` and `human-gazebo` to YARP_DATA_DIRS
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:~/conda/envs/humanoids22/share/yarp:~/conda/envs/humanoids22/share/human-gazebo
  1. Change the paths in the humanoids22.yml, change <path-to-paper-repo> and <paper-to-kindynfusion-repo> with correct paths.
name: humanoids22
root: ~

windows:
  - server-and-player:
      layout: main-vertical
      panes:
        - sleep 3; yarp wait /HDE/WholeBodyKinematicsWrapper/state:o; yarprobotinterface --config wbkvisualizer_humanoids2022.xml
        - yarp server --write
        - sleep 3; yarp wait /yarpdataplayer/rpc:i; echo "load <path-to-paper-repo>/dataset/walk2" | yarp rpc /yarpdataplayer/rpc:i; yarp wait /HDE/WholeBodyKinematicsWrapper/state:o; echo "play" | yarp rpc /yarpdataplayer/rpc:i; echo "pause" | yarp rpc "/yarpdataplayer/rpc:i"
        - sleep 3; yarp wait /iFeelSuit1/WearableData/data:o; yarprobotinterface --config humanoids2022.xml
        - sleep 3; yarp wait /robot; yarpdev --device transformServer --ROS::enable_ros_publisher 0 --ROS::enable_ros_subscriber 0
        - sleep 3; yarp wait /robot; yarpdataplayer-console --withExtraTimeCol 2
        - sleep 3; yarp wait /WholeBodyKinematicsDevice/rpc:i; sleep 5; bash <path-to-kindynfusion-repo>/src/scripts/TPoseCalibrationAndInitBaseEKF.sh; echo "play" | yarp rpc /yarpdataplayer/rpc:i; sleep 20; tmux kill-session
  1. In a humanoids22 mamba-activated terminal, set the yarp namespace and launch the tmux session,
yarp namespace /robot
tmuxinator start humanoids22

Everything will launch automatically and the session will close at the end of the experiment.