diff --git a/docs/integrations/software/aruco-tracking.mdx b/docs/integrations/software/aruco-tracking.mdx index 9945e6d7..6c5248c2 100644 --- a/docs/integrations/software/aruco-tracking.mdx +++ b/docs/integrations/software/aruco-tracking.mdx @@ -25,10 +25,6 @@ vision to support tasks such as localization, mapping, and navigation. These visual markers provide a reliable, easily detectable point of reference that helps robots perceive and interpret their environment with precision. -In this example, we will use -[ros_aruco_opencv](https://github.com/fictionlab/ros_aruco_opencv/tree/jazzy) -package for detecting individual markers. - As sending raw images from the camera via wireless network may be insufficient, we will relay all the processing to the Raspberry Pi. @@ -42,7 +38,8 @@ we will relay all the processing to the Raspberry Pi. ## What to expect? -After this tutorial is completed, you should end up with something like this: +After this tutorial is completed, you will be able to detect and visualize ArUco +tags like this:
-Install `aruco-opencv` package: +Start ArUco tracking by setting the corresponding environment variable to `true` +in `/etc/ros/setup.bash`: -```bash -sudo apt install ros-${ROS_DISTRO}-aruco-opencv +```bash title="/etc/ros/setup.bash" +export START_ARUCO_TRACKING=true ``` -### Creating launch and configuration files - -To launch the tracker, you can use the launch file from the installed -`aruco-opencv` package or you can create your own. In this guide, we will show -you how to create a launch file which provides basic config for detecting single -markers. - -In `/etc/ros`, create a `yaml` configuration file. This simple example sets the -basic parameters for the node. - -```yaml title="/etc/ros/tracker.yaml" -/**: - ros__parameters: - cam_base_topic: camera/image_color - output_frame: 'base_link' +And restart the ROS nodes: - marker_dict: 4X4_50 - - publish_tf: true - marker_size: 0.15 - - aruco: - adaptiveThreshWinSizeMin: 3 - adaptiveThreshWinSizeMax: 23 - adaptiveThreshWinSizeStep: 10 +```bash +ros-nodes-restart ``` :::info -You will most likely need to change marker_size parameter depending on the -actual size of your printed ArUco tag. +ArUco tracker configuration can be found in `/etc/ros/aruco_tracker.yaml`. By +default it is configured to track markers from `4X4_50` ArUco dictionary with +marker side size of 15cm. If you plan to use different sizes or dictionaries for +your ArUco markers, `/etc/ros/aruco_tracker.yaml` has to be adjusted +appropriately. -The parameters in `aruco` namespace are dynamic reconfigure parameters - which -means you can change them as the node is working using `rqt` (in -`dynamic reconfigure` plugin). You can play with their values and then add -chosen parameters to the `yaml` file. +The parameters in the `aruco` namespace can be changed at runtime while the node +is working - either with `ros2 param set` or using the `rqt_reconfigure` GUI +tool. Feel free to play around with different configurations and then add the +chosen parameters to the `/etc/ros/aruco_tracker.yaml` file. You can find a detailed description of each parameter in the `aruco` namespace [here](https://docs.opencv.org/4.6.0/d5/dae/tutorial_aruco_detection.html). ::: -Next, also in `/etc/ros`, create a launch file that will use the previously -added configuration with the tracker node. - -```xml title="/etc/ros/tracker.launch.xml" - - - - - -``` - -Now you can run the tracker with this command: - -```bash -ros2 launch /etc/ros/tracker.launch.xml -``` - -or you can include your launch file in the `robot.launch.xml` file so that the -node will start at boot. To do so, put this line somewhere before the closing -`` tag. - -```xml title="/etc/ros/robot.launch.xml" - -``` - -Now you need to reboot the rover, or restart the ros nodes - -```bash -ros-nodes-restart -``` +## Example usage -## Generate ArUco markers +### Generating ArUco markers Now, we need to create some markers, so go back to your computer. @@ -247,17 +201,17 @@ Open RViz by typing `rviz2` in the terminal and set Fixed Frame to `base_link`. Now on the Displays panel click **Add** -> **By display type** and search for -`TF` and click **Ok**. +`TF` and click **OK**. As there are many TF frames for the rover itself, to make it easier to @@ -268,8 +222,8 @@ check their boxes to make them appear in RViz. :::tip @@ -287,8 +241,8 @@ choose `Image` display. Click it and confirm with **Ok**. Your final setup should look more or less like this: @@ -296,15 +250,17 @@ Your final setup should look more or less like this: -## What next? +## What's next? -With this tutorial completed you may be wondering what to do next. Our pick -would be the [ARTag follower](/leo-rover/1.8/leo-examples/follow-artag). -However, you can check out other examples from leo_examples repository (like -[line follower](/leo-rover/1.8/leo-examples/line-follower) and -[object detection](/leo-rover/1.8/leo-examples/object-detection)). You can also -check out other integrations from our [Integrations site](/integrations). +After adding ArUco tag detection capabilities to your robot, you might be +interested in making the Leo Rover follow the markers. For that, you can check +out the [follow ArUco marker example](/leo-rover/leo-examples/follow-marker). +You can also check out other examples from leo_examples repository (like +[line follower](/leo-rover/leo-examples/line-follower) and +[object detection](/leo-rover/leo-examples/object-detection)). If you are +looking to add more sensors to your Leo Rover, take a look at our +[integrations](/integrations). diff --git a/docs/leo-rover/leo-examples/follow-marker.mdx b/docs/leo-rover/leo-examples/follow-marker.mdx index da54643e..6b1443db 100644 --- a/docs/leo-rover/leo-examples/follow-marker.mdx +++ b/docs/leo-rover/leo-examples/follow-marker.mdx @@ -1,6 +1,6 @@ --- -title: 'Leo Rover Example: How to Follow an Aruco Marker' -sidebar_label: Follow Aruco Marker +title: 'Leo Rover Example: How to Follow an ArUco Marker' +sidebar_label: Follow ArUco Marker sidebar_position: 1 keywords: - aruco @@ -13,22 +13,22 @@ keywords: - rover - tutorial description: >- - Learn how to make a Leo Rover mobile robot follow a printed Aruco Marker. + Learn how to make a Leo Rover mobile robot follow a printed ArUco Marker. Print the marker and run the example code to get started. image: /img/robots/leo/integrations/follow-aruco-marker/follow-aruco-1.webp --- -# Example: How to Follow an Aruco Marker +# Example: How to Follow an ArUco Marker import LiteYouTubeEmbed from 'react-lite-youtube-embed'; In this example, we will show you how to make the Leo Rover mobile robot follow -an Aruco marker. +an ArUco marker. ## What to expect? After completing this tutorial, your rover should be able to follow a printed -Aruco Marker. +ArUco Marker.
For details on each of those parameters, check the ::: +:::tip + +If you started ArUco tracking via `START_ARUCO_TRACKING=true` (rather than the +`start_aruco_tracker:=true` launch argument), tracker parameter changes can be +made persistent by editing `/etc/ros/aruco_tracker.yaml` on the rover. + +::: + #### Follower Each parameter of the `aruco_follower` node includes a built-in description - @@ -249,7 +287,40 @@ rover's movement. The remaining parameters control the rover's driving and rotation speeds, as well as the distance thresholds that determine when it should move or stop. -## What next? +#### Using a custom follower parameters file + +To reuse your follower parameter settings across runs, create a `yaml` +configuration file in `/etc/ros` on the rover: + +```yaml title="/etc/ros/aruco_follower_params.yaml" +/**: + ros__parameters: + follow_id: 3 + marker_timeout: 1.0 + + min_ang_vel: 0.1 + max_ang_vel: 1.0 + angle_min: 0.1 + angle_max: 0.7 + + min_lin_vel_forward: 0.1 + max_lin_vel_forward: 0.4 + distance_min_forward: 0.7 + distance_max_forward: 1.2 + + min_lin_vel_reverse: 0.1 + max_lin_vel_reverse: 0.2 + distance_min_reverse: 0.4 + distance_max_reverse: 0.5 +``` + +Then pass it to the launch command using the `params_file` argument: + +```bash +ros2 launch leo_example_follow_aruco_marker follow_aruco_marker.launch.xml params_file:=/etc/ros/aruco_follower_params.yaml +``` + +## What's next? After completing this tutorial, you can try other examples from the leo_examples repository ([line follower](line-follower) and diff --git a/static/img/robots/leo/integrations/aruco-tracking/rviz-add-tf.webp b/static/img/robots/leo/integrations/aruco-tracking/rviz-add-tf.webp index e5aa614b..2cb587d1 100644 Binary files a/static/img/robots/leo/integrations/aruco-tracking/rviz-add-tf.webp and b/static/img/robots/leo/integrations/aruco-tracking/rviz-add-tf.webp differ diff --git a/static/img/robots/leo/integrations/aruco-tracking/rviz-aruco-image.webp b/static/img/robots/leo/integrations/aruco-tracking/rviz-aruco-image.webp index a4880bcc..5e9ef41e 100644 Binary files a/static/img/robots/leo/integrations/aruco-tracking/rviz-aruco-image.webp and b/static/img/robots/leo/integrations/aruco-tracking/rviz-aruco-image.webp differ diff --git a/static/img/robots/leo/integrations/aruco-tracking/rviz-fixed-frame.webp b/static/img/robots/leo/integrations/aruco-tracking/rviz-fixed-frame.webp index 71a6757a..d1293ebc 100644 Binary files a/static/img/robots/leo/integrations/aruco-tracking/rviz-fixed-frame.webp and b/static/img/robots/leo/integrations/aruco-tracking/rviz-fixed-frame.webp differ diff --git a/static/img/robots/leo/integrations/aruco-tracking/rviz-setup-final.webp b/static/img/robots/leo/integrations/aruco-tracking/rviz-setup-final.webp index b5316a39..e6273531 100644 Binary files a/static/img/robots/leo/integrations/aruco-tracking/rviz-setup-final.webp and b/static/img/robots/leo/integrations/aruco-tracking/rviz-setup-final.webp differ diff --git a/static/img/robots/leo/integrations/aruco-tracking/rviz-tf-instructions.webp b/static/img/robots/leo/integrations/aruco-tracking/rviz-tf-instructions.webp index 0bcfc233..9263ba9d 100644 Binary files a/static/img/robots/leo/integrations/aruco-tracking/rviz-tf-instructions.webp and b/static/img/robots/leo/integrations/aruco-tracking/rviz-tf-instructions.webp differ