If you are using this simulator in any form in your work, please cite:
Sajid Mohamed, Sayandip De, Konstantinos Bimpisidis, Vishak Nathan, Dip Goswami, Henk Corporaal, and Twan Basten, "IMACS: a framework for performance evaluation of image approximation in a closed-loop system," In 8th Mediterranean Conference on Embedded Computing (MECO), 2019.
More details regarding the IMACS framework can be found here.
Tested with the following versions:
- OS: Ubuntu 18.04
- g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
- llvm: clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
- Halide: checkout branch 810a14b1cef3eb99c4051a2a7ca0c50a9872c37c
- Install dependent libraries
- Install Halide
- Install OpenCV
- Install Eigen
- Install VREP
- Install WEBOTS
- Edit IMACS paths.hpp
Initially, clone this repository:
git clone https://github.com/sajid-mohamed/imacs.git
cd imacs
pwd
For brevity, $(IMACSROOT)=pwd
, i.e. the path to imacs
is called as $(IMACSROOT)
.
The following libraries might be needed for successful execution.
sudo apt-get install libtinfo-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libtiff5-dev
sudo apt-get install libpng-dev
sudo apt-get install jasper
sudo apt-get install libgtk-3-dev
sudo apt-get install libopenblas-dev
sudo apt-get install -y libavcodec-dev
sudo apt-get install -y libavformat-dev
sudo apt-get install libavutil-dev
sudo apt-get install libswscale-dev
sudo apt-get install valgrind
sudo apt-get install cmake
# LibRAW for reversible pipeline
sudo apt-get install -y libraw-dev
# qt4
sudo apt-get install qt4-qmake
sudo apt-get install libqt4-dev
If already installed, only export the paths of Halide/bin
and Halide/distrib/bin
to LD_LIBRARY_PATH
.
Note that for our framework, we use a specific checkout version git checkout 810a14b1cef3eb99c4051a2a7ca0c50a9872c37c
. If you are using the latest version, you may have to adapt the syntax in the source files.
For more details, https://github.com/halide/Halide/blob/master/README.md.
If not already installed, follow the steps below.
- Install CLANG + LLVM
- Make in HALIDE_PATH
- Install Halide
Have clang+llvm-6.0.0 installed. If already installed, you only need to export the paths CLANG and LLVM_CONFIG.
- Download the Pre-Built Binary corresponding to your OS from http://releases.llvm.org/download.html. Recommended version: LLVM 6.0.0
- Extract the downloaded file into the folder
llvm
in$(root)/externalApps
. If this folder does not existmkdir externalApps
.
cd $(IMACSROOT)/externalApps
mkdir llvm
tar -xvf clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C llvm --strip-components=1
You need to export the paths (see FAQ 1
for more details) CLANG=$(IMACSROOT)/externalApps/llvm/bin/clang
and LLVM_CONFIG=$(IMACSROOT)/externalApps/llvm/bin/llvm-config
.
With LLVM_CONFIG
set (or llvm-config
in your path), you should be
able to just run make
in the root directory of the Halide source tree.
We checkout a specific version as the syntax of codes in imacs
is based on this version.
cd $(IMACSROOT)/externalApps
git clone https://github.com/halide/Halide.git
cd Halide
git checkout 810a14b1cef3eb99c4051a2a7ca0c50a9872c37c
make
A successful installation means all the tests are passed.
Halide does not have a make install
. To install we use the following command.
make distrib
This will copy files to the distrib
folder.
Export the Halide bin to the library path, i.e. LD_LIBRARY_PATH=$(ROOT)/externalApps/Halide/distrib/bin:$(ROOT)/externalApps/Halide/bin:$LD_LIBRARY_PATH
.
If OpenCV is not already installed, follow the OpenCV installation steps from https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html.
If opencv is already installed, you should be able to locate opencv*.pc
file. Make sure the PKG_CONFIG_PATH
points to the file location for opencv*.pc
.
cd $(IMACSROOT)/externalApps
git clone https://gitlab.com/libeigen/eigen.git
Download the linux version from https://coppeliarobotics.com/downloads.
cd $(IMACSROOT)/externalApps
mkdir vrep
tar -xvf CoppeliaSim_Edu_V*.tar.xz -C vrep --strip-components=1
Generally for local tar file:
tar -xvf FILENAME -C FOLDER --strip-components=1
You can install webots using snap.
sudo apt install snap
sudo snap install webots
Webots is installed in /snap/webots/current
.
Please change paths relative to your own system in the following files
$(IMACSROOT)/src/paths.hpp
$(IMACSROOT)/src/Profiling/demosaic-profiling/Makefile
$(IMACSROOT)/src/ReversiblePipeline/Makefile
$(IMACSROOT)/imacs_vrep_framework.pro
$(IMACSROOT)/imacs_webots_framework.pro
To start IMACS
bash imacs.sh
Follow the instructions.
To speed-up simulation time in webots, you can disable rendering. In the Webots window, go to the View dropdown menu, and uncheck Rendering (or just use Ctrl+4).
- The controller needs to be designed separately from this toolchain.
In the current framework, we use a lane keeping assist system (LKAS) example.
The controller for this is implemented insrc/lateralController/
.
The currentlateralControl*.*
files implement a lateral controller with sensor-to-actuator delay less than or equal to sampling period. This means that there is one augmented system state.
If you want to implement a new controller, e.g. pipelined controller, LQG controller, etc., you need to write your own code forlateralControl*.cpp
andlateralControl*.hpp
. Further, if delay > period, theactuate_steering_angle
inmain_IMACS_*.cpp
needs to be updated correctly considering the timing. It is recommended to check to the main loop timing inmain_IMACS_*.cpp
.
The main page of the doxygen documentation is ~/imacs/doc/mainpage.dox
.
The settings for the doxygen documentation is located at ~/imacs/doc/Doxyfile
.
You can generate doxygen documentation for IMACS code using the following command.
make doc
This will generate a doxygen_output
folder inside doc.
The entire doxygen documentation can be opened in a webpage by opening ~/imacs/doc/doxygen_output/html/index.html
.
To clean the documentation,
make clean_doc
If you want to change the VREP/WEBOTS scene to simulate, follow the instructions in imacs.sh
.
- Copy the scene (e.g.
*.ttt
) to~/imacs/vrep_scenes
folder. - In
imacs.sh
, add an additional option. The following line opens a new vrep scene from:
gnome-terminal -- sh -c 'cd externalApps/vrep; ./coppeliaSim.sh ../../vrep_scenes/`*.ttt`; exec bash'
- Copy the scene (e.g.
*.wbt
) to~/imacs/webots_scenes
folder. - In
imacs.sh
, add an additional option. The following line opens a new webots scene from:
gnome-terminal -- sh -c 'cd webots_scenes; webots `*.wbt`; exec bash'
cd
sudo gedit .bash_profile
Add the export path commands in `.bash_profile' as shown below.
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
Save and close .bash_profile
. Then, open .bashrc
.
sudo gedit .bashrc
Add the following line at the end of .bashrc
.
source ~/.bash_profile
Save and close the file. Now, the paths should be exported everytime you open a terminal.
Disable 3D Rendering and increase basicTimeStep
when possible.
- In the Webots window, go to the View dropdown menu, and uncheck Rendering (or just use Ctrl+4).
- Open in a text editor
~/imacs/webots_scenes/*.wbt
. Change "basicTimeStep" to GCF(period, delay) in ms.