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.

132 lines
4.4 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. ## Teleoperating Stretch
  2. ### Xbox Controller Teleoperating
  3. 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.
  4. ### Keyboard Teleoperating: Full Body
  5. For full-body teleoperation with the keyboard, you first need to run the `stretch_driver.launch` in a terminal.
  6. ```{.bash .shell-prompt}
  7. roslaunch stretch_core stretch_driver.launch
  8. ```
  9. Then in a new terminal, type the following command
  10. ```{.bash .shell-prompt}
  11. rosrun stretch_core keyboard_teleop
  12. ```
  13. Below are the keyboard commands that allow a user to control all of Stretch's joints.
  14. ```{.bash .no-copy}
  15. ---------- KEYBOARD TELEOP MENU -----------
  16. i HEAD UP
  17. j HEAD LEFT l HEAD RIGHT
  18. , HEAD DOWN
  19. 7 BASE ROTATE LEFT 9 BASE ROTATE RIGHT
  20. home page-up
  21. 8 LIFT UP
  22. up-arrow
  23. 4 BASE FORWARD 6 BASE BACK
  24. left-arrow right-arrow
  25. 2 LIFT DOWN
  26. down-arrow
  27. w ARM OUT
  28. a WRIST FORWARD d WRIST BACK
  29. x ARM IN
  30. 5 GRIPPER CLOSE
  31. 0 GRIPPER OPEN
  32. step size: b BIG, m MEDIUM, s SMALL
  33. q QUIT
  34. -------------------------------------------
  35. ```
  36. To stop the node from sending twist messages, press `Ctrl` + `c` in the terminal.
  37. ### Keyboard Teleoperating: Mobile Base
  38. Begin by running the following command in your terminal:
  39. ```{.bash .shell-prompt}
  40. roslaunch stretch_core stretch_driver.launch
  41. ```
  42. To teleoperate a Stretch's mobile base with the keyboard, you first need to switch the mode to `navigation` 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`.
  43. ```{.bash .shell-prompt}
  44. rosservice call /switch_to_navigation_mode
  45. rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=stretch/cmd_vel
  46. ```
  47. Below are the keyboard commands that allow a user to move Stretch's base.
  48. ```{.bash .no-copy}
  49. Reading from the keyboard and Publishing to Twist!
  50. ---------------------------
  51. Moving around:
  52. u i o
  53. j k l
  54. m , .
  55. For Holonomic mode (strafing), hold down the shift key:
  56. ---------------------------
  57. U I O
  58. J K L
  59. M < >
  60. t : up (+z)
  61. b : down (-z)
  62. anything else : stop
  63. q/z : increase/decrease max speeds by 10%
  64. w/x : increase/decrease only linear speed by 10%
  65. e/c : increase/decrease only angular speed by 10%
  66. CTRL-C to quit
  67. currently: speed 0.5 turn 1.0
  68. ```
  69. To stop the node from sending twist messages, type `Ctrl` + `c`.
  70. ### Create a node for Mobile Base Teleoperating
  71. To move Stretch's mobile base using a python script, please look at [Teleoperate Stretch with a node](example_1.md) for reference.
  72. ## Teleoperating in Gazebo
  73. ### Keyboard Teleoperating: Mobile Base
  74. For keyboard teleoperation of the Stretch's mobile base, first, [startup Stretch in simulation](gazebo_basics.md). Then run the following command in a new terminal.
  75. ```{.bash .shell-prompt}
  76. roslaunch stretch_gazebo gazebo.launch
  77. ```
  78. In a new terminal, type the following
  79. ```{.bash .shell-prompt}
  80. roslaunch stretch_core teleop_twist.launch twist_topic:=/stretch_diff_drive_controller/cmd_vel linear:=1.0 angular:=2.0 teleop_type:=keyboard
  81. ```
  82. The same keyboard commands will be presented to a user to move the robot.
  83. ### Xbox Controller Teleoperating
  84. 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.
  85. ```{.bash .shell-prompt}
  86. roslaunch stretch_core teleop_twist.launch twist_topic:=/stretch_diff_drive_controller/cmd_vel linear:=1.0 angular:=2.0 teleop_type:=joystick
  87. ```
  88. 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.