-
Notifications
You must be signed in to change notification settings - Fork 1
Simulator
In our project we will use UUV Simulator. This simulation package is a set of plugins for Gazebo for underwater robotics and ROS modules (look their wiki for requirements and dependencies).
If you don't have the ROS workspace yet, you should run the following and then clone the uuv_simulator package in the ~/catkin_ws/src folder (as catkin_ws folder you can use any folder you want):
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
wstool init
You can install the package wstool using sudo pip install wstool.
Configure the environment variables by adding the following lines in ~/.bashrc (replace kinetic with indigo depending on the ROS version you are using).
Note: If you install a version of Gazebo newer than 7.0, you might need to adjust gazebo-7.0 below. You can find out which version you are using by typing gazebo --version in your terminal.
source /usr/share/gazebo-7/setup.sh
source /opt/ros/kinetic/setup.bash
source $HOME/catkin_ws/devel/setup.bash
export GAZEBO_PREFIX=$HOME/catkin_ws/install
export GAZEBO_RESOURCE_PATH=${GAZEBO_PREFIX}/share/gazebo-7.0:${GAZEBO_RESOURCE_PATH}
export GAZEBO_MODEL_PATH=${GAZEBO_PREFIX}/share/gazebo-7.0/models:${GAZEBO_MODEL_PATH}
export GAZEBO_PLUGIN_PATH=${GAZEBO_PREFIX}/lib:${GAZEBO_PREFIX}/lib/x86_64-linux-gnu:${GAZEBO_PLUGIN_PATH}
After saving these changes, remember to source the .bashrc by either typing source ~/.bashrc in your terminal or reopening the terminal. Finally, clone the UUV simulator package in the folder ~/catkin_ws/src and build your workspace:
git clone https://github.com/uuvsimulator/uuv_simulator
cd ~/catkin_ws
catkin_make install
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ros-kinetic-control-toolbox
Later we will use UWsim with this plugin or UE4 with UE plugin for rendering image from camera sensor.
-
Create new directory for all files (e.g. Simulator) and src folder for all packages:
mkdir -p ~/Simulator/src -
Clone all source files from their repositories to src folder:
git clone https://github.com/freefloating-gazebo/freefloating_gazebo(A Gazebo plugin to simulate underwater vehicles and visualize with UWsim)
git clone https://github.com/freefloating-gazebo/freefloating_gazebo_demo(This package contains two examples of underwater robot using the freefloating_gazebo plugin) -
Source important stuff:
source /opt/ros/kinetic/setup.bash -
Build a catkin workspace:
cd ~/Simulator/
catkin_make -
Download UWsim packages (p. 5):
a) Create .rosinstall file inside catkin directory (touch .rosinstall in Simulator folder) with the following contents:- other: {local-name: /opt/ros/kinetic/share/ros} - other: {local-name: /opt/ros/kinetic/share} - other: {local-name: /opt/ros/kinetic/stacks} - setup-file: {local-name: /opt/ros/kinetic/setup.sh} - git: {local-name: src/uwsim_osgocean, uri: 'https://github.com/uji-ros-pkg/uwsim_osgocean.git', version: kinetic-devel} - git: {local-name: src/uwsim_osgworks, uri: 'https://github.com/uji-ros-pkg/uwsim_osgworks.git', version: kinetic-devel} - git: {local-name: src/uwsim_bullet, uri: 'https://github.com/uji-ros-pkg/uwsim_bullet.git', version: kinetic-devel} - git: {local-name: src/uwsim_osgbullet, uri: 'https://github.com/uji-ros-pkg/uwsim_osgbullet.git', version: kinetic-devel} - git: {local-name: src/underwater_simulation, uri: 'https://github.com/uji-ros-pkg/underwater_simulation.git', version: kinetic-devel}b) Then download the sources with:
rosws updatec) Install the dependencies:
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -
Now let's build all stuff:
catkin_make_isolated --install
catkin_make_isolated -
source devel_isolated/setup.bash
-
roscore -
Synchronize UWsim and Gazebo files (to do once)
This will scan the launchfile to create urdf from xacro files to be used in UWsim:
roslaunch freefloating_gazebo_demo g500arm5e.launch parse:=true -
Launch the simulators
This launches UWsim for the graphical part, and Gazebo to allow dynamic simulation:
UWsim:roslaunch freefloating_gazebo_demo g500arm5e.launch
Gazebo:roslaunch freefloating_gazebo_demo g500arm5e_gazebo.launch uwsim:=false -
Run the demo
This will unpause the physics (that are paused by default) and run the open-loop recovery of the black box:
rosrun freefloating_gazebo_demo freefloating_gazebo_demo
Try:
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ros-kinetic-control-toolbox
Copy files from freefloating_gazebo_demo/config to install_isolated folder
Try rosrun freefloating_gazebo_demo freefloating_gazebo_demo after source devel/setup.bash
Simulator/ -- WORKSPACE
__src/ -- SOURCE SPACE
____CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin
____freefloating_gazebo/
____freefloating_gazebo_demo/
____underwater_simulation/
____uwsim_bullet/
____uwsim_osgbullet/
____uwsim_osgocean/
____uwsim_osgworks/
__
Ручняа подача команды аппарату:
rosrun uwsim setVehicleVelocity /dataNavigator 0.2 0 0 0 0 0
Помощь по составлению YAML сообщений: http://wiki.ros.org/ROS/YAMLCommandLine
- Проект
- Архитектура проекта
- Установка и настройка окружения
- Симулятор
- Бортовой компьютер
- Памятки и туториалы