## descriptive title for the tutorial
## title = get NBV from set Pointcloud and robot state.
## multi-line description to be displayed in search
## description = In this tutorial we calculate a nbv from a set pointcloud from a previous tutorial, using a given robot state.
## next =
## what level user is this tutorial for
## level= BeginnerCategory
## keywords =
####################################
<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>

<<TableOfContents(3)>>

= Description =
In this tutorial we calculate a nbv from a set pointcloud from a previous tutorial, using a given robot state.

= Setup =
Finish the previous tutorial, we expect you to use the alternative pointcloud from the download section. The following image describes the result/setup condition for this tutorial:

{{attachment:tutGetNBVSetup.png||height="350",width="400"}}

= Tutorial =
 * run setBase(-0.25, 2, 90) to set the robot position.
 * run setPTU(-10, 10) and your rviz should look like this now:

{{attachment:tutGetNBVStartRobotState.png||height="400",width="400"}}

 * run getNBV() to get the nbv from our current position
 * save the calculated nbv in the nbv variable using nbv = _
 * add the topic tutGetNBVTopic described in the following image, if you can't find it do the next step, then this step and proceed with the next step

{{attachment:tutGetNBVTopic.png||height="400",width="500"}}

 * run showNBVs(nbv) or showPoses(getPoseFromNBV(nbv)) to display the calculated next best viewport as a red arrow:



{{attachment:tutGetNBVShow.png||height="400",width="450"}}

 * to get the robot state of the new found nbv run getPositionAndOrientationFromNBV(nbv), which returns a 2-tuple that can be given to the setPositionAndOrientation function
 * to move to the location run moveBase(*getPositionAndOrientationFromNBV(nbv)[0])
 * run setPTU(*getPositionAndOrientationFromNBV(nbv)[1]) to set the orientation properly

{{attachment:tutGetNBVResult.png||height="400",width="500"}}