Skip to content

lge-ros2/cloisim_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

614 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloisim_ros (jazzy version)

ROS2 simulation device packages to connect CLOiSim(the unity3D based multi-robot simulator).

Download CLOiSim Simulator

  • Latest version: link
  • All Releases: link

Install ROS2 jazzy

follow the guideline on below link.

https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debians.html

Prerequisite

mkdir -p ~/cloisim_ws/src
cd ~/cloisim_ws/src
git clone --recursive https://github.com/lge-ros2/cloisim_ros.git -b jazzy

sudo apt update
sudo apt install -y python3-rosdep

sudo rosdep init
rosdep update
rosdep install -y -r -q --from-paths src --ignore-src --rosdistro jazzy

Build

Set up ROS2 environment first

source /opt/ros2/jazzy/setup.bash
cd ~/cloisim_ws
colcon build --symlink-install --packages-up-to cloisim_ros_bringup

Test

Build with testing enabled and run tests:

cd ~/cloisim_ws
colcon build --cmake-args -DBUILD_TESTING=ON
colcon test --event-handlers console_direct+
colcon test-result --all

To test specific packages only:

colcon build --packages-select cloisim_ros_lidar cloisim_ros_camera --cmake-args -DBUILD_TESTING=ON
colcon test --packages-select cloisim_ros_lidar cloisim_ros_camera --event-handlers console_direct+
colcon test-result --all

Pre-push hook

To block pushes when tests fail, enable the repo-local git hook:

git config core.hooksPath .githooks
chmod +x .githooks/pre-push

By default the hook runs in auto mode. It inspects the refs being pushed, maps changed files back to colcon packages, builds the changed packages plus their dependents, and runs tests only for the directly changed packages.

git config hooks.cloisimRosPrePushScope auto

To force a single package instead:

git config hooks.cloisimRosPrePushScope package
git config hooks.cloisimRosPrePushPackage cloisim_ros_base

That mode runs:

colcon build --packages-up-to cloisim_ros_base --cmake-args -DBUILD_TESTING=ON
colcon test --packages-select cloisim_ros_base --event-handlers console_direct+
colcon test-result --verbose --test-result-base build/cloisim_ros_base

To force full workspace validation:

git config hooks.cloisimRosPrePushScope workspace

That mode runs:

colcon build --cmake-args -DBUILD_TESTING=ON
colcon test --event-handlers console_direct+
colcon test-result --all --verbose

Use workspace only when you intentionally want to pay for every package and accept unrelated package failures blocking the push.

To switch back to auto detection:

git config hooks.cloisimRosPrePushScope auto

To bypass it temporarily:

SKIP_CLOISIM_ROS_PRE_PUSH=1 git push

Usage

Set environment variable, if the server is not localhost

export CLOISIM_BRIDGE_IP='xxx.xxx.xxx.xxx'
export CLOISIM_SERVICE_PORT=8080

check here details for bring-up guide

The default max retry number is 5, if you want to change set environment variable.

export CLOISIM_CONNECTION_MAX_RETRY=10

Run cloisim_ros (robot + world)

DDS with cyclone dds

Recommended to use cyclone DDS and config file Place the config XML file in your desired location and set the environment variable as shown below:

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=file:///$PWD/cloisim_ros/cyclonedds_config.xml

sudo sysctl -w net.core.rmem_max=16777216 \
            -w net.core.rmem_default=16777216 \
            -w net.core.wmem_max=16777216 \
            -w net.core.wmem_default=16777216

Shared Memory DDS with FastRTPS

It's experimental feature for cloisim_ros. Use absolute path in FASTRTPS_DEFAULT_PROFILES_FILE environment variable.

For example,

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=/home/cloi/src/cloisim_ros/fastrtps_shared_profile.xml

Turn off single mode(=multi robot mode)

Apply namespaceas each robot as a multi robot mode.

Strongly recommend to use this method.

ros2 launch cloisim_ros_bringup bringup_launch.py
ros2 launch cloisim_ros_bringup bringup_launch.py single_mode:=False

Turn on single Mode

It shall NOT be applied namespace for robot and the number of robot must BE single in world environment.

ros2 launch cloisim_ros_bringup bringup_launch.py single_mode:=True

Running CLOiSim

It provides a script to run CLOiSim easily.

ros2 launch cloisim_ros_bringup cloisim_launch.py sim_path:=/opt/CLOiSim/CLOiSim-2.2.0 world:=lg_seocho.world

Using Docker

Run below command after clone this repository(this branch).

Build Docker image

git clone https://github.com/lge-ros2/cloisim_ros.git -b jazzy
cd cloisim_ros
docker build -t cloisim_ros .

Running container

You can add possible parameters as described above. ex) target_model, target_parts_type or target_parts_name

multi robot mode

docker run -it --rm --net=host -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID cloisim_ros

single robot mode

docker run -it --rm --net=host -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID cloisim_ros single_mode:=True

multi robot mode with default network driver(bridge)

docker run -it --rm -e CLOISIM_BRIDGE_IP='192.168.0.125' -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID cloisim_ros

single robot mode with default network driver(bridge)

docker run -it --rm -e CLOISIM_BRIDGE_IP='192.168.0.125' -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID cloisim_ros single_mode:=True

You can set bridge ip using below command.

export CLOISIM_BRIDGE_IP=$(ip addr show dev docker0 | grep "inet" | awk 'NR==1{print $2}' | cut -d'/' -f 1)
echo $CLOISIM_BRIDGE_IP
docker run -it --rm -e CLOISIM_BRIDGE_IP=$CLOISIM_BRIDGE_IP -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID cloisim_ros

Version info

About

ROS2 simulation device packages to connect unity based multi-robot simulator CLOisim.

Topics

Resources

License

Contributing

Security policy

Stars

21 stars

Watchers

3 watching

Forks

Contributors