In this tutorial, we present an example of using DESPOT with real-robots via ROS. We present a slightly modified version of the Laser Tag problem: a robot tries to find and tag a target which intentionally runs away inside an known environment. The robot is equiped with a noisy laser-range sensor to measure distances in eight directions. Initially, the robot is aware of neither the target's location nor its own location. In each step, the robot can move to the four adjacent positions. When the robot is adjacent to the target, it can call 'Tag' to terminate a successful pursuit. The simulation consists of two holonomic robots (KUKA Youbot) inside a Gazebo environment resembling the problem world described in DESPOT paper (Page 20) [1].
[1] N. Ye, A. Somani, D. Hsu, and W. Lee. DESPOT: Online POMDP planning with regularization. J. Artificial Intelligence Research, 58:231–266, 2017.
Copyright © 2014-2017 by National University of Singapore.
Tested Operating Systems:
Ubuntu 14.04 |
---|
Dependencies: DESPOT, ROS Indigo+, Boost 1.55+, Gazebo 2+
Install ROS Indigo.
We recommend the ros-indigo-desktop-full
version which includes Gazebo.
Install the latest DESPOT using CMakeLists. Make sure that DESPOT binaries and header files are installed.
$ cd <latest_despot_repo>
$ git checkout API_redesign # temporary, will be merged into master
$ mkdir build; cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ../
$ make
$ sudo make install
Install BOOST libraries with sudo apt-get install libboost-all-dev
If you haven't sourced your ROS environment, run:
$ source /opt/ros/indigo/setup.bash OR <existing_workspace>/devel/setup.bash
Setup a fresh catkin workspace for despot_tutorials:
$ mkdir -p ~/despot_ws/src
$ cd ~/despot_ws/
$ catkin_make
$ source devel/setup.bash
Clone the repository:
$ cd ~/despot_ws/src
$ git clone https://github.com/AdaCompNUS/despot_tutorials.git
Compile:
cd ~/despot_ws
catkin_make -DCMAKE_BUILD_TYPE=Release
Launch the Gazebo environment and robot controllers:
$ roslaunch laser_tag laser_tag.launch R1_noise:=0.5
On a separate terminal, run the POMDP planner:
$ rosrun laser_tag pomdp_planner
You should see a 3D 7x11 grid world with two Youbots. The green robot should chase the red robot until 'Tag' is called. The R1_noise
parameter specifies the gaussian noise (standard deviation in meters) of the green robot's laser range finder.
In general, to use DESPOT with real-world systems:
- Define your POMDP model by inheriting the
DSPOMDP
class.
(See classLaserTag
and its parent classBaseTag
in laser_tag.h and base/base_tag.h.) - Setup an interface to communicate with your systems by inheriting the
World
abstract class.
(See classLaserTagWorld
in laser_tag_world.h and laser_tag_world.cpp.)- Implement the
Connect
andInitialize
functions inWorld
to estabilish connections with your system and intitialize it if possible. - Implement the
ExecuteAction
function inWorld
to send actions to your system and receive observations from it in the formats specified in your POMDP model (e.g:ACT_TYPE
&OBS_TYPE
parameters).
- Implement the
- Initialize your planner by inheirting the
Planner
class.
(See classMyPlanner
in main.cpp.)- Provide the planner your POMDP model and custom world by implementing the
InitializeModel
andInitializeWorld
functions. - Choose "DESPOT" to be the solver by implementing
ChooseSolver
. - Setup default parameters, such as the number of scenarios, search time per step, etc., by implementing
InitializeDefaultParameters
.
- Provide the planner your POMDP model and custom world by implementing the
- Launch the planning pipeline in your main function by calling the
runPlanning
function inPlanner
.
(See the main function in main.cpp.) - (Optional) Overwrite Planner::PlanningLoop to customize your planning pipeline, and overwrite Planner::runStep to customize the search-execute-update step inside the planning loop. (See the PlanningLoop and runStep functions in main.cpp.)