Skip to content

MAPIRlab/tfg_ros_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tfg_ros_simulation

Minimal ROS2 configuration to operate an autonomous mobile robot on simulation. This repo employs CoppeliaSIM as simulator. It is designed for TFG and TFM students of University of Málaga.

CoppeliSIM: Interface with ROS2

PreRequisites

  1. Install Coppelia Simulator (from the official webpage)
  2. Launch CoppeliaSim from terminal (-h => headless)
    • Check that the ROS2 plugin was loaded (successfully).
    • Plugins are loaded when CoppeliaSim is launched (only on startup).
    • Make sure to source the ROS2 environment prior to running CoppeliaSim (see .bashrc).
    • The plugin is now ready to be used.

ERROR loading Plugin: Manual Compilation Needed (only once)

If the plugin cannot be loaded, then you should recompile it by yourself. Its code is open source and in this repo we provide a copy of it in the pkg "sim_ros2_interface". You will only need to compile it once, after that, you can add a "COLON_IGNORE" to avoid recompilations. Follow this steps:

  • The pluggin is generated by compiling the "/sim_ros2_interface" pkg, using the standard "colcon build". Be sure there is not a "COLCON_IGNORE" file before compilation.

  • (optional) Edit meta/interfaces.txt if you need to include additional ROS2 msgs to be supported by Coppelia.

  • Install xsltproc: sudo apt install xsltproc

  • Export root_dir variable (can be added to .bashrc to make this permanent): export COPPELIASIM_ROOT_DIR=~/path/to/coppeliaSim/folder

  • Compile with colcon build (in case of errors, try the following) ulimit -s unlimited #otherwise compilation might freeze/crash

    colcon build --packages-select sim_ros2_interface --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

  • Add the "COLCON_IGNORE" file to avoid further compilations

  • Copy the just compiled library to Coppelia root directory ros_ws/build/sim_ros2_interface/libsimExtROS2.so -->copy to --> CopeliaRoot Directory

  • Launch again Coppelia from terminal and check that the plugin is loaded when CoppeliaSim starts

ERROR Compiling the Interface

  • The sim_ros2_interface pkg requires a large amomunt of RAM memory to be compiled. In Virtual Machine (VM) this can lead to errors like: c++: fatal error: Killed signal terminated program cc1plus

  • To solve this, ensure the VM is provided with a enough memory (at least 8Gb in total, between RAM and SWAP, are necessary

  • If you cannot locate more RAM for the VM, here there are instructions to enlarge the SWAP partition. Concretely this example creates a 4Gb SWAP partition

    1. sudo dd if=/dev/zero of=/swapfile2 bs=1024 count=4194304
    2. sudo chmod 600 /swapfile2
    3. sudo mkswap /swapfile2
    4. sudo swapon /swapfile2

    Complete instructions here: https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/

ToDo

  • check nav2_recoveries for Humble (not yet available)
  • Check GetParams from Coppelia. Right now can only read params from node sim_ros2_interface.

About

Configuración de pkgs ROS para trabajar desde casa con un robot autónomo.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors