## page was renamed from nxt/Tutorials/Assisted Teleop Video Demo
## For instruction on writing tutorials
## http://www.ros.org/wiki/WritingTutorials
####################################
##FILL ME IN
####################################
## for a custom note with links:
## note = This assumes that you have installed nxt using the instructions at [[nxt/Installation]]
## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links 
## note.0= 
## descriptive title for the tutorial
## title = Assisted Teleop Video Demo
## multi-line description to be displayed in search 
## description = This is the demo shown in the announcement video.   <<Youtube(2We5_Qeapbc)>>
## the next tutorial description (optional)
## next =
## links to next tutorial (optional)
## next.0.link=
## next.1.link=
## what level user is this tutorial for 
## level= IntermediateCategory
## keywords = nxt assisted teleop
####################################

<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>

<<TableOfContents(4)>>

This assumes that you have installed nxt using the instructions at [[nxt/Installation]]



== Build ==
{{{
rosmake nxt nxt_apps nxt_robots
}}}

== Run the robot ==
Having built the [[nxt_robot_sensor_car|sensor car.]]

In terminal 1:
{{{
roslaunch nxt_robot_sensor_car robot.launch 
}}}

In terminal 2: 
{{{
roslaunch nxt_assisted_teleop assisted_teleop.launch
}}}
This launch file uses joy_node so that the robot can be operated with a joystick. If you would like to use the keyboard for operating the robot, you can simply replace these lines in assisted_teleop.launch:
{{{
  <!-- joy node -->
  <node respawn="true" pkg="joy"
        type="joy_node" name="nxt_joy" >
    <param name="dev" type="string" value="/dev/input/js0" />
    <param name="deadzone" value="0.12" />
    <param name="autorepeat_rate" value="10.0" />
  </node>

  <!-- teleop node -->
  <node pkg="nxt_teleop" type="nxt_teleop_joy" name="nxt_teleop" output="screen">
    <param name="axis_linear" value="3" type="int"/>
    <param name="axis_angular" value="0" type="int"/>
    <param name="axis_deadman" value="4" type="int"/>
    <param name="scale_linear" value="1" type="double"/>
    <param name="scale_angular" value="1" type="double"/>
    <remap from="cmd_vel" to="teleop_cmd_vel"/>
  </node>
}}}
with these lines:
{{{
  <!-- keyboard teleop node -->
  <node pkg="nxt_teleop" type="nxt_teleop_key" name="nxt_teleop"  output="screen">
    <param name="scale_linear" value="1" type="double"/>
    <param name="scale_angular" value="1" type="double"/>
    <remap from="cmd_vel" to="teleop_cmd_vel"/>
  </node>
}}}

In terminal 3: 
{{{
rosrun rviz rviz
}}}

In rviz do the following:  
 * Enable nxt_rviz_plugins in the plugin menu.  
 * Add NTXUltrasonicDisplay and set its topic to "/ultrasonic_sensor"
 * In "Global Options" set the "Fixed Frame" to '/odom_combined" and "Target Frame" to <Fixed Frame>
 * Turn on the "Grid" display
 * Add "Grid Cells" display and set its topic to "assisted_teleop/costmap/obstacles"  
 * Add "Grid Cells" display and set its topic to "assisted_teleop/costmap/inflated_obstacles". Change Color to, say blue.


## AUTOGENERATED DO NOT DELETE 
## TutorialCategory
## FILL IN THE STACK TUTORIAL CATEGORY HERE
## NXTTutorial