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.

193 lines
5.7 KiB

  1. # Intro to Navigation
  2. ## Display
  3. Visualize the robot in Rviz:
  4. ```
  5. roslaunch stretch_core stretch.launch lidar_odom:=false respeaker:=false rviz:=true
  6. ```
  7. For more details on the arguments, see the [API docs](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#launch-files).
  8. ## Simulation
  9. Visualize the simulated robot in Rviz:
  10. ```
  11. roslaunch stretch_gazebo gazebo.launch rviz:=true
  12. ```
  13. ## Untethered Operation
  14. At this point, we want to remove all wires tethered Stretch to our monitor/keyboard/etc. We'll set up "ROS Remote Master", which is a feature built into ROS that allows untethered operation. Follow this guide: https://docs.hello-robot.com/0.2/stretch-tutorials/getting_started/untethered_operation/#ros-remote-master
  15. ```
  16. # on the robot
  17. roslaunch stretch_core stretch.launch lidar_odom:=false respeaker:=false
  18. # on your personal computer
  19. rviz -d `rospack find stretch_core`/rviz/stretch.rviz
  20. ```
  21. ## Teleoperation
  22. Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#mode-std_msgsstring):
  23. ```
  24. rosservice call /switch_to_navigation_mode
  25. ```
  26. On your personal computer, plug in the controller dongle and run base keyboard teleop:
  27. ```
  28. roslaunch stretch_core teleop_twist.launch
  29. ```
  30. or if you have the Xbox controller:
  31. ```
  32. roslaunch stretch_core teleop_twist.launch teleop_type:=joystick
  33. ```
  34. The deadman button is the 'A' button (the green one).
  35. ![](https://docs.hello-robot.com/0.2/stretch-tutorials/getting_started/images/xbox.png)
  36. ### /stretch/cmd_vel
  37. The `/stretch/cmd_vel` topic accepts [Twist msgs](http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/Twist.html), where `twist.linear.x` and `twist.angular.z` are the translational and angular velocities the mobile base will execute.
  38. ```
  39. $ rostopic echo /stretch/cmd_vel
  40. ---
  41. linear:
  42. x: -0.04
  43. y: 0.0
  44. z: 0.0
  45. angular:
  46. x: 0.0
  47. y: 0.0
  48. z: -0.05731585025787354
  49. ---
  50. linear:
  51. x: 0.0
  52. y: 0.0
  53. z: 0.0
  54. angular:
  55. x: 0.0
  56. y: 0.0
  57. z: 0.0
  58. ---
  59. ```
  60. ### Safety
  61. Velocity commands must be sent at a regular control rate and must be faster than 2hz. There's two safety behaviors that prevent a runaway robot. A software check smoothly stops base motion after 0.5 seconds if no new command is received. A hardware check abruptly stops base motion after 1 second if no new command is received.
  62. ## Mapping ([slides](https://docs.google.com/presentation/d/1ZiZhw7uswBVzEkDrTCOjHh_HMbA6Duw5_YbPt8leqtY/edit#slide=id.g24dfd4ebf63_0_88))
  63. Stop all previous ROS commands. Start the following ROS commands on your Stretch.
  64. Start the mapping launch file:
  65. ```
  66. roslaunch stretch_navigation mapping.launch rviz:=false teleop_type:=none
  67. ```
  68. Turn on the robot's head camera as well:
  69. ```
  70. roslaunch stretch_core stretch_realsense.launch publish_upright_img:=true
  71. ```
  72. Use keyboard teleop to tilt the head camera downwards to look at the floor in front of the robot:
  73. ```
  74. rosrun stretch_core keyboard_teleop
  75. ```
  76. Now, on your computer, launch Rviz:
  77. ```
  78. rviz -d `rospack find stretch_navigation`/rviz/mapping.rviz
  79. ```
  80. Start controller teleop:
  81. ```
  82. roslaunch stretch_core teleop_twist.launch teleop_type:=joystick linear:=0.12 angular:=0.3
  83. ```
  84. After moving around the environment for some time, you can save the map using:
  85. ```
  86. rosrun map_server map_saver -f ${HELLO_FLEET_PATH}/maps/oct24thmap
  87. ```
  88. ## Planning
  89. Stop all previous ROS commands. Start the following ROS commands on your Stretch.
  90. ```
  91. roslaunch stretch_navigation navigation.launch map_yaml:=${HELLO_FLEET_PATH}/maps/oct24thmap.yaml rviz:=false
  92. ```
  93. Start Rviz on your personal computer:
  94. ```
  95. rviz -d `rospack find stretch_navigation`/rviz/navigation.rviz
  96. ```
  97. ### Localization
  98. AMCL is very commonly used for localization. It's a particle filtering library that works by comparing the robot's motion and sensor updates with a distribution of guesses at the robot's position in order to eliminate unlikely guesses every iteration. Running these motion/sensor update steps will allow the filter to converge on the robot's position as the robot sees landmarks. When the robot "wakes up", it doesn't know where it is, and the particles are evenly distributed across the map. We tell the robot where it is using:
  99. 1. The position estimate GUI in Rviz
  100. 2. Detecting a unique landmark (e.g. a Aruco marker taped to the wall)
  101. 3. Spinning in a 360 degree circle
  102. For example, turn on particle filters visualization in Rviz, use the Pose Estimate GUI to put the robot off somewhere wrong, and run teleop:
  103. ```
  104. roslaunch stretch_core teleop_twist.launch teleop_type:=joystick linear:=0.12 angular:=0.3
  105. ```
  106. Now spin the robot in a 360 degree circle. This doesn't always work, especially in environments with repetitive features.
  107. ### Costmaps ([slides](https://docs.google.com/presentation/d/1sxIqtTtSlSyvCpn6x0fwloD2D-W_K8swfpHEGsYEBLk/edit#slide=id.g24e0807281f_0_243))
  108. ### Global Plan ([slides](https://docs.google.com/presentation/d/1P86WW4Zh_Xr57MBmwCfGA0vgjo_maeoSe70MJrYjXWM/edit#slide=id.g24e00d17789_0_443))
  109. The global planner is called navfn/NavfnROS
  110. To visualize the global plan without moving the robot, switch the robot into position mode:
  111. ```
  112. rosservice call /switch_to_position_mode
  113. ```
  114. Use the Nav Goal GUI to send goals to MoveBase and visualize the global plans.
  115. Now cancel the plan:
  116. ```
  117. rostopic pub /move_base/cancel actionlib_msgs/GoalID "stamp:
  118. secs: 0
  119. nsecs: 0
  120. id: ''"
  121. ```
  122. ### Plan Follower
  123. The local planner is called [TrajectoryPlannerROS](https://wiki.ros.org/base_local_planner)
  124. ## Code Examples
  125. - https://docs.hello-robot.com/0.2/stretch-tutorials/ros1/example_13/
  126. - https://docs.hello-robot.com/0.2/stretch-tutorials/ros1/autodocking_nav_stack/
  127. ## References
  128. - https://github.com/MetroRobots/navigation_university/
  129. - https://github.com/hello-robot/stretch_ros/pull/120/files