Setting Up the Agipix Simulation Environment
Prerequisites for host PC
- Ubuntu 20.04/22.04 Operating System
- NVIDIA GPU (RTX 2070 or higher)
- NVIDIA GPU Driver (recommended version 525.85)
Optional Docker
All the deployment is dockerised Setup Docker
- branch
agipix-hard
for Hardware - Branch
agipix-sim
for Software
ROS2 Humble
Follow the latest instructions at the official page
tmux
sudo apt install tmux
cd && git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
if you are new to tmux or not already familiar wit tmux
wget https://raw.githubusercontent.com/SasaKuruppuarachchi/SasaKuruppuarachchi/main/.tmux.conf -P ~/
go to .tmux.conf and edit line 12 “set -g prefix `”. This charactor “`” depends on your keyboard layout.
Nucleus Server
Download and install Omniverse Launcher and install Nucleus Server Go to the library and install ISAACSIM.
Enable ROS2 extension
Open IsaacSIM > Window > Extension > ROS2 bridge – enable (Autoload)
Installing Qgroundcontrol (for PX4 based implementations)
Follow the latest instructions at the official page
Installing docker
Follow the latest instructions at the official docker page
Installing Portainer CE
Portainer CE is an open-source GUI for creating and managing docker containers. Install it following these instructions
Installing Nvidia Docker
Install the Nvidia Container toolkit with These Instructions
PX4 firmware
# Linux packages
sudo apt install git make cmake python3-pip
# Python packages
pip install kconfiglib jinja2 empy jsonschema pyros-genmsg packaging toml numpy future
cd $HOME
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot
make px4_sitl_default none
if PX4 launched properly you can exit out of it. For further information visit here
To synchronise the time stamps with the simulator we need to set the parameter UXRCE_DDS_SYNCT to false
. To do that,
- Open the rcS file at
/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/rcS
- Paste the following line before ´#Autostart ID´
param set-default UXRCE_DDS_SYNCT 0
- Rebuild the firmware
cd $HOME cd PX4-Autopilot make px4_sitl_default none
- Make sure to set the parameter
use_sim_time
(of each ROS2 node) totrue
Pegusus simulaotor
Add the following lines to your ~/.bashrc or ~/.zshrc file.
# Isaac Sim root directory
export ISAACSIM_PATH="${HOME}/.local/share/ov/pkg/isaac_sim-4.1.0"
# Isaac Sim python executable
alias ISAACSIM_PYTHON="${ISAACSIM_PATH}/python.sh"
# Isaac Sim app
alias ISAACSIM="${ISAACSIM_PATH}/isaac-sim.sh"
# Change {user} accordingly
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/{user}/.local/share/ov/pkg/isaac_sim-2023.1.1/exts/omni.isaac.ros2_bridge/humble/lib
Installing the extension as a library
# Go to the repository of the pegasus simulator
cd PegasusSimulator
# Go into the extensions directory
cd extensions
# Run the pip command using the built-in python interpreter
ISAACSIM_PYTHON -m pip install --editable pegasus.simulator
[!NOTE] For the first time, launching Isaac Sim takes a very long time. Isaac Sim must be fully launched to spawn the robot.
Enabling Pegasus Simulator in Isaacsim (First Operation)
-
Launch
ISAACSIM
application. -
Open the Window->extensions on the top menubar inside Isaac Sim.
-
On the Extensions manager menu, we can enable or disable extensions. By pressing the settings button, we can add a path to the Pegasus-Simulator repository.
-
The path inserted should be the path to the repository followed by
/extensions
. -
After adding the path to the extension, we can enable the Pegasus Simulator extension on the third-party tab.
When enabling the extension for the first time, the python requirements should be install automatically for the build in
ISAACSIM_PYTHON
, and after a few seconds, the Pegasus widget GUI should pop-up.
-
The Pegasus Simulator window should appear docked to the bottom-right section of the screen.
Installation - Docker contrainer
- Set your workspace definitions and Clone the repo to your ros2 workspace. replace “your_branch” with “agipix_sim” for the drone
echo "export WORKSPACES_DIR='/home/sasa/workspace'" >> ~/.bashrc echo "export ISAAC_ROS_DEV_DIR='/home/sasa/workspace/raicam-ros'" >> ~/.bashrc source ~/.bashrc cd $ISAAC_ROS_DEV_DIR && git clone https://github.com/RAICAM-EU-Project/isaac_ros_common.git -b your_branch # set up DDS for ROS2 communication cd $WORKSPACES_DIR && mkdir dds && cd dds git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git # Set up control stack cd $WORKSPACES_DIR && mkdir agipix_control && cd agipix_control git clone https://github.com/SasaKuruppuarachchi/px4_ros2_offboard.git git clone https://github.com/PX4/px4_msgs.git git clone https://github.com/SasaKuruppuarachchi/agipix_user_interfaces.git
- First run of the Docker container
# this will start the compose the docker container and start it. First run might take up to 15 Minutes cd $WORKSPACES_DIR/raicam-ros/src/isaac_ros_common/scripts/ && ./run_dev.sh cd /workspaces/dds/Micro-XRCE-DDS-Agent/ mkdir build && cd build cmake .. make sudo make install sudo ldconfig /usr/local/lib/ cd /workspaces/agipix_control && colcon build source /workspaces/agipix_control/install/setup.bash
Running the Simulation
- Open a new terminal to launch the simulator
cd $ISAAC_ROS_DEV_DIR/src/isaac_ros_common/ && ./run_sim.sh # press ENTER after moving to the right pane to launch IsaacSim
- In a new terminal run the docker container
source /workspaces/agipix_control/install/setup.bash # this will run the control stack on docker cd /workspaces/agipix_control/src/px4_ros2_offboard/tmux/ && ./start.sh
- Controlling the drone
Follow the instructions in the top right pane of docker tmux window
-
Opening the UI
- Open up a Foxglow account and bavigate to the dashboard
- Open connection with “ws://localhost:8765”
Now we are ready for autonomy setup. See Instructions to continue.