| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This package contains the code for implementing aerostack2 based drone simulation.
Make sure you have docker installed in ubuntu system. If not then follow these steps :
Set up docker's apt repository :
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt updateInstall docker packages :
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginAutostart the docker service :
sudo systemctl status docker
sudo systemctl start dockerTest docker installation by using hello-world image :
sudo docker run hello-worldAllow docker to run without sudo :
sudo usermod -aG docker $USER
sudo rebootAfter this the groups command will also include docker.
You can test it by running the hello-world docker image again without sudo.
If you have a dedicated gpu (NVIDIA), then install nvidia container toolkit :
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg2curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.listsudo sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get updateexport NVIDIA_CONTAINER_TOOLKIT_VERSION=1.18.2-1
sudo apt-get install -y \
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart dockerTest GPU inside container
docker run --rm --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smiReferences :
Clone this repository
git clone https://github.com/ab31mohit/as2_sim.gitCreate docker container for this project
cd as2_sim/ && chmod +x ./docker.sh
./docker.shThis will pull a docker image and create a container named aerostack2-sim.
Install ROS2-humble from here.
Make sure you have sourced the global ros environment and have also installed the ros dev tools using
sudo apt install ros-dev-tools
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrcInstall gazebo ignition fortress :
sudo apt-get update
sudo apt-get install lsb-release gnupg
sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update
sudo apt-get install ignition-fortress
sudo apt-get install ros-humble-ros-gzTest if the gazebo is insalled correctly :
ign gazebo -v 4Install Aerostack2 (from source) :
Install dependencies
sudo apt install git python3-rosdep python3-pip python3-colcon-common-extensions -y
sudo apt install tmux tmuxinator iputils-ping -y
sudo apt install python3-pip
pip3 install PySimpleGUI-4-fossSetup workspace for core aerostack2 packages
mkdir -p ~/aerostack2_ws/src/ && cd ~/aerostack2_ws/src/
git clone https://github.com/aerostack2/aerostack2.git
cd ~/aerostack2_ws
sudo rosdep init
rosdep update
rosdep install -y -r -q --from-paths src --ignore-srcBuild the aerostack2 packages
cd ~/aerostack2_ws
colcon build --symlink-installIn case a particular package build makes your systenm to stuck in between use this command to build that specific package :
export LDFLAGS="-Wl,--no-keep-memory"
MAKEFLAGS="-j1" \
colcon build \
--packages-select as2_behaviors_motion \
--executor sequential \
--parallel-workers 1 \
--cmake-args \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFFMake sure all the packages are built successfully before proceeding to next steps.
Source the aerostack2 workspace so that ros2 can recognize the packages
export "source ~/aerostack2_ws/install/setup.bash" >> ~/.bashrc
source ~/.bashrc
ros2 pkg list | grep as2If this command outputs all the as2 packages, then your source installation is successfull.
Setup Project workspace :
mkdir -p ~/as2_ws/src && cd ~/as2_ws/src
git clone https://github.com/ab31mohit/as2_sim.git && cd ~/as2_ws
colcon build
echo "source ~/as2_ws/install/setup.bash" >> ~/.bashrc
source ~/.bashrcStart gazebo simulation
ros2 launch as2_sim as2_sim.launch.pyThis will launch the drone in an empty gazebo world with all the sensors.
Keyboard teleoperation using existing aerostack2 package
ros2 launch as2_sim as2_teleop.launch.pyCustom Drone Mission using DroneInterface module
ros2 run as2_sim drone_mission_gimbal.pyKeyboard gimbal control
ros2 run as2_sim gimbal_teleop_keyboard.py| Back | FazBrowse Home | New Git URL |