Added repo setup scripts for both the Jetson Nano and Ubuntu 20 x64 Desktop. The installation process is broken into three scripts, install_pc_deps.sh handles dependencies for x64, install_jetson_deps.sh handles dependencies for the Jetson Nano, and install_env_deps.sh handles dependencies that have the same installation process for both aarch64 and x64. To setup the development environment run ONLY ONCE the desired platform's setup script from within the install_scripts/ folder as ./install-<jetson/pc>-deps.sh.
PC Deps
Installs Realsense SDK using apt
Contains commented out commands to install Arduino 2 IDE and Sabertooth library. Transitioned to PlatformIO.
Sets swap to 8GB by default
Jetson Nano Deps
Compiles and Installs Realsense SDK using native usb backend
Adds 16GB of swap
Throttles MAKEFLAGS to 1 processors due to low memory. Closes #7
Environment Deps
Installs ROS 2 Galactic
Installs colcon and rosdep utilities
Sets rosdep to only use galactic distribution
Installs Nav2
Adds sourcing of default colcon workspace path to bashrc
Adds handy build command function to bashrc
Initializes all git submodules
Installs all submodule dependencies using rosdep
Builds dependencies sequentially to decrease load on cpu.
Notes
The installation process should ONLY BE RUN ONCE as the scripts do not check for previous installation attempts.
These scripts are best used within a virtual machine as they can change at any time during the development process from which a new virtual machine should be distributed to the team with the newly configured environment.
From testing, the Jetson will take about 5-6 hours to compile all dependencies and a 4 core 8GB RAM virtual machine can take around 1-2 hours.
Therefore it is best to download a precompiled VMWare virtual machine.
Transition to PlatformIO from Arduino 2 IDE
PlatformIO is much more versatile tool for embedded development. The main benefits are vscode integration, library manager, unit test support, debugging support using external probes, and many other utilities. The MotorDriver folder contains code for the Arduino Due and is not compiled by running the colcon build command. Instead install the PlatformIO vscode extension to initialize the project. The project however also contains a setup script that needs to be run to install extra dependencies call setup_pc.sh from within the MotorDriver/ directory. The MotorDriver code can not be compiled on the Jetson Nano.
In the above project folder structure, all dependencies that can not be managed through PlatformIO are installed in lib except for IRISMotorDriver which is the library that implements the motor driver. The src/ folder contains a typical Arduino like program entry point in main.c. This is the code that will be uploaded to the Arduino Due. The test/ folder contains a testing structure implemented using the Unity testing framework. In here there are two environments, native and due. The native environment is meant for local development (x64) without uploading to the due and the due environment is meant to upload to the physical Arduino Due. test_desktop is meant for code to be tested on the desktop environment when developing a general library. test_embedded is meant for tests that need to be run on the physical hardware. This allows for tests that interact with physical logic such as setting the voltage of a specific digital pin to high or low. test_common is meant for tests that can be run on both the desktop or embedded device. This is typically useful for checking compatibility when implementing a feature.
Extra dependencies
The setup_pc.sh script uninstalls the system's protobuf-compiler and builds from scratch the correct version of protoc that the EmbeddedProto library uses. The EmbeddedProto library is then initialized and the linux udev rules for the PlatformIO extension are added.
Embedded Protobuf Development
The project has a python script, gen_proto.py, that will run before uploading or building code which will regenerate all protobuf files and place them into a generated/ folder. Profobuf is meant to be used for the communication of the MotorDriver and the Jetson. A python implementation to interact with the MotorDriver will need to be implemented.
Notes
It is recommended to install the vscode-proto3 extension.
Most folders contain examples in them to help with getting used to project structure as it is a little mangled together.
It is recommended that a python package made for client side interaction with the MotorDriver be developed. Preferably outside of this project structure. However, these two projects will need to be update with each other.
The Arduino Due should be plugged into the programming port.
Problems
PlatformIO's static code analysis tool is not able to analyze the memory footprint but this feature is not necessarily too important.
There is a problem with the native environment not being able to access the IRISMotorDriver library.
Automatic Environment Setup
Added repo setup scripts for both the Jetson Nano and Ubuntu 20 x64 Desktop. The installation process is broken into three scripts,
install_pc_deps.sh
handles dependencies for x64,install_jetson_deps.sh
handles dependencies for the Jetson Nano, andinstall_env_deps.sh
handles dependencies that have the same installation process for both aarch64 and x64. To setup the development environment run ONLY ONCE the desired platform's setup script from within theinstall_scripts/
folder as./install-<jetson/pc>-deps.sh
.PC Deps
Jetson Nano Deps
Environment Deps
build
command function to bashrcNotes
Transition to PlatformIO from Arduino 2 IDE
PlatformIO is much more versatile tool for embedded development. The main benefits are vscode integration, library manager, unit test support, debugging support using external probes, and many other utilities. The
MotorDriver
folder contains code for the Arduino Due and is not compiled by running thecolcon build
command. Instead install the PlatformIO vscode extension to initialize the project. The project however also contains a setup script that needs to be run to install extra dependencies callsetup_pc.sh
from within theMotorDriver/
directory. The MotorDriver code can not be compiled on the Jetson Nano.Project Structure
In the above project folder structure, all dependencies that can not be managed through PlatformIO are installed in lib except for
IRISMotorDriver
which is the library that implements the motor driver. Thesrc/
folder contains a typical Arduino like program entry point inmain.c
. This is the code that will be uploaded to the Arduino Due. Thetest/
folder contains a testing structure implemented using the Unity testing framework. In here there are two environments, native and due. The native environment is meant for local development (x64) without uploading to the due and the due environment is meant to upload to the physical Arduino Due.test_desktop
is meant for code to be tested on the desktop environment when developing a general library.test_embedded
is meant for tests that need to be run on the physical hardware. This allows for tests that interact with physical logic such as setting the voltage of a specific digital pin to high or low.test_common
is meant for tests that can be run on both the desktop or embedded device. This is typically useful for checking compatibility when implementing a feature.Extra dependencies
The
setup_pc.sh
script uninstalls the system's protobuf-compiler and builds from scratch the correct version of protoc that the EmbeddedProto library uses. The EmbeddedProto library is then initialized and the linux udev rules for the PlatformIO extension are added.Embedded Protobuf Development
The project has a python script,
gen_proto.py
, that will run before uploading or building code which will regenerate all protobuf files and place them into agenerated/
folder. Profobuf is meant to be used for the communication of the MotorDriver and the Jetson. A python implementation to interact with the MotorDriver will need to be implemented.Notes
vscode-proto3
extension.Problems
IRISMotorDriver
library.