-
Notifications
You must be signed in to change notification settings - Fork 406
Added ar_track_alvar_example #325
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| cmake_minimum_required(VERSION 2.8.7) | ||
|
|
||
| project(zed_ar_track_alvar_example) | ||
|
|
||
| find_package(catkin REQUIRED) | ||
|
|
||
| catkin_package() | ||
|
|
||
| ############################################################################### | ||
| #Add all files in subdirectories of the project in | ||
| # a dummy_target so qtcreator have access to all files | ||
| FILE(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) | ||
| add_custom_target(dummy_${PROJECT_NAME} SOURCES ${extra_files}) | ||
|
|
||
| ############################################################################### | ||
| # INSTALL | ||
|
|
||
| install(DIRECTORY | ||
| launch | ||
| DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Stereolabs ZED Camera - Alvar AR tag example | ||
|
|
||
| This package shows how to use the ZED Wrapper with [ar_track_alvar](http://wiki.ros.org/ar_track_alvar) to detect AR markers and localize them in the space. | ||
|
|
||
| The [ar_track_alvar](http://wiki.ros.org/ar_track_alvar) package is a ROS wrapper for [Alvar](http://virtual.vtt.fi/virtual/proj2/multimedia/index.html), an open source AR tag tracking library. | ||
|
|
||
| ## Install the ar_track_alvar package | ||
|
|
||
| Open a terminal and launch | ||
|
|
||
| $ sudo apt install ros-kinetic-ar-track-alvar | ||
|
|
||
| ## Run the program | ||
|
|
||
| To launch the example, open a terminal and launch: | ||
|
|
||
| $ roslaunch zed_ar_track_alvar_example zed_ar_track_alvar.launch | ||
|
|
||
| The launch file automatically starts the `zed_wrapper` node, the `ar_track_alvar` node and `RVIZ` with a preconfigured view: | ||
|
|
||
|  | ||
|
|
||
| * the `Left Image` view shows the RGB stream from the left camera of the ZED. | ||
| * the `Left Camera` view shows the "world" as seen by the left camera. The `TF` and the `Tags` are selected to be shown in 3D projection | ||
| * the 3D view shows the ZED camera localized in the space and the position of the `Tags` as coloured markers. | ||
|
|
||
| *Note* It is important to subscribe the `/zed/pose` topic to be able to localize the camera in the space. | ||
|
|
||
| *Note* the tags used in the example are available following this [link](images/markers0to8.png) | ||
|
|
||
| ## The launch file explained | ||
|
|
||
| To use the ZED wrapper with the `ar_track_alvar` node we need to correctly set the following ar_track_alvar parameters: | ||
|
|
||
| - `camera_image` -> the name of the topic that provides camera frames for detecting the AR tags. | ||
| - `camera_info` -> the name of the topic of camera parameters used to correctly localize the tag in the 3D world | ||
| - `output_frame` -> the name of the TF frame associated to the camera position | ||
|
|
||
| It is important that the `zed_wrapper` node and the `ar_track_alvar` node use the same values for these three parameters to be able to correctly communicate. | ||
|
|
||
| The values associated to the above parameters are the following: | ||
|
|
||
| ``` | ||
| <arg name="cam_image_topic" default="rgb/image_rect_color" /> | ||
| <arg name="cam_info_topic" default="rgb/camera_info" /> | ||
| <arg name="camera_frame" default="zed_left_camera_frame" /> | ||
| ``` | ||
|
|
||
| The corresponding parameters of the ZED node are the following: | ||
|
|
||
| - `cam_image_topic` -> `rgb_topic` | ||
| - `cam_info_topic` -> `rgb_info_topic` | ||
| - `camera_frame` -> `left_camera_frame` | ||
|
|
||
| The corresponding parameters of the `rtabmap_ros` node are the following: | ||
|
|
||
| - `cam_image_topic` -> `camera_image` | ||
| - `cam_info_topic` -> `camera_info` | ||
| - `camera_frame` -> `output_frame` | ||
|
|
||
| It is also important to set the correct `marker_size` in centimeters. Better if the real size of the markers is measured after printing them: | ||
|
|
||
| <arg name="marker_size" default="5.0" /> | ||
|
|
||
| Other parameters that can be tuned: | ||
| * `max_new_marker_error` -> A threshold determining when new markers can be detected under uncertainty | ||
| * `max_track_error` -> A threshold determining how much tracking error can be observed before an tag is considered to have disappeared | ||
|
|
||
| Their values in the launch file: | ||
|
|
||
| <arg name="max_new_marker_error" default="0.08" /> | ||
| <arg name="max_track_error" default="0.2" /> | ||
|
|
||
| ## Markers | ||
|
|
||
| Following two examples of markers with ID numbers from 0 to 17: | ||
|
|
||
|  | ||
|  | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions
71
examples/zed_ar_track_alvar_example/launch/zed_ar_track_alvar.launch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <?xml version="1.0"?> | ||
| <!-- | ||
| Copyright (c) 2018, STEREOLABS. | ||
|
|
||
| All rights reserved. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| --> | ||
| <launch> | ||
| <arg name="zed_namespace" default="zed" /> | ||
|
|
||
| <arg name="svo_file" default="" /> <!-- <arg name="svo_file" default="path/to/svo/file.svo"> --> | ||
|
|
||
| <arg name="camera_model" default="1" /> | ||
| <arg name="serial_number" default="0" /> | ||
| <arg name="verbose" default="true" /> | ||
| <arg name="resolution" default="2" /> <!--0=RESOLUTION_HD2K, 1=RESOLUTION_HD1080, 2=RESOLUTION_HD720, 3=RESOLUTION_VGA --> | ||
| <arg name="frame_rate" default="30" /> | ||
| <!-- RESOLUTION_HD2K -> 2208*1242, available framerates: 15 fps. | ||
| RESOLUTION_HD1080 -> 1920*1080, available framerates: 15, 30 fps. | ||
| RESOLUTION_HD720 -> 1280*720, available framerates: 15, 30, 60 fps. | ||
| RESOLUTION_VGA -> 672*376, available framerates: 15, 30, 60, 100 fps. --> | ||
|
|
||
| <arg name="cam_image_topic" default="rgb/image_rect_color" /> | ||
| <arg name="cam_info_topic" default="rgb/camera_info" /> | ||
| <arg name="camera_frame" default="zed_left_camera_frame" /> | ||
|
|
||
| <group ns="$(arg zed_namespace)"> | ||
| <!-- Pre configured RVIZ --> | ||
| <node name="rviz" pkg="rviz" type="rviz" args="-d $(find zed_ar_track_alvar_example)/rviz/zed_ar_track_alvar_example.rviz" output="screen"/> | ||
|
|
||
| <!-- ZED Wrapper Node--> | ||
| <include file="$(find zed_wrapper)/launch/zed_camera.launch"> | ||
| <arg name="svo_file" value="$(arg svo_file)" /> | ||
| <arg name="camera_model" value="$(arg camera_model)" /> | ||
| <arg name="serial_number" value="$(arg serial_number)" /> | ||
| <arg name="resolution" value="$(arg resolution)" /> | ||
| <arg name="frame_rate" value="$(arg frame_rate)" /> | ||
| <arg name="verbose" value="$(arg verbose)" /> | ||
|
|
||
| <arg name="rgb_topic" value="$(arg cam_image_topic)" /> | ||
| <arg name="rgb_info_topic" value="$(arg cam_info_topic)" /> | ||
| <arg name="left_camera_frame" value="$(arg camera_frame)" /> | ||
| </include> | ||
|
|
||
| <!-- ar_track_alvar Node --> | ||
| <arg name="marker_size" default="5.0" /> | ||
| <arg name="max_new_marker_error" default="0.08" /> | ||
| <arg name="max_track_error" default="0.2" /> | ||
|
|
||
| <node name="ar_track_alvar" pkg="ar_track_alvar" type="individualMarkersNoKinect" respawn="false" output="screen"> | ||
| <param name="marker_size" type="double" value="$(arg marker_size)" /> | ||
| <param name="max_new_marker_error" type="double" value="$(arg max_new_marker_error)" /> | ||
| <param name="max_track_error" type="double" value="$(arg max_track_error)" /> | ||
| <param name="output_frame" type="string" value="$(arg camera_frame)" /> | ||
|
|
||
| <remap from="camera_image" to="$(arg cam_image_topic)" /> | ||
| <remap from="camera_info" to="$(arg cam_info_topic)" /> | ||
| </node> | ||
| </group> | ||
| </launch> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0"?> | ||
| <package format="2"> | ||
| <name>zed_ar_track_alvar_example</name> | ||
| <version>2.6.0</version> | ||
| <description> | ||
| "zed_ar_track_alvar_example" is a ROS package to show how to use the ROS wrapper with <a href="http://wiki.ros.org/ar_track_alvar">"ar_track_alvar"</a> | ||
| </description> | ||
|
|
||
| <maintainer email="[email protected]">STEREOLABS</maintainer> | ||
| <license>MIT</license> | ||
|
|
||
| <buildtool_depend>catkin</buildtool_depend> | ||
|
|
||
| <exec_depend>ar_track_alvar</exec_depend> | ||
| <exec_depend>ar_track_alvar_msgs</exec_depend> | ||
| <exec_depend>zed_wrapper</exec_depend> | ||
| </package> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.