From 6286bbbf4475594cc190886a1483919aa2c0d4a7 Mon Sep 17 00:00:00 2001 From: Wil Date: Tue, 19 May 2020 18:40:15 -0400 Subject: [PATCH 01/12] initial commit of dep changes --- README.md | 6 +++ gymfc/envs/fc_env.py | 4 +- gymfc.ini => gymfc/gymfc.ini | 0 install_dependencies.sh | 73 ++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) rename gymfc.ini => gymfc/gymfc.ini (100%) create mode 100644 install_dependencies.sh diff --git a/README.md b/README.md index ff857c8..6901ae3 100644 --- a/README.md +++ b/README.md @@ -297,4 +297,10 @@ GymFC was developed and currently maintained by [Wil Koch](https://wfk.io). # Contributions Please see [CONTRIBUTING.md](https://github.com/wil3/gymfc/blob/master/CONTRIBUTING.md) before opening an issue or pull request. +If you see the following error message this is because you have not built the +motor model plugins. +``` +[Err] [Plugin.hh:187] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory +``` + diff --git a/gymfc/envs/fc_env.py b/gymfc/envs/fc_env.py index dffe4dc..7d35188 100644 --- a/gymfc/envs/fc_env.py +++ b/gymfc/envs/fc_env.py @@ -179,7 +179,7 @@ def load_config(self, aircraft_config, config_filepath = None): # Priotiry of load, constructor -> environment variable -> default current_dir = os.path.dirname(__file__) - default_config_path = os.path.join(current_dir, "../../gymfc.ini") + default_config_path = os.path.join(current_dir, "../gymfc.ini") if config_filepath: if not os.path.isfile(config_filepath): message = "Error, provided configuration file at constructor but not found {}, aborting.".format(config_filepath) @@ -208,7 +208,7 @@ def load_config(self, aircraft_config, config_filepath = None): # Gazebo configuration self.setup_file = os.path.expandvars(default["SetupFile"]) if not os.path.isfile(self.setup_file): - message = "Could not find Gazebo setup.sh file at '{}'. Typo?".format(self.setup_file) + message = "Could not find Gazebo setup.sh file at '{}'. Confirm SetupFile in gymfc/gymfc.ini is pointing to the correct location.".format(self.setup_file) raise ConfigLoadException(message) self.world = default["World"] self.host = default["Hostname"] diff --git a/gymfc.ini b/gymfc/gymfc.ini similarity index 100% rename from gymfc.ini rename to gymfc/gymfc.ini diff --git a/install_dependencies.sh b/install_dependencies.sh new file mode 100644 index 0000000..4eb0116 --- /dev/null +++ b/install_dependencies.sh @@ -0,0 +1,73 @@ +# Install the dependencies for GymFC on Ubuntu 18.04. +# Requires sudo + + +# Install Dart dependencies +apt-get update && apt-get -y install \ + build-essential \ + cmake \ + pkg-config \ + git \ + libeigen3-dev \ + libassimp-dev \ + libccd-dev \ + libfcl-dev \ + libboost-regex-dev \ + libboost-system-dev + +# Octomap is specified as an optional dependency but building is not linking without it, http://dartsim.github.io/install_dart_on_ubuntu.html +apt-get update && apt-get -y install \ + liboctomap-dev + +# Build Dart +DART_VERSION=v6.7.0 +git clone "https://github.com/dartsim/dart.git" /tmp/dart \ + && cd /tmp/dart && git checkout $DART_VERSION \ + && mkdir build && cd build \ + && cmake .. \ + && make -j4 \ + && make install \ + && rm -rf /tmp/dart + +# Install Gazebo from source following the instructions from here: http://gazebosim.org/tutorials?tut=install_from_source&cat=install + +# Prepare Gazebo +apt-get remove '.*gazebo.*' '.*sdformat.*' '.*ignition-math.*' '.*ignition-msgs.*' '.*ignition-transport.*' + +apt-get update && apt-get -y install \ + lsb-release \ + wget \ + mercurial \ + libboost-all-dev + +sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' \ + && wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - && apt-get update + + +# Install Gazebo dependencies +wget https://raw.githubusercontent.com/ignition-tooling/release-tools/master/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh +GAZEBO_MAJOR_VERSION=10 +ROS_DISTRO=dummy +source /tmp/dependencies.sh && echo ${BASE_DEPENDENCIES} ${GAZEBO_BASE_DEPENDENCIES} ${DART_DEPENDENCIES} | tr -d '\\' | xargs apt-get -y install + + +# Build Gazebo +GAZEBO_VERSION=gazebo10_10.1.0 +hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ + && cd /tmp/gazebo \ + && hg up $GAZEBO_VERSION \ + && mkdir build && cd build \ + && cmake ../ \ + && make -j4 \ + && make install \ + && rm -rf /tmp/gazebo + +# Change default location of gazebo install. +# Currently not used as it is most benificial so you can run multiple gazebo versions. +# However to run gymfc the gymfc.ini must point to the correct setup.sh file. +# cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/local ../ \ + +# Install GymFC dependencies +apt-get update && apt-get install -y \ + python3-pip \ + python3 From 8e30b6deff6a6cd42e14961991619b7704837fcc Mon Sep 17 00:00:00 2001 From: Wil Date: Tue, 19 May 2020 19:07:15 -0400 Subject: [PATCH 02/12] Add missing gymfc.ini file --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index e587155..dc2c3a1 100644 --- a/setup.py +++ b/setup.py @@ -40,6 +40,7 @@ def run(self): license='MIT', packages=find_packages(), package_data={'gymfc': [ + 'gymfc.ini', 'envs/assets/gazebo/models/attitude_control_training_rig/*.config', 'envs/assets/gazebo/models/attitude_control_training_rig/*.sdf', 'envs/assets/gazebo/worlds/*.world', From 97ae608a1d76cd5d70b8e40ac04169be84366b33 Mon Sep 17 00:00:00 2001 From: Wil Date: Tue, 19 May 2020 19:20:29 -0400 Subject: [PATCH 03/12] Update gazebo install path --- install_dependencies.sh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 4eb0116..8016371 100644 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -1,6 +1,18 @@ +#!/bin/bash # Install the dependencies for GymFC on Ubuntu 18.04. # Requires sudo +# This will install Gazebo to GAZEBO_INSTALL_PATH, which by default is /home/$USER/local as recommended by Gazebo. This allows on to easily switch between the debian and source installs by updating the paths written to your bashrc. +GAZEBO_MAJOR_VERSION=10 +GAZEBO_VERSION=gazebo10_10.1.0 +# Running sudo on this script will give $USER as root so get the currently logged in user instead +USERNAME=$(logname) +GAZEBO_INSTALL_PATH=/home/$USERNAME/local +DART_VERSION=v6.7.0 +ROS_DISTRO=dummy +# Compiling Gazebo can be very memory intensive, this variable sets how many jobs are run in parallel. +# If you set this too high make will crash with out of memory errors. +MAKE_JOBS=${MAKE_JOBS:=1} # Install Dart dependencies apt-get update && apt-get -y install \ @@ -20,19 +32,17 @@ apt-get update && apt-get -y install \ liboctomap-dev # Build Dart -DART_VERSION=v6.7.0 git clone "https://github.com/dartsim/dart.git" /tmp/dart \ && cd /tmp/dart && git checkout $DART_VERSION \ && mkdir build && cd build \ && cmake .. \ - && make -j4 \ - && make install \ - && rm -rf /tmp/dart + && make -j$MAKE_JOBS \ + && make install # Install Gazebo from source following the instructions from here: http://gazebosim.org/tutorials?tut=install_from_source&cat=install # Prepare Gazebo -apt-get remove '.*gazebo.*' '.*sdformat.*' '.*ignition-math.*' '.*ignition-msgs.*' '.*ignition-transport.*' +apt-get -y remove '.*gazebo.*' '.*sdformat.*' '.*ignition-math.*' '.*ignition-msgs.*' '.*ignition-transport.*' apt-get update && apt-get -y install \ lsb-release \ @@ -46,26 +56,23 @@ sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_rel # Install Gazebo dependencies wget https://raw.githubusercontent.com/ignition-tooling/release-tools/master/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh -GAZEBO_MAJOR_VERSION=10 -ROS_DISTRO=dummy -source /tmp/dependencies.sh && echo ${BASE_DEPENDENCIES} ${GAZEBO_BASE_DEPENDENCIES} ${DART_DEPENDENCIES} | tr -d '\\' | xargs apt-get -y install +. /tmp/dependencies.sh && echo ${BASE_DEPENDENCIES} ${GAZEBO_BASE_DEPENDENCIES} ${DART_DEPENDENCIES} | tr -d '\\' | xargs apt-get -y install # Build Gazebo -GAZEBO_VERSION=gazebo10_10.1.0 hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ && cd /tmp/gazebo \ && hg up $GAZEBO_VERSION \ && mkdir build && cd build \ - && cmake ../ \ - && make -j4 \ - && make install \ - && rm -rf /tmp/gazebo + && cmake -DCMAKE_INSTALL_PREFIX=$GAZEBO_INSTALL_PATH ../ \ + && make -j$MAKE_JOBS \ + && make install -# Change default location of gazebo install. -# Currently not used as it is most benificial so you can run multiple gazebo versions. -# However to run gymfc the gymfc.ini must point to the correct setup.sh file. -# cmake -DCMAKE_INSTALL_PREFIX=/home/$USER/local ../ \ +# Now update paths to Gazebo can be found +echo "export LD_LIBRARY_PATH=$GAZEBO_INSTALL_PATH/lib:$LD_LIBRARY_PATH" >> ~/.bashrc +echo "export PATH=$GAZEBO_INSTALL_PATH/bin:$PATH" >> ~/.bashrc +echo "export PKG_CONFIG_PATH=$GAZEBO_INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bashrc +. ~/.bashrc # Install GymFC dependencies apt-get update && apt-get install -y \ From 2f27b3cc34c66da81977ab03b04d140215cdbd44 Mon Sep 17 00:00:00 2001 From: Wil Date: Tue, 19 May 2020 19:34:57 -0400 Subject: [PATCH 04/12] Make more generic make flags --- install_dependencies.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index 8016371..eea2e9f 100644 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -10,9 +10,10 @@ USERNAME=$(logname) GAZEBO_INSTALL_PATH=/home/$USERNAME/local DART_VERSION=v6.7.0 ROS_DISTRO=dummy -# Compiling Gazebo can be very memory intensive, this variable sets how many jobs are run in parallel. -# If you set this too high make will crash with out of memory errors. -MAKE_JOBS=${MAKE_JOBS:=1} +# Compiling Gazebo can be very memory intensive, this variable passes additional flags to make for dart and gazebo. +# By default this sets the number of parallel jobs to 1. If you set this too high make will crash with out of memory errors. +# If you have sufficient memory, increase this value for a faster install. +MAKE_FLAGS=${MAKE_FLAGS:=-j1} # Install Dart dependencies apt-get update && apt-get -y install \ @@ -36,7 +37,7 @@ git clone "https://github.com/dartsim/dart.git" /tmp/dart \ && cd /tmp/dart && git checkout $DART_VERSION \ && mkdir build && cd build \ && cmake .. \ - && make -j$MAKE_JOBS \ + && make -j$MAKE_FLAGS \ && make install # Install Gazebo from source following the instructions from here: http://gazebosim.org/tutorials?tut=install_from_source&cat=install @@ -65,7 +66,7 @@ hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ && hg up $GAZEBO_VERSION \ && mkdir build && cd build \ && cmake -DCMAKE_INSTALL_PREFIX=$GAZEBO_INSTALL_PATH ../ \ - && make -j$MAKE_JOBS \ + && make -j$MAKE_FLAGS \ && make install # Now update paths to Gazebo can be found From e4c70e865e9adf4911c8bd12592982059556e550 Mon Sep 17 00:00:00 2001 From: Wil Date: Tue, 19 May 2020 20:46:40 -0400 Subject: [PATCH 05/12] Fix make flags --- install_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index eea2e9f..faa6cd2 100644 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -37,7 +37,7 @@ git clone "https://github.com/dartsim/dart.git" /tmp/dart \ && cd /tmp/dart && git checkout $DART_VERSION \ && mkdir build && cd build \ && cmake .. \ - && make -j$MAKE_FLAGS \ + && make $MAKE_FLAGS \ && make install # Install Gazebo from source following the instructions from here: http://gazebosim.org/tutorials?tut=install_from_source&cat=install @@ -66,7 +66,7 @@ hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ && hg up $GAZEBO_VERSION \ && mkdir build && cd build \ && cmake -DCMAKE_INSTALL_PREFIX=$GAZEBO_INSTALL_PATH ../ \ - && make -j$MAKE_FLAGS \ + && make $MAKE_FLAGS \ && make install # Now update paths to Gazebo can be found From be74cadcb5ef889643c555f4a52ef7f921b85755 Mon Sep 17 00:00:00 2001 From: Wil Date: Wed, 20 May 2020 20:35:44 -0400 Subject: [PATCH 06/12] add plugin dir to ld lib path --- gymfc/envs/fc_env.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gymfc/envs/fc_env.py b/gymfc/envs/fc_env.py index 7d35188..bdbd61d 100644 --- a/gymfc/envs/fc_env.py +++ b/gymfc/envs/fc_env.py @@ -474,6 +474,12 @@ def _start_sim(self): container_env["GAZEBO_RESOURCE_PATH"] += os.pathsep + world_path container_env["GAZEBO_PLUGIN_PATH"] += (os.pathsep + plugin_path + os.pathsep + aircraft_plugin_dir) + # When installing via pip the FlightControllerPlugin plugin is unable + # to find the custom control and sensor messages unless the path is + # included in this variable. It may be due how the library files move + # after they are built. This behavior is not observed when installing + # with pip in edit/develop mode. + container_env["LD_LIBRARY_PATH"] += os.pathsep + plugin_path print ("Gazebo Model Path =", container_env["GAZEBO_MODEL_PATH"]) From 3587b9a000382b7f5ba883fc44cd7be54932e449 Mon Sep 17 00:00:00 2001 From: Wil Date: Wed, 20 May 2020 22:02:18 -0400 Subject: [PATCH 07/12] Update readme --- README.md | 76 ++++++++++++++--------- Dockerfile-demo => docker/demo/Dockerfile | 0 install_dependencies.sh | 0 3 files changed, 45 insertions(+), 31 deletions(-) rename Dockerfile-demo => docker/demo/Dockerfile (100%) mode change 100644 => 100755 install_dependencies.sh diff --git a/README.md b/README.md index 6901ae3..6d3ae53 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,6 @@ Please use the following BibTex entries to cite our work, ![Architecture](https://github.com/wil3/gymfc/blob/master/images/gymfc2-arch.png) -> :warning: **Warning:** Documentation is lagging behind in regards to the new -> framework and installation instructions. Migration to GymFC2 is going to take -> some effort however it provides a sustainable framework moving forward. -> Documentation and additional examples will be added with time. Best bet at -> the moment is to read through the code, python side is in good shape, c++ -> needs love. ## Table of contents @@ -90,28 +84,47 @@ Please use the following BibTex entries to cite our work, # Installation -Note, Ubuntu 16.04 LTS and 18.04 LTS are the only OS currently supported. Please submit a PR for the -README.md if you are -able to get it working on another platform. To ensure accurate and stable -simulations it is recommended to use DART with Gazebo. This requires Gazebo to -be installed from source. For more information please see this -[video](https://www.youtube.com/watch?v=d3NyFU0bVT0). We have found these -versions to work well together, -1. Compile and install DART v6.7 from source - [here](https://github.com/dartsim/dart/tree/v6.7.0). -1. Compile and install [Gazebo 10](http://gazebosim.org/tutorials?tut=install_from_source&cat=install). -2. (Optional) It is suggested to set up a [virtual environment](https://docs.python.org/3/library/venv.html). From the project root, - `python3 -m venv env`. This will create an environment named `env` which -will be ignored by git. To enable the virtual environment, `source -env/bin/activate` and to deactivate, `deactivate`. -2. From root directory of this project, `pip3 install .` If you plan to work with the GymFC source code you will want to install it in -development mode, `pip3 install -e .` You will also -need to build the plugin manually by running the script -`gymfc/envs/assets/gazebo/plugins/build_plugin.sh`. -3. Confirm `SetupFile` in `gymfc.ini` is pointing to the correct location. - -## Installation using Docker -This repository includes an experimental docker build that demos the usage of GymFC. +## Quick start +To install GymFC and its dependencies on Ubuntu 18.04 execute, +``` +sudo MAKE_FLAGS=-j4 ./install_dependencies.sh +pip3 install . +``` + +## Dependencies +GymFC runs on Ubuntu 18.04 and uses [Gazebo v10.1.0](http://gazebosim.org/tutorials?tut=install_from_source&cat=install) with [Dart v6.7.0](https://github.com/dartsim/dart/tree/v6.7.0) for the backend simulator. To use Dart with Gazebo, they must be installed from source. For why Gazebo must be used with Dart see this [video](https://www.youtube.com/watch?v=d3NyFU0bVT0). The easiest way to install the dependencies is with the provided `install_dependencies.sh` script. By default it will run `make` with a single job. You can override the `make` flags with the `MAKE_FLAGS` environment variable. Building Gazebo from source is very resource intensive. If you have sufficient memory increase the number of jobs to run in parallel. For example to run four jobs in parallel execute, +``` +sudo MAKE_FLAGS=-j4 ./install_dependencies.sh +``` +Note, this script may take more than an hour to execute. If your build fails +check `dmesg` but the most common reason will be out-of-memory failures. + +## GymFC + +Once the dependencies have been installed execute, +``` +pip3 install . +``` +This will install the Python dependencies and also build the Gazebo plugins and +messages. + +## Developing with GymFC +If you plan to modify the GymFC code you will need to install in +edit/development mode. +``` +pip3 install -e . +``` +You will also have to manually install the Gazebo plugins by executing, +``` +gymfc/envs/assets/gazebo/plugins/build_plugin.sh +``` +If you deviate from this installation instructions (e.g., installing Gazebo in +a different location other than specific in `install_dependencies.sh`), you +may need to change the location of the Gazeob `setup.sh` defined by the +variable SetupFile in `gymfc/gymfc.ini`. + +## Install by Docker +This repository includes an experimental docker build in `docker/demo` that demos the usage of GymFC. It has been tested on MacOS 10.14.3 and Ubuntu 18.04, however the Gazebo client has not been verified to work for Ubuntu. This docker image can help ensure you are running a supported environment for GymFC. @@ -125,7 +138,7 @@ For Ubuntu, install [Docker for Ubuntu](https://docs.docker.com/engine/install/u Build the docker image ```bash -docker build -f Dockerfile-demo . -t gymfc:demo +docker build . -t gymfc:demo ``` This will take a while as it compiles mesa drivers, gazebo and dart. It is recommended to give Docker a large part of the host's resources. All incoming connections will forward to xquartz: @@ -302,5 +315,6 @@ motor model plugins. ``` [Err] [Plugin.hh:187] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory ``` - - +``` +[Err] [DARTJoint.cc:195] DARTJoint: SetAnchor is not implemented +``` diff --git a/Dockerfile-demo b/docker/demo/Dockerfile similarity index 100% rename from Dockerfile-demo rename to docker/demo/Dockerfile diff --git a/install_dependencies.sh b/install_dependencies.sh old mode 100644 new mode 100755 From d58c94c775393e813566b622c87f56d3b7aa32c1 Mon Sep 17 00:00:00 2001 From: Wil Date: Wed, 20 May 2020 22:26:31 -0400 Subject: [PATCH 08/12] Update readme --- README.md | 41 ++++++++++++++++++++++++++++++----------- examples/README.md | 9 +++++++++ 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6d3ae53..141d415 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,12 @@ Note, this script may take more than an hour to execute. If your build fails check `dmesg` but the most common reason will be out-of-memory failures. ## GymFC +(Optional) It is suggested to set up a [virtual environment](https://docs.python.org/3/library/venv.html) to install GymFC into. From the project root run, + `python3 -m venv env`. This will create an environment named `env` which +will be ignored by git. To enable the virtual environment, `source +env/bin/activate` and to deactivate, `deactivate`. -Once the dependencies have been installed execute, +Install GymFC, ``` pip3 install . ``` @@ -120,9 +124,32 @@ gymfc/envs/assets/gazebo/plugins/build_plugin.sh ``` If you deviate from this installation instructions (e.g., installing Gazebo in a different location other than specific in `install_dependencies.sh`), you -may need to change the location of the Gazeob `setup.sh` defined by the +may need to change the location of the Gazebo `setup.sh` defined by the variable SetupFile in `gymfc/gymfc.ini`. +## Verifying install + +GymFC requires an aircraft model (digital twin) to run. The NF1 racing +quadcopter model is available in `examples/gymfc_nf/twins/nf1` if you need a +model for testing. To test everything is installed correctly run, + +``` +python3 tests/test_start_sim.py --verbose examples/gymfc_nf/twins/nf1/model.sdf +``` +If everything is OK you should see the NF1 quadcopter model in Gazebo. + +You will see the following error message because you have not built the +motor model plugins yet. +``` +[Err] [Plugin.hh:187] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory +``` +Also the following error message is normal, +``` +[Err] [DARTJoint.cc:195] DARTJoint: SetAnchor is not implemented +``` + +To use the NF1 model for further testing read examples/README.md. + ## Install by Docker This repository includes an experimental docker build in `docker/demo` that demos the usage of GymFC. It has been tested on MacOS 10.14.3 and Ubuntu 18.04, however the Gazebo client @@ -156,7 +183,7 @@ gymfc:demo \ ``` Replace __ by the external ip of your system to allow gymfc to connect to your XQuartz server and __ to where you cloned the Solo repo. -Take special note that the test_step_sim.py parameters are using the containers +Take special note that the `test_step_sim.py` parameters are using the containers path, not the host's path. @@ -310,11 +337,3 @@ GymFC was developed and currently maintained by [Wil Koch](https://wfk.io). # Contributions Please see [CONTRIBUTING.md](https://github.com/wil3/gymfc/blob/master/CONTRIBUTING.md) before opening an issue or pull request. -If you see the following error message this is because you have not built the -motor model plugins. -``` -[Err] [Plugin.hh:187] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory -``` -``` -[Err] [DARTJoint.cc:195] DARTJoint: SetAnchor is not implemented -``` diff --git a/examples/README.md b/examples/README.md index 4eb0e67..388eb0f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -21,6 +21,15 @@ save Tensorflow checkpoints. In the same virtual environment you use for GymFC, ``` pip3 install . ``` +3. Build the motor models. +``` +cd gymfc_nf/twins/nf1/plugins +clone https://github.com/wil3/gymfc-aircraft-plugins.git +mkdir build +cd build +cmake ../gymfc-aircraft-plugins +make +``` # Aircraft model / digital twin From 1cfd0f0de8cd414de87f5c215588b197d65e13a8 Mon Sep 17 00:00:00 2001 From: Wil Date: Wed, 20 May 2020 22:38:06 -0400 Subject: [PATCH 09/12] update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 141d415..f279687 100644 --- a/README.md +++ b/README.md @@ -139,9 +139,10 @@ python3 tests/test_start_sim.py --verbose examples/gymfc_nf/twins/nf1/model.sdf If everything is OK you should see the NF1 quadcopter model in Gazebo. You will see the following error message because you have not built the -motor model plugins yet. +motor and IMU plugins yet. ``` [Err] [Plugin.hh:187] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory +[Err] [Plugin.hh:187] Failed to load plugin libgazebo_imu_plugin.so: libgazebo_imu_plugin.so: cannot open shared object file: No such file or directory ``` Also the following error message is normal, ``` From f5175fb788043afd5bb5c4d2efd0850c6992ef9b Mon Sep 17 00:00:00 2001 From: Wil Date: Thu, 28 May 2020 23:13:14 -0400 Subject: [PATCH 10/12] Improve installation --- examples/README.md | 3 ++- examples/setup.py | 4 ++-- gymfc/gymfc.ini | 2 +- install_dependencies.sh | 15 +++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/README.md b/examples/README.md index 388eb0f..311067a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -23,8 +23,9 @@ pip3 install . ``` 3. Build the motor models. ``` +mkdir gymfc_nf/twins/nf1/plugins cd gymfc_nf/twins/nf1/plugins -clone https://github.com/wil3/gymfc-aircraft-plugins.git +git clone https://github.com/wil3/gymfc-aircraft-plugins.git mkdir build cd build cmake ../gymfc-aircraft-plugins diff --git a/examples/setup.py b/examples/setup.py index ba486e5..2f10aec 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -5,6 +5,6 @@ author='William Koch', author_email='wfkoch [at] gmail [dot] com', license='MIT', -# packages=find_packages(), - install_requires=['gymfc', 'gym', 'numpy'], + packages=find_packages(), + install_requires=['matplotlib', 'gym', 'numpy'], ) diff --git a/gymfc/gymfc.ini b/gymfc/gymfc.ini index 4c16c0b..62b3c89 100644 --- a/gymfc/gymfc.ini +++ b/gymfc/gymfc.ini @@ -3,7 +3,7 @@ # In most cases this should not be modified [DEFAULT] -SetupFile = $HOME/local/share/gazebo/setup.sh +SetupFile = /usr/local/share/gazebo/setup.sh World = attitude.world Hostname = localhost diff --git a/install_dependencies.sh b/install_dependencies.sh index faa6cd2..e96ec95 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -1,13 +1,11 @@ #!/bin/bash # Install the dependencies for GymFC on Ubuntu 18.04. # Requires sudo -# This will install Gazebo to GAZEBO_INSTALL_PATH, which by default is /home/$USER/local as recommended by Gazebo. This allows on to easily switch between the debian and source installs by updating the paths written to your bashrc. GAZEBO_MAJOR_VERSION=10 GAZEBO_VERSION=gazebo10_10.1.0 # Running sudo on this script will give $USER as root so get the currently logged in user instead USERNAME=$(logname) -GAZEBO_INSTALL_PATH=/home/$USERNAME/local DART_VERSION=v6.7.0 ROS_DISTRO=dummy # Compiling Gazebo can be very memory intensive, this variable passes additional flags to make for dart and gazebo. @@ -15,6 +13,9 @@ ROS_DISTRO=dummy # If you have sufficient memory, increase this value for a faster install. MAKE_FLAGS=${MAKE_FLAGS:=-j1} +# Remove any other installations of Dart installed through debian packages +apt-get remove -y libdart* + # Install Dart dependencies apt-get update && apt-get -y install \ build-essential \ @@ -65,15 +66,13 @@ hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ && cd /tmp/gazebo \ && hg up $GAZEBO_VERSION \ && mkdir build && cd build \ - && cmake -DCMAKE_INSTALL_PREFIX=$GAZEBO_INSTALL_PATH ../ \ + && cmake ../ \ && make $MAKE_FLAGS \ && make install -# Now update paths to Gazebo can be found -echo "export LD_LIBRARY_PATH=$GAZEBO_INSTALL_PATH/lib:$LD_LIBRARY_PATH" >> ~/.bashrc -echo "export PATH=$GAZEBO_INSTALL_PATH/bin:$PATH" >> ~/.bashrc -echo "export PKG_CONFIG_PATH=$GAZEBO_INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bashrc -. ~/.bashrc +# /usr/local/lib is not on the load path by defalut so add it +echo '/usr/local/lib' | sudo tee /etc/ld.so.conf.d/gazebo.conf +sudo ldconfig # Install GymFC dependencies apt-get update && apt-get install -y \ From 7cd63e36aea6f52ef5e9c98a30fa70256f836b3e Mon Sep 17 00:00:00 2001 From: Wil Date: Thu, 28 May 2020 23:33:47 -0400 Subject: [PATCH 11/12] Add default for sample_noise incase it is never overriden --- examples/README.md | 1 + examples/gymfc_nf/envs/base.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 311067a..85a1234 100644 --- a/examples/README.md +++ b/examples/README.md @@ -23,6 +23,7 @@ pip3 install . ``` 3. Build the motor models. ``` +pip3 install . mkdir gymfc_nf/twins/nf1/plugins cd gymfc_nf/twins/nf1/plugins git clone https://github.com/wil3/gymfc-aircraft-plugins.git diff --git a/examples/gymfc_nf/envs/base.py b/examples/gymfc_nf/envs/base.py index b4df0d7..0916069 100644 --- a/examples/gymfc_nf/envs/base.py +++ b/examples/gymfc_nf/envs/base.py @@ -43,7 +43,7 @@ def __init__(self, max_sim_time = 30, state_fn = None): # IMU noise is aircraft specific and thus can not be included as # initial values for the registered environment. After the environment # has been created the user can update this function. - self.sample_noise = None + self.sample_noise = lambda _: 0 def set_aircraft_model(self, model): """Set the aircraft's model.sdf From ffc48c7ffcb5f9d0e3afe7e3ac57a0db95d25276 Mon Sep 17 00:00:00 2001 From: Wil Koch Date: Tue, 2 Jun 2020 21:12:52 -0400 Subject: [PATCH 12/12] Remove sudo from ldconfig --- install_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_dependencies.sh b/install_dependencies.sh index e96ec95..ea27677 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -72,7 +72,7 @@ hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo \ # /usr/local/lib is not on the load path by defalut so add it echo '/usr/local/lib' | sudo tee /etc/ld.so.conf.d/gazebo.conf -sudo ldconfig +ldconfig # Install GymFC dependencies apt-get update && apt-get install -y \