Skip to content

Simulator Setup

gcielniak edited this page Apr 8, 2024 · 13 revisions

For the LIMO simulator, we are going to use the ROS2 Humble release which runs exclusively on Ubuntu 22.04.3 LTS. The simulator can either be deployed using a docker container (this is a default option for the lab PCs) or be installed natively on your PC or a virtual machine (e.g. VMWare Workstation Player), depending on how comfortable you feel with each option and also what PC hardware and OS you have at home. If you struggle with any of the following steps, please ask the staff for help during workshops.

Please ensure that all software updates on your Ubuntu OS are completed before commencing with the rest of the instructions.

Docker

This is probably the easiest option since our docker container includes Ubuntu OS, ROS2 and LIMO robot drivers all pre-installed so after initial deployment the simulator can be used straight away. This setup works best on Linux OS (direct deployment of docker on Windows and MacOS not tested thoroughly) but its performance might be far from optimal on slower PCs. The detailed instructions feature a "plain" CPU image that should run anywhere (also on Windows, Mac etc.) develop/kasm-lcas-jammy.docker-compose.yaml. For improved performance and GPU support, a separate image is provided (requires NVIDIA docker runtime on host) and can be deployed using the following docker-compose file instead: nvidia_develop/kasm-lcas-jammy.docker-compose.yaml.

Native

If a docker installation does not work well for you, or you'd like better performance, you can install the robot simulation software directly on your PC running Ubuntu OS, which works also on VM and when using WSL on Windows (see instructions below).

  • Install ROS2 Humble following this tutorial. Choose the Desktop Install option (ros-humble-desktop).

  • Install all dependencies.

sudo apt-get install -y --no-install-recommends build-essential cmake git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev libglvnd0 libglx0 libegl1 libxext6 libx11-6 libusb-1.0* udev apt-transport-https ca-certificates swig python3-pip ros-humble-ros-base ros-humble-rmw-cyclonedds-cpp ros-humble-rviz2* ros-humble-cartographer* ros-humble-nav* ros-humble-teleop-twist-keyboard ros-humble-joint-state-publisher* ros-humble-robot-state-publisher* ros-humble-xacro ros-humble-imu-tools libgflags-dev nlohmann-json3-dev ros-humble-image-* python3-colcon-common-extensions

git clone https://github.com/YDLIDAR/YDLidar-SDK.git && \
    mkdir -p YDLidar-SDK/build && cd YDLidar-SDK/build &&\
    cmake .. && make -j4 && sudo make install &&\
    cd .. && pip install . && cd .. && rm -rf YDLidar-SDK 

wget -c https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz -O glog-0.6.0.tar.gz &&\
    tar -xzvf glog-0.6.0.tar.gz && cd glog-0.6.0 &&\
    mkdir build && cd build && cmake .. && make -j4 && sudo make install &&\
    sudo ldconfig && cd ../.. && rm -rf glog-*

wget -c https://github.com/Neargye/magic_enum/archive/refs/tags/v0.8.0.tar.gz -O magic_enum-0.8.0.tar.gz &&\
    tar -xzvf magic_enum-0.8.0.tar.gz && cd magic_enum-0.8.0 &&\
    mkdir build && cd build && cmake .. && make -j4 && sudo make install &&\
    sudo ldconfig && cd ../.. && rm -rf magic_enum*

git clone https://github.com/libuvc/libuvc.git &&\
    cd libuvc &&\ 
    mkdir build && cd build && cmake .. && make -j4 && sudo make install &&\
    sudo ldconfig  && cd ../.. && rm -rf libuvc*
  • Setup the ROS2 environment

    echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
    echo "export ROS_DOMAIN_ID=0" >> ~/.bashrc
    echo "export ROS_LOCALHOST_ONLY=1" >> ~/.bashrc
    . ~/.bashrc
    
  • Install the robot simulation software

    git clone https://github.com/LCAS/limo_ros2
    cd limo_ros2 && ./build.sh
    
  • Run the simulator and check that everything is running as expected

    source install/setup.bash
    ros2 launch limo_gazebosim limo_gazebo_diff.launch.py
    

Ubuntu on Windows using WSL2

Author: Jacob Swindell

Windows Subsystem for Linux (WSL) can also be used to run the simulator. If you are running an up-to-date Windows 10 or 11 install then you can install WSL with:

wsl --install Ubuntu-22.04

For the smoothest experience with WSL, it is recommended to use Windows 11. This is because of the ability to display graphics works out of the box on Windows 11. Windows 10 requires an X server to be set up, running and connected to the WSL instance to display the simulator.

Once WSL has been installed then simply follow the instructions above for setting up the simulation natively, using the new WSL Ubuntu instance. If you run into issues with apt being very slow or not installing packages properly then you may have to change your DNS in WSL.