You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.3 KiB

  1. ## Teleoperating Stretch
  2. !!! note
  3. Teleoperation support for Stretch in ROS 2 is under active development. Please reach out to us if you want to teleoperate Stretch in ROS 2.
  4. Refer to the instructions below if you want to test this functionality in ROS 1.
  5. ### Xbox Controller Teleoperating
  6. If you have not already had a look at the [Xbox Controller Teleoperation](https://docs.hello-robot.com/0.2/stretch-tutorials/getting_started/quick_start_guide_re2/#hello-world-demo) section in the Quick Start guide, now might be a good time to try it.
  7. ### Keyboard Teleoperating: Full Body
  8. For full-body teleoperation with the keyboard, you first need to run the `stretch_driver.launch` in a terminal.
  9. ```{.bash .shell-prompt}
  10. roslaunch stretch_core stretch_driver.launch
  11. ```
  12. Then in a new terminal, type the following command
  13. ```{.bash .shell-prompt}
  14. rosrun stretch_core keyboard_teleop
  15. ```
  16. Below are the keyboard commands that allow a user to control all of Stretch's joints.
  17. ```{.bash .no-copy}
  18. ---------- KEYBOARD TELEOP MENU -----------
  19. i HEAD UP
  20. j HEAD LEFT l HEAD RIGHT
  21. , HEAD DOWN
  22. 7 BASE ROTATE LEFT 9 BASE ROTATE RIGHT
  23. home page-up
  24. 8 LIFT UP
  25. up-arrow
  26. 4 BASE FORWARD 6 BASE BACK
  27. left-arrow right-arrow
  28. 2 LIFT DOWN
  29. down-arrow
  30. w ARM OUT
  31. a WRIST FORWARD d WRIST BACK
  32. x ARM IN
  33. 5 GRIPPER CLOSE
  34. 0 GRIPPER OPEN
  35. step size: b BIG, m MEDIUM, s SMALL
  36. q QUIT
  37. -------------------------------------------
  38. ```
  39. To stop the node from sending twist messages, type **Ctrl** + **c**.
  40. ### Keyboard Teleoperating: Mobile Base
  41. Begin by running the following command in your terminal:
  42. ```{.bash .shell-prompt}
  43. roslaunch stretch_core stretch_driver.launch
  44. ```
  45. To teleoperate a Stretch's mobile base with the keyboard, you first need to switch the mode to *nagivation* for the robot to receive *Twist* messages. This is done using a rosservice call in a new terminal. In the same terminal run the teleop_twist_keyboard node with the argument remapping the *cmd_vel* topic name to *stretch/cmd_vel*.
  46. ```{.bash .shell-prompt}
  47. rosservice call /switch_to_navigation_mode
  48. rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=stretch/cmd_vel
  49. ```
  50. Below are the keyboard commands that allow a user to move Stretch's base.
  51. ```{.bash .no-copy}
  52. Reading from the keyboard and Publishing to Twist!
  53. ---------------------------
  54. Moving around:
  55. u i o
  56. j k l
  57. m , .
  58. For Holonomic mode (strafing), hold down the shift key:
  59. ---------------------------
  60. U I O
  61. J K L
  62. M < >
  63. t : up (+z)
  64. b : down (-z)
  65. anything else : stop
  66. q/z : increase/decrease max speeds by 10%
  67. w/x : increase/decrease only linear speed by 10%
  68. e/c : increase/decrease only angular speed by 10%
  69. CTRL-C to quit
  70. currently: speed 0.5 turn 1.0
  71. ```
  72. To stop the node from sending twist messages, type **Ctrl** + **c**.
  73. ### Create a node for Mobile Base Teleoperating
  74. To move Stretch's mobile base using a python script, please look at [example 1](example_1.md) for reference.
  75. <!-- ## Teleoperating in Gazebo
  76. ### Keyboard Teleoperating
  77. For keyboard teleoperation, first [startup Stretch in simulation](gazebo_basics.md). Then run the following command in a new terminal.
  78. ```bash
  79. roslaunch stretch_gazebo gazebo.launch
  80. ```
  81. In a new terminal, type the following
  82. ```
  83. roslaunch stretch_gazebo teleop_keyboard.launch
  84. ```
  85. The same keyboard commands will be presented to a user to move the robot.
  86. ### Xbox Controller Teleoperating
  87. An alternative for robot base teleoperation is to use an Xbox controller. Stop the keyboard teleoperation node by typing **Ctrl** + **c** in the terminal where the command was executed. Then connect the Xbox controller device to your local machine and run the following command.
  88. ```
  89. roslaunch stretch_gazebo teleop_joy.launch
  90. ```
  91. Note that the teleop_twist_joy package has a deadman switch by default which disables the drive commands to be published unless pressed. For a Logitech F310 joystick, this button is A. -->