Summer 2022 Internship Project
Project Hermod is a DDS (Distributed Data Service) that models a DDS that would be used for a car system. It utilizes fastDDS framework to create publishers and subscribers to transmit data via topics in real time. Some of the specific component domain being written for the car system are the following:
- Fuel Domain (Fuel spent, Fuel remaining, Low fuel alert, Miles per gallon, etc..)
- Miles Domain (Miles traveled, Miles remaining, Miles per gallon, etc..)
- Trip Domain (Current trip, Trip time, Avg speed, Avg miles per gallon, etc..)
The main purpose of Hermod is to determine if a DDS system can be integrated tested using behave or other similar ATDD system. Future steps to this project would include containerization of each sensor so they could be run on real time linux embedded system boards to test the DDS system functionality in the real world.
Runnable Scripts
- build.sh (Builds both C++ and Python version of the Code)
- lint.sh (Will lint both C++ and Python code for any syntax errors) Requires that cppcheck and flake8 are installed
- doc.sh (Will create an HTML Doc of the code for both C++ and Python) Requires that Doxygen is installed
- formatcode.sh (Will auto format the Python Code to Pep8 standards) Requires that autopep8 and clang-format is installed
- unit-test.sh (Will unit test both C++ and Python code and print the coverage) Requires that pytest and lcov is installed (Might throw an Internal Error check known problems section if it happens)
- InstallQemuPackages.sh (Will install QEMU packages from git repo)
- RunQemuEmulation.sh (Takes two args(.iso path, Image name))
- Python v3.8
- Python Packages
- signal
- thread
- pytest
- coverage
- queue
- sys
- time
- random
- autopep8
- flake8
- Json
- venv (Optional)
- hamcrest (Optional)
- Python Packages
- gcc v11.2.1
- FastDDS C++/Python
- Required by FastDDS to install
- cmake3
- Asio
- pcre2
- vcstool
- softhsm
- colcon
- gradle
- tinyxml2
- swig
- Java JDK 8 with development kit
- automake
- bison, bison-devel, byacc
- Required by FastDDS to install
- Doxygen
- cppcheck
- clang-format
- lcov v1.15-1
The Files below are generated exclusively by the above scripts
- Here are where you can find the files after the scripts are run
- C++ Documentation html:
./Vehicle-C++/Vehicle/Build/html/index.html
- C++ Coverage html:
./Vehicle-C++/Vehicle/Build/Coverage/index.html
- Python Documentation html:
./Vehicle-Python/Build/html/index.html
- Python Coverage html:
./Vehicle-Python/Build/Coverage/index.html
(Error could be caused trying to gen this, read known problems section)
- C++ Documentation html:
- If we had more time we would like to finish containerizing the system so we could separate the publishers and subscribers to different containers to run tests and find bugs.
- We would like to create an install script for the fastDDS setup so anyone who comes to us this won't have to install fastDDS every time onto a new system
- Run the System with real time data from a simulation of a car instead of randomly generated data that its currently using.
- Test the system on real embedded hardware for bugs and for real time integration with real hardware and see how it acts and responds.
- See if using Behave as an ATDD tester would work in-order to use Grekin syntax as per customers request.
The following steps are required to run Hermod.
-
Getting dependencies (the commands below are assuming your using CentOS 7)
-
Cmake3 make default system wide (Assuming you have cmake3 installed)
- Use these following commands
sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \ --slave /usr/local/bin/ctest ctest /usr/bin/ctest \ --slave /usr/local/bin/cpack cpack /usr/bin/cpack \ --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \ --family cmake
sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \--family cmake
- Use these following commands
-
TinyXml2 v9.0.0
- Go to a directory that you want to place all of these download files preferably in the "/home///" location
- Run these commands in order.
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/9.0.0.tar.gz
tar -xvf 9.0.0.tar.gz
cd tinyxml2-9.0.0
mkdir build
cd build/
sudo cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC
sudo cmake3 --build . --target install
-
pcre2 v10.23-2 (dependency for swig)
- Run these commands
sudo su -l #enter into root user
yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/pcre2-utf32-10.23-2.el7.x86_64.rpm
yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/pcre2-devel-10.23-2.el7.x86_64.rpm
exit
#leave root user
- Run these commands
-
Swig v4.0.2
- Go to a directory that you want to place all of these download files preferably in the "/home///" location
- Run these commands in order
yum remove swig
#Only use if you have older version of swig installedvim ~/.bashrc
_ #Add the next two line bellow the user specific aliases and functions then exit vim using :wq_export LD_LIBRARY_PATH=/usr/local/lib/
export LD_LIBRARY_PATH=/opt/rh/httpd24/root/usr/lib64
git clone https://github.com/swig/swig.git
cd swig
./autogen.sh
#requires automake, and yacc (sudo yum install automake
,sudo yum install bison bison-devel byacc
)./configure --prefix=/usr/local
make
sudo make install
swig -version
#check to see if its installed correctly (might have to restart terminal to run command)
-
OpenSSL & PKCS11 & Softhsm v2.1.0-3 & colcon & vcstool
- Directory doesn't matter when installing these dependencies
- Install these dependencies in order
sudo su -l
#enter root useryum install openssl-pkcs11.x86_64
yum install openssl-devel.x86_64
yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/softhsm-devel-2.1.0-3.el7.x86_64.rpm
exit
#leave root userpip3 install -U colcon-common-extensions vcstool --user
-
Gradle v6.9
- Directory doesn't matter when installing these dependencies
- Install these dependencies in order
wget https://services.gradle.org/distributions/gradle-6.9-all.zip
sudo unzip -d /opt/gradle gradle-6.9-all.zip
vim ~/.bashrc
#Add the next line under the user specific aliases and functions area then exit vim using :wqexport PATH=$PATH:/opt/gradle/gradle-6.9/bin
source ~/.bashrc
gradle -version
#To check to see if gradle is working and it version 6.9cd /home/<userID>/.gradle
vim gradle.properties
#Enter the next four lines into the properties file this allows gradle to use the northrop proxy- systemProp.https.proxyHost=contractorproxyeast.northgrum.com
- systemProp.https.proxyPort=80
- systemProp.http.proxyHost=contractorproxyeast.northgrum.com
- systemProp.http.proxyPort=80
-
Asio v1.10
- Use this command to install
sudo yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/a/asio-devel-1.10.8-1.el7.x86_64.rpm
- Use this command to install
-
Python3.8 Development Kit
- Use this command to install
sudo yum install rh-python38-python-devel.x86_64
- Use this command to install
-
-
Installing FastDDS C++
-
FastDDS C++
- Please go to a directory where you want to keep all of your library files for FastDDS C++ ex. /home//dev/ or /home//projects/
- Use these following commands in order
mkdir FastDDS
cd FastDDS
wget https://raw.githubusercontent.com/eProsima/Fast-DDS/master/fastrtps.repos
mkdir src
vcs import src < fastrtps.repos
#if this command doesn't exist make sure your not in root and you - have vcstool installed through pip3colcon build
#If this fails make sure your gcc is version 10.2.1, also make sure Asio is installedvim ~/.bashrc
#Add the next line into your bashrc filesource /home/<location to fast dds folder>/FastDDS/install/setup.bash
#make sure to change location to - the location of the fast dds foldersource ~/.bashrc
-
FastDDS-Gen #Note: If you already installed fastdds-gen then you can skip this step
- Please put this in the same dir as the FastDDS so they are next to each other
- Use these following commands in order
git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git
cd Fast-DDS-Gen
- Note: for the next step to work, you must sudo yum install the following packages:
- java-1.8.0-openjdk.x86_64
- java-1.8.0-openjdk-devel.x86_64
- java-1.8.0-openjdk-headless.x86_64
gradle assemble
vim ~/.bashrc
#Add the next line into your bashrc fileexport PATH=$PATH:/home/<Location to your Fast-DDS-Gen folder>/Fast-DDS-Gen/scripts
#make sure to put in your fast dds gen folder location
You should be able to run the C++ version of Hermod, if you would like to create your own file from scratch you can checkout this link: FastDDS C++ Example
-
-
Install FastDDS Python
- FastDDS Python
- Please go to a directory where you want to keep all of your library files for FastDDS Python ex. / home//dev/ or /home//projects/
- Use these following commands in order
mkdir FastDDS-Python
cd FastDDS-Python
wget https://raw.githubusercontent.com/eProsima/Fast-DDS-python/main/fastdds_python.repos
mkdir src
vcs import src < fastdds_python.repos
#if this command doesn't exist make sure your not in root and you have vcstool installed through pip3colcon build
#If this fails make sure your gcc is version 10.2.1, also make sure Asio is installed, and make sure python38-devel is installedvim ~/.bashrc
#Add the next line into your bashrc file- s
ource /home/<location to fast dds python folder>/FastDDS-Python/install/setup.bash
#make sure to change location to the location of the fast dds folder source ~/.bashrc
- Fixes
- Fix for FastDDS.py not found
- Copy all the files from
/home/<location to FastDDS-Python>/install/fastdds_python/lib64/python3.8/site-packages
and move them to/home/<userID>/.local/lib/python3.8/site-packages/
cp -r /home/<location to FastDDS-Python>/install/fastdds_python/lib64/python3.8/site-packages/* /home/<userID>/.local/lib/python3.8/site-packages/
- Copy all the files from
- Fix for FastDDS.py not found
- FastDDS Python
INTERNALERROR Unsupported hash type(Python)
- If you try to run the unit-test.sh script and it throws and error about INTERNALERROR unsupported hash type then this is a problem with openssl binding with python. To fix this you can uninstall python and openssl and bind them together(Research is needed for this). The method we used was to change two lines of code in the site-packages from the files
/home/<user>/.local/lib/python3.8/site-packages/coverage/misc.py line 226
and/home/<user>/.local/lib/python3.8/site-packages/coverage/files.py line 95
and change the strings that say sha3_256 to sha256. If you don't want to fix this you can just comment out line 14 in unit-testing.sh and uncomment line 15 which will just show what lines weren't hit during the test.