Simulating Robots in the Cloud with EC2 and O3DE
Develop robots faster by using a simulator to start from a known state, every time.
g5
instances are intended for graphics applications, and come with access to a graphics card.nvidia-smi -q
. If the graphics drivers are installed and working properly, it should print out a lot of information about the available graphics card.1
2
3
4
5
6
7
sudo apt update && sudo apt upgrade -y
sudo apt install -y ubuntu-desktop gdm3 mesa-utils
sudo sed -i s/'#WaylandEnable=false'/'WaylandEnable=false'/g /etc/gdm3/custom.conf
sudo systemctl restart gdm3
sudo nvidia-xconfig --preserve-busid --enable-all-gpus
sudo systemctl isolate multi-user.target
sudo systemctl isolate graphical.target
1
2
3
4
5
6
7
8
9
10
mkdir ~/dcv-install && cd ~/dcv-install
wget https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY
gpg --import NICE-GPG-KEY
wget https://d1uj6qtbmh3dt5.cloudfront.net/2023.1/Servers/nice-dcv-2023.1-16388-ubuntu2204-x86_64.tgz
tar -xvzf nice-dcv-2023.1-16388-ubuntu2204-x86_64.tgz && cd nice-dcv-2023.1-16388-ubuntu2204-x86_64
sudo apt install -y ./nice-dcv-server_2023.1.16388-1_amd64.ubuntu2204.deb
sudo usermod -aG video dcv
# Complete setup with a reboot
sudo reboot
ubuntu
user when it starts up. To do so, we need to edit /etc/dcv/dcv.conf
. The following commands will make the required edits:1
2
3
4
5
6
7
8
9
sudo sed -i s/"#create-session = true"/"create-session = true"/g /etc/dcv/dcv.conf
sudo sed -i s/'#owner = ""'/'owner = "ubuntu"'/g /etc/dcv/dcv.conf
# Also enable clipboard for easier copy/paste
sudo bash -c "cat <<EOF >> /etc/dcv/dcv.conf
[clipboard]
primary-selection-paste=true
primary-selection-copy=true
EOF"
ubuntu
user. If you want to view the result, you can open the file /etc/dcv/dcv.conf
with your favourite text editor.1
2
sudo systemctl enable dcvserver
sudo systemctl start dcvserver
ubuntu
user has no password, which means we can't connect without first setting a password.1
sudo passwd ubuntu
ubuntu
as the user and the password that you set, then continue.1
2
3
4
5
6
7
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update && sudo apt upgrade -y
sudo apt install -y ros-humble-desktop ros-dev-tools
1
2
3
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
source ~/.bashrc
apt
:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo apt install -y ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
ros-${ROS_DISTRO}-ackermann-msgs \
ros-${ROS_DISTRO}-control-toolbox \
ros-${ROS_DISTRO}-nav-msgs \
ros-${ROS_DISTRO}-gazebo-msgs \
ros-${ROS_DISTRO}-vision-msgs \
ros-${ROS_DISTRO}-ur-msgs \
ros-${ROS_DISTRO}-moveit-servo \
ros-${ROS_DISTRO}-moveit-visual-tools \
ros-${ROS_DISTRO}-moveit ros-${ROS_DISTRO}-pilz-industrial-motion-planner \
ros-${ROS_DISTRO}-controller-manager \
ros-${ROS_DISTRO}-ur-client-library \
ros-${ROS_DISTRO}-nav2-common \
ros-${ROS_DISTRO}-navigation2 \
python3-colcon-common-extensions \
python3-vcstool \
python3-rosdep2
rosdep
tool, but first we need to install O3DE and clone the source for the ROS code.1
2
3
4
5
6
7
8
9
10
11
12
13
sudo apt install -y git \
git-lfs \
wget \
cmake \
libstdc++-12-dev \
clang ninja-build \
libglu1-mesa-dev libxcb-xinerama0 \
libxcb-xinput0 libxcb-xinput-dev \
libxcb-xfixes0-dev libxcb-xkb-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libfontconfig1-dev libpcre2-16-0 zlib1g-dev \
mesa-common-dev libunwind-dev \
libzstd-dev
1
2
3
cd ~/Downloads
wget https://o3debinaries.org/stabilization-2409/Latest/Linux/o3de_latest.deb
sudo dpkg -i o3de_latest.deb
1
2
echo 'export WORKDIR=$HOME/o3de-workdir' >> ~/.bashrc
source ~/.bashrc
o3de-extras
repository and a few extra repositories, then register them with the engine. This makes them available for use in any O3DE projects. To download and register the extras, execute the following commands:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Clone repositories
mkdir $WORKDIR && cd $WORKDIR
git clone --branch development https://github.com/RobotecAI/o3de-humanworker-gem.git
git clone --branch development https://github.com/RobotecAI/o3de-ur-robots-gem.git
git clone --branch development https://github.com/RobotecAI/o3de-otto-robots-gem.git
git clone --branch stabilization/2409 --single-branch https://github.com/o3de/o3de-extras
cd o3de-extras
git lfs install
git lfs pull
# Register all gems
cd $WORKDIR
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-extras/Gems/ROS2
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-extras/Gems/WarehouseAssets
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-extras/Gems/WarehouseAutomation
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-humanworker-gem
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-ur-robots-gem
/opt/O3DE/24.09/scripts/o3de.sh register --gem-path o3de-otto-robots-gem
1
2
3
4
5
6
cd $WORKDIR
git clone --branch development https://github.com/RobotecAI/ROSCon2023Demo
cd ROSCon2023Demo
git checkout 3f90b36
git lfs install
git lfs pull
rosdep
to automatically install any final dependencies that we didn't install in the Installing ROS2 section:1
2
3
4
cd ${WORKDIR}/ROSCon2023Demo/ros2_ws
./setup_submodules.bash
rosdep update
rosdep install --ignore-src --from-paths src/Universal_Robots_ROS2_Driver -y
1
2
3
cd ${WORKDIR}/ROSCon2023Demo/ros2_ws
colcon build --symlink-install
source install/setup.bash
o3de
command from this terminal view to open the UI:1
o3de
/home/ubuntu/o3de-workdir/ROSCon2023Demo/Project
and open the project.json
file inside./home/ubuntu/o3de-workdir/ROSCon2023Demo/Project/project.json
file and changing the required version from ==2.0.0
to >=2.0.0
. Once complete, repeat the step of importing the project and it should work correctly.1
2
3
cd ${WORKDIR}/ROSCon2023Demo/ros2_ws
source install/setup.bash
ros2 launch roscon2023_demo ROSCon2023Demo.launch.py