From f1ca4fd858532252cb9b659730c7e8f47e3a2549 Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 20:37:53 -0700 Subject: [PATCH 01/11] Create intro_to_nav.md --- ros1/intro_to_nav.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ros1/intro_to_nav.md diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md new file mode 100644 index 0000000..6acc558 --- /dev/null +++ b/ros1/intro_to_nav.md @@ -0,0 +1,17 @@ +# Intro to Navigation + +## Display + +Visualize the robot in Rviz: + +``` +roslaunch stretch_core stretch.launch +``` + +## Simulation + +Visualize the simulated robot in Rviz: + +``` +TODO +``` From f0b1ca058b40153f961b77fcd670dd6e5c2f5eaf Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 20:41:12 -0700 Subject: [PATCH 02/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 6acc558..e58b93d 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -5,9 +5,11 @@ Visualize the robot in Rviz: ``` -roslaunch stretch_core stretch.launch +roslaunch stretch_core stretch.launch lidar_odom:=false respeaker:=false rviz:=true ``` +For more details on the arguments, see the [API docs](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#launch-files). + ## Simulation Visualize the simulated robot in Rviz: From 2f45d184d9ca2e2b8aee8cb25e620b9f5693302d Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 20:55:54 -0700 Subject: [PATCH 03/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index e58b93d..b681231 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -14,6 +14,20 @@ For more details on the arguments, see the [API docs](https://github.com/hello-r Visualize the simulated robot in Rviz: +``` +roslaunch stretch_gazebo gazebo.launch rviz:=true +``` + +## Teleoperation + +Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#mode-std_msgsstring): + +``` +rosservice call /switch_to_navigation_mode +``` + +Run base teleop: + ``` TODO ``` From 933de9fa1c70509a90b0fc00df26cc06d5f746ca Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 21:12:15 -0700 Subject: [PATCH 04/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index b681231..1465add 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -26,8 +26,18 @@ Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/no rosservice call /switch_to_navigation_mode ``` -Run base teleop: +Run base keyboard teleop: ``` -TODO +roslaunch stretch_core teleop_twist.launch ``` + +or if you have the Xbox controller: + +``` +roslaunch stretch_core teleop_twist.launch teleop_type:=joystick +``` + +The deadman button is the 'A' button (the green one). + +![](https://docs.hello-robot.com/0.2/stretch-tutorials/getting_started/images/xbox.png) From fa3aae842daedf940fa153af659e34bfb606799f Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 21:19:26 -0700 Subject: [PATCH 05/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 1465add..da284c8 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -41,3 +41,32 @@ roslaunch stretch_core teleop_twist.launch teleop_type:=joystick The deadman button is the 'A' button (the green one). ![](https://docs.hello-robot.com/0.2/stretch-tutorials/getting_started/images/xbox.png) + +### /stretch/cmd_vel + +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. + +``` +$ rostopic echo /stretch/cmd_vel +--- +linear: + x: -0.04 + y: 0.0 + z: 0.0 +angular: + x: 0.0 + y: 0.0 + z: -0.05731585025787354 +--- +linear: + x: 0.0 + y: 0.0 + z: 0.0 +angular: + x: 0.0 + y: 0.0 + z: 0.0 +--- +``` + +## Mapping From 33e738a529f7884b60a904d15fe147fc6817dcec Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Mon, 23 Oct 2023 21:27:03 -0700 Subject: [PATCH 06/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index da284c8..4b7697c 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -18,6 +18,10 @@ Visualize the simulated robot in Rviz: roslaunch stretch_gazebo gazebo.launch rviz:=true ``` +## Untethered Operation + +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 + ## Teleoperation Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#mode-std_msgsstring): @@ -69,4 +73,10 @@ angular: --- ``` +### Safety + +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. + ## Mapping + +TODO From 1b4a9f4965d025fdc4936de5a5745dbd4347394c Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Tue, 24 Oct 2023 12:53:33 -0400 Subject: [PATCH 07/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 4b7697c..3e6203f 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -22,6 +22,14 @@ roslaunch stretch_gazebo gazebo.launch rviz:=true 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 +``` +# on the robot +roslaunch stretch_core stretch.launch lidar_odom:=false respeaker:=false + +# on your personal computer +rviz -d `rospack find stretch_core`/rviz/stretch.rviz +``` + ## Teleoperation Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/noetic/stretch_core#mode-std_msgsstring): From 8416a6d57185f468e4c685db1f0bc293259eab60 Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Tue, 24 Oct 2023 15:58:36 -0400 Subject: [PATCH 08/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 45 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 3e6203f..e250baf 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -38,7 +38,7 @@ Switch to 'navigation' [mode](https://github.com/hello-robot/stretch_ros/tree/no rosservice call /switch_to_navigation_mode ``` -Run base keyboard teleop: +On your personal computer, plug in the controller dongle and run base keyboard teleop: ``` roslaunch stretch_core teleop_twist.launch @@ -85,6 +85,47 @@ angular: 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. -## Mapping +## Mapping ([slides](https://docs.google.com/presentation/d/1ZiZhw7uswBVzEkDrTCOjHh_HMbA6Duw5_YbPt8leqtY/edit#slide=id.g24dfd4ebf63_0_88)) + +Stop all previous ROS commands. Start the following ROS commands on your Stretch. + +Start the mapping launch file: + +``` +roslaunch stretch_navigation mapping.launch rviz:=false teleop_type:=none +``` + +Turn on the robot's head camera as well: + +``` +roslaunch stretch_core stretch_realsense.launch publish_upright_img:=true +``` + +Use keyboard teleop to tilt the head camera downwards to look at the floor in front of the robot: + +``` +rosrun stretch_core keyboard_teleop +``` + +Now, on your computer, launch Rviz: + +``` +rviz -d `rospack find stretch_navigation`/rviz/mapping.rviz +``` + +Start controller teleop: + +``` +roslaunch stretch_core teleop_twist.launch teleop_type:=joystick linear:=0.12 angular:=0.3 +``` + +After moving around the environment for some time, you can save the map using: + +``` +rosrun map_server map_saver -f ${HELLO_FLEET_PATH}/maps/oct24thmap +``` + +## Global Planning TODO + From d61771118b8b5e3a332cae780d4d10eb19018a6e Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Tue, 24 Oct 2023 16:34:01 -0400 Subject: [PATCH 09/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 50 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index e250baf..9e61a00 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -125,7 +125,53 @@ After moving around the environment for some time, you can save the map using: rosrun map_server map_saver -f ${HELLO_FLEET_PATH}/maps/oct24thmap ``` -## Global Planning +## Planning -TODO +Stop all previous ROS commands. Start the following ROS commands on your Stretch. + +``` +roslaunch stretch_navigation navigation.launch map_yaml:=${HELLO_FLEET_PATH}/maps/oct24thmap.yaml rviz:=false +``` + +Start Rviz on your personal computer: + +``` +rviz -d `rospack find stretch_navigation`/rviz/navigation.rviz +``` + +### Localization + +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: + + 1. The position estimate GUI in Rviz + 2. Detecting a unique landmark (e.g. a Aruco marker taped to the wall) + 3. Spinning in a 360 degree circle +For example, turn on particle filters visualization in Rviz, use the Pose Estimate GUI to put the robot off somewhere wrong, and run teleop: + +``` +roslaunch stretch_core teleop_twist.launch teleop_type:=joystick linear:=0.12 angular:=0.3 +``` + +Now spin the robot in a 360 degree circle. This doesn't always work, especially in environments with repetitive features. + +### Costmaps + +### Global Plan ([slides](https://docs.google.com/presentation/d/1P86WW4Zh_Xr57MBmwCfGA0vgjo_maeoSe70MJrYjXWM/edit#slide=id.g24e00d17789_0_443)) + +To visualize the global plan without moving the robot, switch the robot into position mode: + +``` +rosservice call /switch_to_position_mode +``` + +Use the Nav Goal GUI to send goals to MoveBase and visualize the global plans. + +Now cancel the plan: + +``` +rostopic pub /move_base/cancel actionlib_msgs/GoalID "stamp: + secs: 0 + nsecs: 0 +id: ''" +``` From 2a3a7e749373c1bb80d25dc54e06c0e1bfc3ff11 Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Tue, 24 Oct 2023 16:45:20 -0400 Subject: [PATCH 10/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 9e61a00..47805bc 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -155,10 +155,12 @@ roslaunch stretch_core teleop_twist.launch teleop_type:=joystick linear:=0.12 an Now spin the robot in a 360 degree circle. This doesn't always work, especially in environments with repetitive features. -### Costmaps +### Costmaps ([slides](https://docs.google.com/presentation/d/1sxIqtTtSlSyvCpn6x0fwloD2D-W_K8swfpHEGsYEBLk/edit#slide=id.g24e0807281f_0_243)) ### Global Plan ([slides](https://docs.google.com/presentation/d/1P86WW4Zh_Xr57MBmwCfGA0vgjo_maeoSe70MJrYjXWM/edit#slide=id.g24e00d17789_0_443)) +The global planner is called navfn/NavfnROS + To visualize the global plan without moving the robot, switch the robot into position mode: ``` @@ -175,3 +177,16 @@ rostopic pub /move_base/cancel actionlib_msgs/GoalID "stamp: nsecs: 0 id: ''" ``` + +### Plan Follower + +The local planner is called [TrajectoryPlannerROS](https://wiki.ros.org/base_local_planner) + +## Code Examples + + - https://docs.hello-robot.com/0.2/stretch-tutorials/ros1/example_13/ + - https://docs.hello-robot.com/0.2/stretch-tutorials/ros1/autodocking_nav_stack/ + +## References + + - https://github.com/MetroRobots/navigation_university/ From d280bd70cff7d15c76f4d17263bfb7c39fe2a0e8 Mon Sep 17 00:00:00 2001 From: Binit Shah Date: Tue, 24 Oct 2023 16:58:59 -0400 Subject: [PATCH 11/11] Update intro_to_nav.md --- ros1/intro_to_nav.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ros1/intro_to_nav.md b/ros1/intro_to_nav.md index 47805bc..6fb1eb1 100644 --- a/ros1/intro_to_nav.md +++ b/ros1/intro_to_nav.md @@ -190,3 +190,4 @@ The local planner is called [TrajectoryPlannerROS](https://wiki.ros.org/base_loc ## References - https://github.com/MetroRobots/navigation_university/ + - https://github.com/hello-robot/stretch_ros/pull/120/files