SnakeSim provides a ROS2 and Webots simulation environment of a simple redundant robotic arm performing cartesian motion in a 3D workspace.
Ensure you have the following installed on your system (Ubuntu 22.04):
- ROS2 Humble Hawksbill
- Webots
Follow the official ROS2 installation guide for Debian packages here.
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/hugotallys/snakesim.gitcd ~/ros2_ws
colcon build --symlink-install
source install/local_setup.shDownload and install Webots from the official Webots website. You should also install the webots_ros2_driver:
sudo apt-get install ros-humble-webots-ros2More information on how to setup a Webots simulation with ROS can be found in the official ROS2 documenation
Create a virtual environment and install the necessary Python packages:
python3 -m venv ~/ros2_ws/venv
source ~/ros2_ws/venv/bin/activateYou must ensure Colcon ignores the python venv
touch ~/ros2_ws/venv/COLCON_IGNOREInstall the python packages with pip:
pip install -r ~/ros2_ws/src/snakesim/requirements.txtOpen a terminal source the workspace. We first instatiate the simulator with the action server node:
cd ~/ros2_ws
source install/local_setup.zsh
ros2 launch snakesim snake_launch.pyTo start the trajectory execution start the action client in another tab:
cd ~/ros2_ws
source install/local_setup.zsh
ros2 run snakesim snake_trajectory_client --ros-args -p metric_name:=<metric_name> -p experiment_type:=<experiment_type>Where <metric_name> is the name of the metric to be optimized and <experiment_type> is the type of experiment to be executed. The values
that can be chosen are:
metric_name:joint_distance,manipulability.experiment_type:null_space,trajectory.
