Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported ROS2 tutorials for the new documentation #10

Merged
merged 16 commits into from Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions mkdocs.yml
Expand Up @@ -147,24 +147,26 @@ nav:
- Overview: ./ros2/README.md
- Basics:
- Getting Started: ./ros2/getting_started.md
# - Teleoperating Stretch: ./ros2/teleoperating_stretch.md
- Introduction to ROS 2: ./ros2/intro_to_ros2.md
- Introduction to HelloNode: ./ros2/intro_to_hellonode.md
- Follow Joint Trajectory Commands: ./ros2/follow_joint_trajectory.md
- Teleoperating Stretch: ./ros2/teleoperating_stretch.md
- Internal State of Stretch: ./ros2/internal_state_of_stretch.md
- RViz Basics: ./ros2/rviz_basics.md
- Nav2 Stack:
- Overview: ./ros2/navigation_overview.md
- Nav2 Basics: ./ros2/navigation_stack.md
- Nav2 Simple Commander: ./ros2/navigation_simple_commander.md
- Follow Joint Trajectory Commands: ./ros2/follow_joint_trajectory.md
- Perception: ./ros2/perception.md
- ArUco Marker Detection: ./ros2/aruco_marker_detection.md
- ReSpeaker Microphone Array:
- Respeaker Mic Array: ./ros2/respeaker_mic_array.md
- Respeaker Topics: ./ros2/respeaker_topics.md
- FUNMAP: https://github.com/hello-robot/stretch_ros2/tree/humble/stretch_funmap
# - MoveIt 2:
# - MoveIt Basics: ./ros2/moveit_basics.md
# - MoveIt with RViz: ./ros2/moveit_rviz_demo.md
# - MoveGroup C++ API: ./ros2/moveit_movegroup_demo.md
# - Perception: ./ros2/perception.md
# - ArUco Marker Detection: ./ros2/aruco_marker_detection.md
# - ReSpeaker Microphone Array: ./ros2/respeaker_microphone_array.md
# - FUNMAP: https://github.com/hello-robot/stretch_ros/tree/master/stretch_funmap
# - ROS testing: ./ros2/ros_testing.md
# - Other Nav Stack Features: ./ros2/other_nav_features.md
# - Gazebo Basics: ./ros2/gazebo_basics.md
Expand All @@ -173,18 +175,18 @@ nav:
- Filter Laser Scans: ./ros2/example_2.md
- Mobile Base Collision Avoidance: ./ros2/example_3.md
- Give Stretch a Balloon: ./ros2/example_4.md
# - Print Joint States: ./ros2/example_5.md
# - Store Effort Values: ./ros2/example_6.md
# - Capture Image: ./ros2/example_7.md
# - Voice to Text: ./ros2/example_8.md
# - Voice Teleoperation of Base: ./ros2/example_9.md
- Print Joint States: ./ros2/example_5.md
- Store Effort Values: ./ros2/example_6.md
- Capture Image: ./ros2/example_7.md
- Voice to Text: ./ros2/example_8.md
- Voice Teleoperation of Base: ./ros2/example_9.md
- Tf2 Broadcaster and Listener: ./ros2/example_10.md
- ArUco Tag Locator: ./ros2/example_12.md
- Obstacle Avoider: ./ros2/obstacle_avoider.md
- Align to ArUco: ./ros2/align_to_aruco.md
- Deep Perception: ./ros2/deep_perception.md
- Avoiding Race Conditions and Deadlocks: ./ros2/avoiding_deadlocks_race_conditions.md
# - PointCloud Transformation: ./ros2/example_11.md
# - ArUco Tag Locator: ./ros2/example_12.md

- Stretch Tool Share:
- Overview: ./stretch_tool_share/README.md
Expand Down
55 changes: 30 additions & 25 deletions ros2/README.md
Expand Up @@ -14,17 +14,21 @@ This tutorial track is for users looking to get familiar with programming Stretc

| | Tutorial | Description |
|--|---------------------------------------------------------------------------------|----------------------------------------------------|
| 1 | [Getting Started](getting_started.md) | Setup instructions for ROS 2 on Stretch|
| 2 | [Follow Joint Trajectory Commands](follow_joint_trajectory.md) | Control joints using joint trajectory server. |
| 3 | [Internal State of Stretch](internal_state_of_stretch.md) | Monitor the joint states of Stretch. |
| 4 | [RViz Basics](rviz_basics.md) | Visualize topics in Stretch. |
| 1 | [Getting Started](getting_started.md) | Setup instructions for ROS 2 on Stretch|
| 2 | [Introduction to ROS 2](intro_to_ros2.md.md) | Explore the client library used in ROS2 |
| 3 | [Introduction to HelloNode](intro_to_hellonode.md) | Explore the Hello Node class to create a ROS2 node for Stretch |
| 4 | [Teleoperating Stretch](teleoperating_stretch.md) | Control Stretch with a Keyboard or a Gamepad controller. |
| 5 | [Internal State of Stretch](internal_state_of_stretch.md) | Monitor the joint states of Stretch. |
| 6 | [RViz Basics](rviz_basics.md) | Visualize topics in Stretch. |
| 7 | [Nav2 Stack](navigation_overview.md) | Motion planning and control for mobile base. |
| 8 | [Follow Joint Trajectory Commands](follow_joint_trajectory.md) | Control joints using joint trajectory server. |
| 9 | [Perception](perception.md) | Use the Realsense D435i camera to visualize the environment. |
| 10 | [ArUco Marker Detection](aruco_marker_detection.md) | Localize objects using ArUco markers. |
| 11 | [ReSpeaker Microphone Array](respeaker_mic_array.md) | Learn to use the ReSpeaker Microphone Array. |
| 12 | [FUNMAP](https://github.com/hello-robot/stretch_ros2/tree/humble/stretch_funmap) | Fast Unified Navigation, Manipulation and Planning. |
<!--| 5 | [MoveIt2 Basics](moveit_basics.md) | Motion planning and control for the arm using MoveIt. |
| 6 | [MoveIt2 with Rviz](moveit_rviz_demo.md) | Motion planning and control for the arm using MoveIt. |
| 7 | [MoveIt2 MoveGroup C++ API](moveit_movegroup_demo.md) | Motion planning and control for the arm using MoveIt. |
| 9 | [Perception](coming_soon.md) | Use the Realsense D435i camera to visualize the environment. |
| 10 | [ArUco Marker Detection](coming_soon.md) | Localize objects using ArUco markers. |
| 11 | [ReSpeaker Microphone Array](coming_soon.md) | Learn to use the ReSpeaker Microphone Array. |
| 12 | [FUNMAP](https://github.com/hello-robot/stretch_ros/tree/master/stretch_funmap) | Fast Unified Navigation, Manipulation and Planning. |
| 7 | [MoveIt2 MoveGroup C++ API](moveit_movegroup_demo.md) | Motion planning and control for the arm using MoveIt. |
| 13 | [ROS testing](coming_soon.md) | Write ROS system tests for introspection. |
| 14 | [Other Nav Stack Features](coming_soon.md) | Advanced features for Nav 2. | -->

Expand All @@ -34,19 +38,20 @@ To help get you started on your software development, here are examples of nodes

| | Tutorial | Description |
|---|-------------------------------------------------|----------------------------------------------------|
| 1 | [Teleoperate Stretch with a Node](example_1.md) | Use a python script that sends velocity commands. |
| 2 | [Filter Laser Scans](example_2.md) | Publish new scan ranges that are directly in front of Stretch.|
| 3 | [Mobile Base Collision Avoidance](example_3.md) | Stop Stretch from running into a wall.|
| 4 | [Give Stretch a Balloon](example_4.md) | Create a "balloon" marker that goes where ever Stretch goes.|
| 5 | [Tf2 Broadcaster and Listener](example_10.md) | Create a tf2 broadcaster and listener.|
| 6 | [Obstacle Avoider](obstacle_avoider.md) | Avoid obstacles using the planar lidar. |
| 7 | [Align to ArUco](align_to_aruco.md) | Detect ArUco fiducials using OpenCV and align to them.|
| 8 | [Deep Perception](deep_perception.md) | Use YOLOv5 to detect 3D objects in a point cloud.|
<!-- | 5 | [Print Joint States](example_5.md) | Print the joint states of Stretch.|
| 6 | [Store Effort Values](example_6.md) | Print, store, and plot the effort values of the Stretch robot.|
| 7 | [Capture Image](example_7.md) | Capture images from the RealSense camera data.|
| 8 | [Voice to Text](example_8.md) | Interpret speech and save transcript to a text file.|
| 9 | [Voice Teleoperation of Base](example_9.md) | Use speech to teleoperate the mobile base.|
| 10 | [Tf2 Broadcaster and Listener](example_10.md) | Create a tf2 broadcaster and listener.|
| 11 | [PointCloud Transformation](example_11.md) | Convert PointCloud2 data to a PointCloud and transform to a different frame.|
| 12 | [ArUco Tag Locator](example_12.md) | Actuate the head to locate a requested ArUco marker tag and return a transform.| -->
| 1 | [Mobile Base Velocity Control](example_1.md) | Use a python script that sends velocity commands. |
| 2 | [Filter Laser Scans](example_2.md) | Publish new scan ranges that are directly in front of Stretch.|
| 3 | [Mobile Base Collision Avoidance](example_3.md) | Stop Stretch from running into a wall.|
| 4 | [Give Stretch a Balloon](example_4.md) | Create a "balloon" marker that goes where ever Stretch goes.|
| 5 | [Print Joint States](example_5.md) | Print the joint states of Stretch.|
| 6 | [Store Effort Values](example_6.md) | Print, store, and plot the effort values of the Stretch robot.|
| 7 | [Capture Image](example_7.md) | Capture images from the RealSense camera data.|
| 8 | [Voice to Text](example_8.md) | Interpret speech and save transcript to a text file.|
| 9 | [Voice Teleoperation of Base](example_9.md) | Use speech to teleoperate the mobile base.|
| 10 | [Tf2 Broadcaster and Listener](example_10.md) | Create a tf2 broadcaster and listener.|
| 11 | [ArUco Tag Locator](example_12.md) | Actuate the head to locate a requested ArUco marker tag and return a transform.|
| 12 | [Obstacle Avoider](obstacle_avoider.md) | Avoid obstacles using the planar lidar. |
| 13 | [Align to ArUco](align_to_aruco.md) | Detect ArUco fiducials using OpenCV and align to them.|
| 14 | [Deep Perception](deep_perception.md) | Use YOLOv5 to detect 3D objects in a point cloud.|
| 15 | [Avoiding Race Conditions and Deadlocks](avoiding_deadlocks_race_conditions.md) | Learn how to avoid Race Conditions and Deadlocks |
<!--| 11 | [PointCloud Transformation](example_11.md) | Convert PointCloud2 data to a PointCloud and transform to a different frame.|

6 changes: 3 additions & 3 deletions ros2/align_to_aruco.md
Expand Up @@ -4,7 +4,7 @@ ArUco markers are a type of fiducials that are used extensively in robotics for
## ArUco Detection
Stretch uses the OpenCV ArUco detection library and is configured to identify a specific set of ArUco markers belonging to the 6x6, 250 dictionary. To understand why this is important, please refer to [this](https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html) handy guide provided by OpenCV.

Stretch comes preconfigured to identify ArUco markers. The ROS node that enables this is the detect_aruco_markers [node](https://github.com/hello-robot/stretch_ros2/blob/galactic/stretch_core/stretch_core/detect_aruco_markers.py) in the stretch_core package. Thanks to this node, identifying and estimating the pose of a marker is as easy as pointing the camera at the marker and running the detection node. It is also possible and quite convenient to visualize the detections with RViz.
Stretch comes preconfigured to identify ArUco markers. The ROS node that enables this is the detect_aruco_markers [node](https://github.com/hello-robot/stretch_ros2/blob/humble/stretch_core/stretch_core/detect_aruco_markers.py) in the stretch_core package. Thanks to this node, identifying and estimating the pose of a marker is as easy as pointing the camera at the marker and running the detection node. It is also possible and quite convenient to visualize the detections with RViz.

## Computing Transformations
If you have not already done so, now might be a good time to review the [tf listener](https://docs.hello-robot.com/0.2/stretch-tutorials/ros2/example_10/) tutorial. Go on, we can wait…
Expand Down Expand Up @@ -50,7 +50,7 @@ ros2 launch stretch_core align_to_aruco.launch.py
</p>

## Code Breakdown
Let's jump into the code to see how things work under the hood. Follow along [here](https://github.com/hello-robot/stretch_ros2/blob/galactic/stretch_core/stretch_core/align_to_aruco.py) to have a look at the entire script.
Let's jump into the code to see how things work under the hood. Follow along [here](https://github.com/hello-robot/stretch_ros2/blob/humble/stretch_core/stretch_core/align_to_aruco.py) to have a look at the entire script.

We make use of two separate Python classes for this demo. The FrameListener class is derived from the Node class and is the place where we compute the TF transformations. For an explantion of this class, you can refer to the [TF listener](https://docs.hello-robot.com/0.2/stretch-tutorials/ros2/example_10/) tutorial.
```python
Expand Down Expand Up @@ -118,4 +118,4 @@ The align_to_marker() method is where we command Stretch to the pose goal in thr
def align_to_marker(self):
```

If you want to work with a different ArUco marker than the one we used in this tutorial, you can do so by changing line 44 in the [code](https://github.com/hello-robot/stretch_ros2/blob/galactic/stretch_core/stretch_core/align_to_aruco.py#L44) to the one you wish to detect. Also, don't forget to add the marker in the [stretch_marker_dict.yaml](https://github.com/hello-robot/stretch_ros2/blob/galactic/stretch_core/config/stretch_marker_dict.yaml) ArUco marker dictionary.
If you want to work with a different ArUco marker than the one we used in this tutorial, you can do so by changing line 44 in the [code](https://github.com/hello-robot/stretch_ros2/blob/humble/stretch_core/stretch_core/align_to_aruco.py#L44) to the one you wish to detect. Also, don't forget to add the marker in the [stretch_marker_dict.yaml](https://github.com/hello-robot/stretch_ros2/blob/humble/stretch_core/config/stretch_marker_dict.yaml) ArUco marker dictionary.