Main repository to setup the Maila project. The Maila project wants to build an autonomous car model on top of a traxxas summit rc car
                o       o
                 \_____/
                 /=O=O=\     _______
                /   ^   \   /\\\\\\\\
                \ \___/ /  /\   ___  \
                 \_ V _/  /\   /\\\\  \
                   \  \__/\   /\ @_/  /
                    \____\____\______/- 
Docker. To intall Docker follow the procedure reported here
 - 
Vcstool is a version control system (VCS) tool, designed to make working with multiple repositories easier. link
sudo pip install vcstool
 - 
Install Visual Studio Code
 
There is a handy installation script that clones the repository list contained in .maila.repos, install the necessary Visual Studio Code extension and load the environment. If an src folder already exist in the repository the clone step is skipped.
cd scripts/
./init.shThe remove_envoronment.sh script contains function to ease the process of running the docker image realized to support the development of the Maila software. There are 2 ways to interact with the system
- 
using visual studio code: here visual studio code will run the docker image and eventually we can use external terminal to connect to this images. For this just open vs-code in the workspace directory and let the ms-vscode-remote.remote-containers code extension to build and start the container for you.
code ./
 - 
manual: we can start the container manually. At first
source remote_environment.shthis will load a set of bash function that will speed up the process and then:d_buildto build the imaged_runto run the image in a container
 
When you have a running instance of the development docker when source  emote_environment.sh  the script will automatically attach to the running container. Alternatively if the source were done before running the container you could also use the function d_attach to attach to a running container
When attaching to the docker console a set of aliases are loaded to ease the development
MAILA_cd=cd <maila>/MAILA_cds=cd <maila>/srcMAILA_cdd=cd <maila>/develMAILA_cdi=cd <maila>/install
MAILA_buildbuild the codeMAILA_force_cleanclean the project
MAILA_sourcesource the MAILA environment
To load the project aliases, the ros packages and environment variables run:
. load_env.shIf you want to automatically source the maila environment add the step on~/.bashrc .
- for C++ .clang-format credits to DavetColemna link
 
f7build all the packages
Build code
colcon build --symlink-install --cmake-args '-DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'Run test
colcon test
colcon test-resulthttps://answers.ros.org/question/325019/is-there-a-clang-format-file-for-ros-2/
(ref: https://itsfoss.com/install-ubuntu-server-raspberry-pi/)
- 
Write SD Card
 - 
change file "system-boot/network-config" and add wifi SSID and password
 
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "EssePi_24":
      password: "your_wifi_password"- change hostname to "maila-raspi" (ref: https://www.cyberciti.biz/faq/ubuntu-20-04-lts-change-hostname-permanently/)
 
sudo hostnamectl set-hostname maila-raspi
sudo reboot- change password to "ubuntu:ubuntu" (ref: https://www.cyberciti.biz/faq/change-a-user-password-in-ubuntu-linux-using-passwd/)
 
sudo passwd ubuntu
----
sudo reboot- installing docker (ref: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04)
 
sudo apt update
sudo dpkg --configure -a
sudo apt upgrade
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
sudo usermod -aG docker ${USER}
sudo reboot(ref: https://lexruee.ch/setting-i2c-permissions-for-non-root-users.html)
- software
 
sudo apt-get install -y i2c-tools- setup i2c user permission
 
ls /dev/i2c-1 -l
sudo chown :ubuntu /dev/i2c-1
sudo chmod g+rw /dev/i2c-1- add udev rule
 
su root
echo 'KERNEL=="i2c-[0-9]*", OWNER="ubuntu", GROUP="ubuntu", MODE="0660"' >> /etc/udev/rules.d/90-local_ubuntu_group.rules- reboot and test it
 
i2cdetect -y 1- setup i2c user permission on the pc and then starts the container
 
ls /dev/input -l
sudo chown :ubuntu /dev/input/js0- if container is already started
 
ls /dev/input -l
sudo chown :snail /dev/input/js0(ref: https://www.raspberrypi.org/forums/viewtopic.php?t=262264) (ref: https://www.cactusvpn.com/tutorials/how-to-set-up-softether-vpn-client-on-linux/) (ref: isc-dhcp-client)
- download softether vpn server
 
cd ~
sudo apt update
sudo apt install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
git clone https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.git
cd SoftEtherVPN_Stable
# ./configure # error during make "-m64 unrecognized", installing as 32bit
cp src/makefiles/linux_32bit.mak Makefile
make -j4
sudo make -j4 install- create file for autoexecution at startup (ref; https://linuxconfig.org/how-to-run-script-on-startup-on-ubuntu-20-04-focal-fossa-server-desktop)
 
sudo nano /etc/systemd/system/softether.servicewith text:
[Unit]
After=network.service
[Service]
ExecStart=/usr/bin/vpnserver start
RemainAfterExit=yes
[Install]
WantedBy=default.target- set as executable
 
sudo chmod 664 /etc/systemd/system/softether.service- enable service
 
sudo systemctl daemon-reload
sudo systemctl enable softether.service- settings of VPN server (via manager on windows)
 
vpn server maila-raspi
address: 192.168.25.60
https port: 5555
manager port: 443
admin user: maila
admin password: maila
IP-Sec preshred key: maila
users:
1:1
2:2
3:3
4:4
5:5
raspi:raspi
paoloto:paoloto
valerioma:valerioma
(ref: https://www.cactusvpn.com/tutorials/how-to-set-up-softether-vpn-client-on-linux/) (ref: https://serverfault.com/questions/586870/how-to-script-vpncmd-to-batch-command-connect-disconnect)
- run container
 
docker run --rm -it \
      --cap-add NET_ADMIN \
      --device /dev/net/tun \
      --name maila-dev-container -h maila \
      --user "$(id -u):$(id -g)" \
      --mount type=bind,src="$PWD",dst=/home/snail/Maila \
      -p 2222:22 \
      maila/maila-dev- download and install
 
sudo apt install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
git clone https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.git
cd SoftEtherVPN_Stable
# ./configure # error during make "-m64 unrecognized", installing as 32bit
cp src/makefiles/linux_32bit.mak Makefile
make -j4
sudo make -j4 install- start vpn client batch file (https://www.softether.org/4-docs/1-manual/6._Command_Line_Management_Utility_Manual/6.2_General_Usage_of_vpncmd#6.2.3_Command_Line_Parameters_When_Starting_a_vpncmd_Command)
 
nano vpnclient_batchstart.txtwith text:
NicCreate vpnnic
AccountCreate mailavpn /SERVER:192.168.25.60:443 /HUB:"DEFAULT" /USERNAME:"raspi" /NICNAME:"vpnnic"
AccountPassword mailavpn /PASSWORD="raspi" /TYPE="standard"
AccountConnect mailavpn
sudo vpnclient start
sudo vpncmd localhost /client /in:vpnclient_batchstart.txt
sudo apt install -y isc-dhcp-client
sudo /usr/sbin/dhclient- test it!
 
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener