├── .editorconfig ├── .github └── workflows │ └── main.yml ├── .gitignore ├── LICENSE ├── README.md ├── docs ├── Gemfile ├── _config.yml ├── _layouts │ └── plugin.md ├── _plugins │ ├── attitude_indicator.md │ ├── coordinate_picker.md │ ├── disparity.md │ ├── draw_polygon.md │ ├── float.md │ ├── gps.md │ ├── grid.md │ ├── image.md │ ├── laserscan.md │ ├── marker.md │ ├── measuring.md │ ├── move_base.md │ ├── multires_image.md │ ├── navsat.md │ ├── occupancy_grid.md │ ├── odometry.md │ ├── path.md │ ├── plan_route.md │ ├── point_click_publisher.md │ ├── point_drawing.md │ ├── pointcloud2.md │ ├── pose.md │ ├── robot_image.md │ ├── route.md │ ├── string.md │ ├── textured_marker.md │ ├── tf_frame.md │ └── tile_map.md ├── assets │ ├── images │ │ ├── add-plugin.png │ │ ├── aerial-imagery.png │ │ ├── bulk-download.png │ │ ├── choose-resolution.png │ │ ├── configure-wmts-source.png │ │ ├── disparity.png │ │ ├── draw-geometry.png │ │ ├── example-map.png │ │ ├── extra-criteria.png │ │ ├── item-basket.png │ │ ├── mapviz.png │ │ ├── mapviz_features.png │ │ ├── multires.png │ │ ├── multires2.png │ │ ├── pick-data.png │ │ ├── results.png │ │ ├── roads.png │ │ ├── satellite-imagery.png │ │ ├── satellite.png │ │ ├── screenshot_coordinate_picker.png │ │ ├── select-geometry.png │ │ ├── set-frames.png │ │ ├── terrain.png │ │ ├── toner.png │ │ └── watercolor.png │ └── js │ │ └── search-data.json ├── guides.md ├── guides │ ├── imagery_usgs_earth_explorer.md │ ├── local_tile_map_imagery.md │ └── local_tile_map_imagery.mg ├── index.md └── plugins.md ├── mapviz ├── CHANGELOG.rst ├── CMakeLists.txt ├── include │ └── mapviz │ │ ├── color_button.h │ │ ├── config_item.h │ │ ├── map_canvas.h │ │ ├── mapviz.hpp │ │ ├── mapviz_application.h │ │ ├── mapviz_plugin.h │ │ ├── rqt_mapviz.h │ │ ├── select_frame_dialog.h │ │ ├── select_service_dialog.h │ │ ├── stopwatch.h │ │ ├── video_writer.h │ │ └── widgets.h ├── launch │ ├── mapviz.launch.py │ └── mapviz.launch.xml ├── mainpage.dox ├── package.xml ├── plugin.xml ├── src │ ├── color_button.cpp │ ├── config_item.cpp │ ├── map_canvas.cpp │ ├── mapviz.cpp │ ├── mapviz_application.cpp │ ├── mapviz_main.cpp │ ├── resources │ │ ├── LICENSE │ │ ├── arrow_in.png │ │ ├── green-arrow.png │ │ ├── icons.qrc │ │ ├── image-x-generic.png │ │ ├── media-playback-pause.png │ │ ├── media-playback-stop.png │ │ ├── media-record.png │ │ └── remove-icon-th.png │ ├── rqt_mapviz.cpp │ ├── select_frame_dialog.cpp │ ├── select_service_dialog.cpp │ └── video_writer.cpp └── ui │ ├── configitem.ui │ ├── mapviz.ui │ └── pluginselect.ui ├── mapviz_interfaces ├── CHANGELOG.rst ├── CMakeLists.txt ├── package.xml └── srv │ └── AddMapvizDisplay.srv ├── mapviz_plugins ├── CHANGELOG.rst ├── CMakeLists.txt ├── include │ └── mapviz_plugins │ │ ├── attitude_indicator_plugin.h │ │ ├── canvas_click_filter.h │ │ ├── coordinate_picker_plugin.h │ │ ├── disparity_plugin.h │ │ ├── draw_polygon_plugin.h │ │ ├── float_plugin.h │ │ ├── gps_plugin.h │ │ ├── grid_plugin.h │ │ ├── image_plugin.h │ │ ├── laserscan_plugin.h │ │ ├── marker_plugin.h │ │ ├── measuring_plugin.h │ │ ├── move_base_plugin.h │ │ ├── navsat_plugin.h │ │ ├── occupancy_grid_plugin.h │ │ ├── odometry_plugin.h │ │ ├── path_plugin.h │ │ ├── placeable_window_proxy.h │ │ ├── plan_route_plugin.h │ │ ├── point_click_publisher_plugin.h │ │ ├── point_drawing_plugin.h │ │ ├── pointcloud2_plugin.h │ │ ├── pose_plugin.h │ │ ├── robot_image_plugin.h │ │ ├── route_plugin.h │ │ ├── string_plugin.h │ │ ├── textured_marker_plugin.h │ │ ├── tf_frame_plugin.h │ │ └── topic_select.h ├── mainpage.dox ├── mapviz_plugins.xml ├── package.xml ├── src │ ├── attitude_indicator_plugin.cpp │ ├── canvas_click_filter.cpp │ ├── coordinate_picker_plugin.cpp │ ├── disparity_plugin.cpp │ ├── draw_polygon_plugin.cpp │ ├── float_plugin.cpp │ ├── gps_plugin.cpp │ ├── grid_plugin.cpp │ ├── image_plugin.cpp │ ├── laserscan_plugin.cpp │ ├── marker_plugin.cpp │ ├── measuring_plugin.cpp │ ├── move_base_plugin.cpp │ ├── navsat_plugin.cpp │ ├── occupancy_grid_plugin.cpp │ ├── odometry_plugin.cpp │ ├── path_plugin.cpp │ ├── placeable_window_proxy.cpp │ ├── plan_route_plugin.cpp │ ├── point_click_publisher_plugin.cpp │ ├── point_drawing_plugin.cpp │ ├── pointcloud2_plugin.cpp │ ├── pose_plugin.cpp │ ├── robot_image_plugin.cpp │ ├── route_plugin.cpp │ ├── string_plugin.cpp │ ├── textured_marker_plugin.cpp │ ├── tf_frame_plugin.cpp │ └── topic_select.cpp └── ui │ ├── attitude_indicator_config.ui │ ├── coordinate_picker_config.ui │ ├── disparity_config.ui │ ├── draw_polygon_config.ui │ ├── float_config.ui │ ├── gps_config.ui │ ├── grid_config.ui │ ├── image_config.ui │ ├── laserscan_config.ui │ ├── marker_config.ui │ ├── measuring_config.ui │ ├── move_base_config.ui │ ├── navsat_config.ui │ ├── occupancy_grid_config.ui │ ├── odometry_config.ui │ ├── path_config.ui │ ├── plan_route_config.ui │ ├── point_click_publisher_config.ui │ ├── pointcloud2_config.ui │ ├── pose_config.ui │ ├── robot_image_config.ui │ ├── route_config.ui │ ├── string_config.ui │ ├── textured_marker_config.ui │ ├── tf_frame_config.ui │ └── topicselect.ui ├── multires_image ├── CHANGELOG.rst ├── CMakeLists.txt ├── include │ └── multires_image │ │ ├── QGLMap.h │ │ ├── multires_image_plugin.h │ │ ├── multires_view.h │ │ ├── multires_view_node.h │ │ ├── tile.h │ │ ├── tile_cache.h │ │ ├── tile_set.h │ │ ├── tile_set_layer.h │ │ └── tile_view.h ├── launch │ ├── mapviz_tile_loader.launch │ └── multires.launch ├── mainpage.dox ├── mapviz_plugins.xml ├── nodes │ └── mapviz_tile_loader ├── package.xml ├── src │ ├── QGLMap.cpp │ ├── QGLMap.ui │ ├── multires_config.ui │ ├── multires_image_plugin.cpp │ ├── multires_view.cpp │ ├── nodes │ │ └── multires_view_node.cpp │ ├── tile.cpp │ ├── tile_cache.cpp │ ├── tile_set.cpp │ ├── tile_set_layer.cpp │ └── tile_view.cpp └── test.geo └── tile_map ├── CHANGELOG.rst ├── CMakeLists.txt ├── include └── tile_map │ ├── bing_source.h │ ├── image_cache.h │ ├── texture_cache.h │ ├── tile_map_plugin.h │ ├── tile_map_view.h │ ├── tile_source.h │ └── wmts_source.h ├── mapviz_plugins.xml ├── package.xml └── src ├── bing_source.cpp ├── image_cache.cpp ├── texture_cache.cpp ├── tile_map_config.ui ├── tile_map_plugin.cpp ├── tile_map_view.cpp ├── tile_source.cpp └── wmts_source.cpp /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 100 11 | 12 | # Use 4 spaces for the Python files 13 | [*.py] 14 | indent_size = 4 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | industrial_ci: 7 | strategy: 8 | matrix: 9 | env: 10 | - {ROS_DISTRO: humble, ROS_REPO: testing} 11 | - {ROS_DISTRO: humble, ROS_REPO: main} 12 | - {ROS_DISTRO: jazzy, ROS_REPO: testing, PIP_BREAK_SYSTEM_PACKAGES: True} 13 | - {ROS_DISTRO: jazzy, ROS_REPO: main, PIP_BREAK_SYSTEM_PACKAGES: True} 14 | - {ROS_DISTRO: kilted, ROS_REPO: testing, PIP_BREAK_SYSTEM_PACKAGES: True} 15 | - {ROS_DISTRO: kilted, ROS_REPO: main, PIP_BREAK_SYSTEM_PACKAGES: True} 16 | - {ROS_DISTRO: rolling, ROS_REPO: testing, PIP_BREAK_SYSTEM_PACKAGES: True} 17 | - {ROS_DISTRO: rolling, ROS_REPO: main, PIP_BREAK_SYSTEM_PACKAGES: True} 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: 'ros-industrial/industrial_ci@master' 22 | env: ${{matrix.env}} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.cproject 2 | *.project 3 | *.pydevproject 4 | *cmake_install.cmake 5 | *.tar.gz 6 | *.tgz 7 | *.orig 8 | *.bag 9 | *~ 10 | .idea 11 | _gtest_from_src/ 12 | bin/ 13 | build/ 14 | msg_gen/ 15 | srv_gen/ 16 | *.cfgc 17 | version.txt 18 | cmake-build-debug/ 19 | .vscode/ 20 | Gemfile.lock 21 | _site/ 22 | venv/ 23 | __pycache__/ 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Southwest Research Institute® (SwRI®) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of Southwest Research Institute® (SwRI®) nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Mapviz 2 | ====== 3 | | Humble | Jazzy | Kilted | Rolling | 4 | | :--- | :--- | :--- | :--- | 5 | | [![Build Status](https://build.ros2.org/job/Hbin_uJ64__mapviz__ubuntu_jammy_amd64__binary/badge/icon)](https://build.ros2.org/job/Hbin_uJ64__mapviz__ubuntu_jammy_amd64__binary/) | [![Build Status](https://build.ros2.org/job/Jbin_uN64__mapviz__ubuntu_noble_amd64__binary/badge/icon)](https://build.ros2.org/job/Jbin_uN64__mapviz__ubuntu_noble_amd64__binary/) | [![Build Status](https://build.ros2.org/job/Kbin_uN64__mapviz__ubuntu_noble_amd64__binary/badge/icon)](https://build.ros2.org/job/Kbin_uN64__mapviz__ubuntu_noble_amd64__binary/) | [![Build Status](https://build.ros2.org/job/Rbin_uN64__mapviz__ubuntu_noble_amd64__binary/badge/icon)](https://build.ros2.org/job/Rbin_uN64__mapviz__ubuntu_noble_amd64__binary/) 6 | 7 | Mapviz is a [ROS](http://www.ros.org/) based visualization tool with a plug-in system similar to [RVIZ](http://wiki.ros.org/rviz) focused on visualizing 2D data. 8 | 9 | ![](https://github.com/swri-robotics/mapviz/wiki/mapviz.png) 10 | 11 | Usage 12 | ----- 13 | 14 | [View the documentation](https://swri-robotics.github.io/mapviz/) for usage information. 15 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages', group: :jekyll_plugins 3 | gem 'just-the-docs' 4 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | title: "Mapviz" 2 | description: Modular ROS visualization tool for 2D data 3 | baseurl: "/mapviz" # the subpath of your site, e.g. /blog 4 | url: "https://swri-robotics.github.io" # the base hostname & protocol for your site, e.g. http://example.com 5 | remote_theme: pmarsceill/just-the-docs 6 | 7 | permalink: /:title/ 8 | exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"] 9 | 10 | # Set a path/url to a logo that will be displayed instead of the title 11 | #logo: "/assets/images/just-the-docs.png" 12 | 13 | # Enable or disable the site search 14 | search_enabled: true 15 | 16 | # Set the search token separator for hyphenated-word search: 17 | search_tokenizer_separator: /[\s/]+/ 18 | 19 | # Enable or disable heading anchors 20 | heading_anchors: true 21 | 22 | # Aux links for the upper right navigation 23 | aux_links: 24 | "Mapviz on GitHub": 25 | - "//github.com/swri-robotics/mapviz" 26 | 27 | # Footer content appears at the bottom of every page's main content 28 | footer_content: "Copyright © 2024 Southwest Research Institute. Distributed under the BSD 3-Clause license." 29 | 30 | # Color scheme currently only supports "dark" or nil (default) 31 | color_scheme: nil 32 | 33 | # Google Analytics Tracking (optional) 34 | # e.g, UA-1234567-89 35 | # ga_tracking: 36 | 37 | plugins: 38 | - jekyll-seo-tag 39 | 40 | collections: 41 | plugins: 42 | output: true 43 | 44 | defaults: 45 | - scope: 46 | path: '' 47 | type: 'plugins' 48 | values: 49 | layout: 'plugin' 50 | parent: 'Plugins' 51 | 52 | compress_html: 53 | clippings: all 54 | comments: all 55 | endings: all 56 | startings: [] 57 | blanklines: false 58 | profile: false 59 | 60 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /docs/_layouts/plugin.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | {% capture content %} 6 | 7 | # {{ page.title }} 8 | 9 | {{ page.description }} 10 | 11 | {% if page.image and page.image != "" %} 12 | ![]({{ site.baseurl | append: '/assets/images/' }}{{ page.image }}) 13 | {% endif %} 14 | 15 | ## Parameters 16 | 17 | {% if page.parameters %} 18 | {% for param in page.parameters %} 19 | | {{ param.name }} | {{ param.description | replace: "|","/"}} | 20 | {%- endfor -%} 21 | {% else %} 22 | No parameters. 23 | {% endif %} 24 | 25 | {% endcapture %} 26 | 27 | {{ content | markdownify }} 28 | -------------------------------------------------------------------------------- /docs/_plugins/attitude_indicator.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Attitude Indicator" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/coordinate_picker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Coordinate Picker" 3 | description: "Transforms coordinates of clicked points on the map to a specified frame. The most recent coordinate is placed on the clipboard, and a list of coordinates is displayed in the GUI." 4 | image: "screenshot_coordinate_picker.png" 5 | parameters: 6 | - name: frame 7 | description: "Coordinate frame into which to transform the clicked point" 8 | --- 9 | -------------------------------------------------------------------------------- /docs/_plugins/disparity.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Disparity" 3 | description: "Overlays a [sensor_msgs::DisparityImage](http://docs.ros.org/api/stereo_msgs/html/msg/DisparityImage.html) onto the display using the ''jet'' color map." 4 | image: "disparity.png" 5 | parameters: 6 | - name: Topic 7 | description: The disparity topic name 8 | - name: Anchor 9 | description: (top left | top center | top right | center left | center | center right | bottom left | bottom center | bottom right) 10 | - name: Offset X 11 | description: Display offset from the left 12 | - name: Offset Y 13 | description: Display offset from the top 14 | - name: Width 15 | description: Display width 16 | - name: Height 17 | description: Display height 18 | - name: Units 19 | description: (pixels | percent of window) 20 | --- 21 | -------------------------------------------------------------------------------- /docs/_plugins/draw_polygon.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Draw Polygon" 3 | description: "Draw a polygon on the canvas and publish to a topic." 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/float.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Float" 3 | description: "Displays the most recent value from a `std_msgs::Float32/64, marti_common_msgs/Float32/64Stamped` or a `marti_sensor_msgs/Velocity` message at a fixed location on the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The float topic" 8 | - name: "Font" 9 | description: "The font for rendering the float" 10 | - name: "Color" 11 | description: "The color for drawing the float" 12 | - name: "Anchor" 13 | description: "(top left | top center | top right | center left | center | center right | bottom left | bottom center | bottom right)" 14 | - name: "Offset X" 15 | description: "Horizontal offset from the anchor" 16 | - name: "Offset Y" 17 | description: "Vertical offset from the anchor" 18 | - name: "Units" 19 | description: "(pixels | percent of window)" 20 | - name: "Postfix" 21 | description: "Text to append to the displayed value (ex. to show units)" 22 | --- 23 | -------------------------------------------------------------------------------- /docs/_plugins/gps.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "GPS" 3 | description: "Projects [gps_common::GPSFix](http://docs.ros.org/kinetic/api/gps_common/html/msg/GPSFix.html) message data into the scene." 4 | image: "" 5 | parameters: 6 | - name: Topic 7 | description: The GPS topic 8 | - name: Color 9 | description: The color of the GPS data 10 | - name: Draw Style 11 | description: (lines | points | arrows) 12 | - name: Static Arrow Sizes 13 | description: If checked, draw arrows the same size regardless of zoom level; slider adjusts size 14 | - name: Position Tolerance 15 | description: Distance threshold for adding new GPS points to visualization 16 | - name: Buffer Size 17 | description: Size of circular buffer of GPS points 18 | - name: Show Laps 19 | description: If checked, multiple loops of GPS coordinates will have different colors 20 | --- 21 | -------------------------------------------------------------------------------- /docs/_plugins/grid.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Grid" 3 | description: "Projects a 2D grid into the scene." 4 | image: "" 5 | parameters: 6 | - name: Frame 7 | description: Coordinate frame of the grid 8 | - name: Color 9 | description: Color of the grid 10 | - name: Alpha 11 | description: Alpha transparency of the grid 12 | - name: X 13 | description: X offset of the grid from the specified coordinate frame origin 14 | - name: Y 15 | description: Y offset of the grid from the specified coordinate frame origin 16 | - name: Size 17 | description: Size of each grid cell 18 | - name: Rows 19 | description: Number of grid rows 20 | - name: Columns 21 | description: Number of grid columns 22 | --- 23 | -------------------------------------------------------------------------------- /docs/_plugins/image.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Image" 3 | description: "Overlays a [sensor_msgs::Image](http://docs.ros.org/api/sensor_msgs/html/msg/Image.html) onto the display." 4 | image: "" 5 | parameters: 6 | - name: Topic 7 | description: The image topic name 8 | - name: Anchor 9 | description: (top left | top center | top right | center left | center | center right | bottom left | bottom center | bottom right) 10 | - name: Offset X 11 | description: Display offset from the left 12 | - name: Offset Y 13 | description: Display offset from the top 14 | - name: Width 15 | description: Display width 16 | - name: Height 17 | description: Display height 18 | - name: Units 19 | description: (pixels | percent of window) 20 | --- 21 | -------------------------------------------------------------------------------- /docs/_plugins/laserscan.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "LaserScan" 3 | description: "Projects a [sensor_msgs::LaserScan](http://docs.ros.org/api/sensor_msgs/html/msg/LaserScan.html) message into the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The laser scan topic name" 8 | - name: "Min Color" 9 | description: "The color associated with minimum return intensity" 10 | - name: "Max Color" 11 | description: "The color associated with maximum return intensity" 12 | - name: "Min Intesity" 13 | description: "Minimum intensity value" 14 | - name: "Max Intensity" 15 | description: "Maximum intensity value" 16 | - name: "Point Size" 17 | description: "Display size of laser scan points in pixels" 18 | - name: "Buffer Size" 19 | description: "Size of circular buffer of laser scan messages points" 20 | --- 21 | -------------------------------------------------------------------------------- /docs/_plugins/marker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Marker" 3 | description: "Projects a [visualization_msgs::Marker](http://docs.ros.org/api/visualization_msgs/html/msg/Marker.html) or [visualization_msgs::MarkerArray](http://docs.ros.org/api/visualization_msgs/html/msg/MarkerArray.html) into the scene. 4 | 5 | [Markers](http://wiki.ros.org/rviz/DisplayTypes/Marker) are the most flexible display type and more or less mirror the [OpenGL primitives](https://www.opengl.org/wiki/Primitive)." 6 | image: "" 7 | parameters: 8 | - name: "Topic" 9 | description: "The marker topic" 10 | --- 11 | -------------------------------------------------------------------------------- /docs/_plugins/measuring.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Measuring" 3 | description: "Measure distance on the canvas with the mouse." 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/move_base.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Move Base" 3 | description: "Allows the user to send goals to [move_base](wiki.ros.org/move_base)." 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/multires_image.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Multi-Res Image" 3 | description: "Projects a geo-referenced multi-resolution image tile map into the scene. The concept is the same as the Google Maps style pan/zoom satellite imagery." 4 | image: "multires2.png" 5 | parameters: 6 | - name: "Geo File" 7 | description: "Path to the geo-referenced map tiles." 8 | --- 9 | -------------------------------------------------------------------------------- /docs/_plugins/navsat.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "NavSat" 3 | description: "Projects [sensor_msgs::NavSatFix](https://docs.ros.org/jade/api/sensor_msgs/html/msg/NavSatFix.html) message data into the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The GPS topic" 8 | - name: "Color" 9 | description: "The color of the GPS data" 10 | - name: "Draw Style" 11 | description: "(lines | points)" 12 | - name: "Position Tolerance" 13 | description: "Distance threshold for adding new GPS points to visualization" 14 | - name: "Buffer Size" 15 | description: "Size of circular buffer of GPS points" 16 | --- 17 | -------------------------------------------------------------------------------- /docs/_plugins/occupancy_grid.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Occupancy Grid" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/odometry.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Odometry" 3 | description: "Projects [nav_msgs::Odometry](http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html) message data into the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The odometry topic" 8 | - name: "Color" 9 | description: "The color of the odometry data" 10 | - name: "Draw Style" 11 | description: "(lines | points | arrows)" 12 | - name: "Show Covariance" 13 | description: "Draw covariance ellipse around latest data" 14 | - name: "Position Tolerance" 15 | description: "Distance threshold for adding new odometry points to visualization" 16 | - name: "Buffer Size" 17 | description: "Size of circular buffer of odometry points" 18 | --- 19 | -------------------------------------------------------------------------------- /docs/_plugins/path.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Path" 3 | description: "Projects [nav_msgs::Path](http://docs.ros.org/api/nav_msgs/html/msg/Path.html) message data into the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The path topic" 8 | --- 9 | -------------------------------------------------------------------------------- /docs/_plugins/plan_route.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Plan Route" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/point_click_publisher.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Point Click Publisher" 3 | description: "Publishes a [geometry_msgs::PointStamped](http://docs.ros.org/api/geometry_msgs/html/msg/PointStamped.html) message every time a user clicks on the map frame that corresponds to the clicked location." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The topic to publish the point to" 8 | - name: "Frame" 9 | description: "The target frame to transform the point to before publishing it" 10 | --- 11 | -------------------------------------------------------------------------------- /docs/_plugins/point_drawing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Point Drawing" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/pointcloud2.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Pointcloud2" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/pose.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Pose" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/robot_image.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Robot Image" 3 | description: "Projects an image loaded from file into the scene to represent the robot platform." 4 | image: "" 5 | parameters: 6 | - name: "Image File" 7 | description: " Path to the image file" 8 | - name: "Frame" 9 | description: "Frame to tie the image to" 10 | - name: "Width" 11 | description: "The physical width represented by the image" 12 | - name: "Height" 13 | description: "The physical height represented by the image" 14 | --- 15 | -------------------------------------------------------------------------------- /docs/_plugins/route.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Route" 3 | description: "" 4 | image: "" 5 | parameters: 6 | --- 7 | -------------------------------------------------------------------------------- /docs/_plugins/string.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "String" 3 | description: "Displays the most recent string from a `std_msgs::String` message at a fixed location on the scene." 4 | image: "" 5 | parameters: 6 | - name: "Topic" 7 | description: "The string topic" 8 | - name: "Font" 9 | description: "The font for rendering the string" 10 | - name: "Color" 11 | description: "The color for drawing the string" 12 | - name: "Anchor" 13 | description: "(top left | top center | top right | center left | center | center right | bottom left | bottom center | bottom right)" 14 | - name: "Offset X" 15 | description: "Horizontal offset from the anchor" 16 | - name: "Offset Y" 17 | description: "Vertical offset from the anchor" 18 | - name: "Units" 19 | description: "(pixels | percent of window)" 20 | --- 21 | -------------------------------------------------------------------------------- /docs/_plugins/textured_marker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Textured Marker" 3 | description: "Projects `marti_visualization_msgs::TexturedMarker` and `marti_visualization_msgs::TexturedMarkerArray` message data into the scene. 4 | 5 | Textured markers follow the same general approach as traditional markers, but can be used to texture dense image data onto a quad which is projected into the scene." 6 | image: "" 7 | parameters: 8 | - name: "Topic" 9 | description: "The textured marker topic" 10 | --- 11 | -------------------------------------------------------------------------------- /docs/_plugins/tf_frame.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "TF Frame" 3 | description: "Projects [Tf](http://wiki.ros.org/tf) data into the scene similar to the Odometry plug-in." 4 | image: "" 5 | parameters: 6 | - name: "Frame" 7 | description: "The Tf frame" 8 | - name: "Color" 9 | description: "The color of the Tf data" 10 | - name: "Draw Style" 11 | description: "(lines | points | arrows)" 12 | - name: "Position Tolerance" 13 | description: "Distance threshold for adding new Tf points to visualization" 14 | - name: "Buffer Size" 15 | description: "Size of circular buffer of Tf points" 16 | --- 17 | -------------------------------------------------------------------------------- /docs/_plugins/tile_map.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Tile Map" 3 | description: "Projects a geo-referenced multi-resolution image tile map into the scene. Map tiles can be obtained from [Bing Maps](https://www.bing.com/mapspreview) or any [WMTS Tile Service](http://www.opengeospatial.org/standards/wmts). Pre-defined services that access [Stamen Design](http://maps.stamen.com/) (terrain, watercolor, and toner) are provided. Custom or local WMTS map servers can also be specified. Map data is cached to disk which enables some limited use completely offline." 4 | image: "satellite.png" 5 | parameters: 6 | - name: "Source" 7 | description: "The name of source of the tile data." 8 | - name: "Base URL" 9 | description: "A template URL used to obtain map tiles. When obtaining map tiles, parameters labeled `{level}`, `{x}`, and `{y}` in the URL will be replaced with appropriate values. For example, `http://tile.stamen.com/terrain/{level}/{x}/{y}.png` is appropriate for retrieving terrain tiles from Stamen Design." 10 | - name: "API Key" 11 | description: "When the `Bing Maps (terrain)` source is selected, you must enter a Bing Maps access key here and click the `Save` button in order for tiles to be available. You can get a Bing Maps Key from the [Microsoft Developer Network](https://msdn.microsoft.com/en-us/library/ff428642.aspx)." 12 | - name: "Max Zoom" 13 | description: "The maximum zoom level that will be used when requesting tiles." 14 | --- 15 | -------------------------------------------------------------------------------- /docs/assets/images/add-plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/add-plugin.png -------------------------------------------------------------------------------- /docs/assets/images/aerial-imagery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/aerial-imagery.png -------------------------------------------------------------------------------- /docs/assets/images/bulk-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/bulk-download.png -------------------------------------------------------------------------------- /docs/assets/images/choose-resolution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/choose-resolution.png -------------------------------------------------------------------------------- /docs/assets/images/configure-wmts-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/configure-wmts-source.png -------------------------------------------------------------------------------- /docs/assets/images/disparity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/disparity.png -------------------------------------------------------------------------------- /docs/assets/images/draw-geometry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/draw-geometry.png -------------------------------------------------------------------------------- /docs/assets/images/example-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/example-map.png -------------------------------------------------------------------------------- /docs/assets/images/extra-criteria.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/extra-criteria.png -------------------------------------------------------------------------------- /docs/assets/images/item-basket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/item-basket.png -------------------------------------------------------------------------------- /docs/assets/images/mapviz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/mapviz.png -------------------------------------------------------------------------------- /docs/assets/images/mapviz_features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/mapviz_features.png -------------------------------------------------------------------------------- /docs/assets/images/multires.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/multires.png -------------------------------------------------------------------------------- /docs/assets/images/multires2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/multires2.png -------------------------------------------------------------------------------- /docs/assets/images/pick-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/pick-data.png -------------------------------------------------------------------------------- /docs/assets/images/results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/results.png -------------------------------------------------------------------------------- /docs/assets/images/roads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/roads.png -------------------------------------------------------------------------------- /docs/assets/images/satellite-imagery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/satellite-imagery.png -------------------------------------------------------------------------------- /docs/assets/images/satellite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/satellite.png -------------------------------------------------------------------------------- /docs/assets/images/screenshot_coordinate_picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/screenshot_coordinate_picker.png -------------------------------------------------------------------------------- /docs/assets/images/select-geometry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/select-geometry.png -------------------------------------------------------------------------------- /docs/assets/images/set-frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/set-frames.png -------------------------------------------------------------------------------- /docs/assets/images/terrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/terrain.png -------------------------------------------------------------------------------- /docs/assets/images/toner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/toner.png -------------------------------------------------------------------------------- /docs/assets/images/watercolor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/docs/assets/images/watercolor.png -------------------------------------------------------------------------------- /docs/assets/js/search-data.json: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | { 4 | {% assign comma = false %} 5 | {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": { 6 | "title": "{{ page.title | replace: '&', '&' }}", 7 | "content": "{{ page.content | markdownify | replace: ' 12 | 13 | Plugin Name 14 | Description 15 | 16 | {% for plugin in site.plugins %} 17 | 18 | {{ plugin.title | markdownify | remove: '

' | remove: '

' }}
19 | {{ plugin.description | markdownify | remove: '

' | remove: '

' }} 20 | 21 | {%- comment -%} 22 | {%- if plugin.image and plugin.image != "" -%} 23 | ![]({{ site.baseurl | append: '/assets/images/' }}{{ plugin.image }}) 24 | {%- endif -%} 25 | {%- endcomment -%} 26 | {%- endfor -%} 27 | 28 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/color_button.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | #ifndef MAPVIZ__COLOR_BUTTON_H_ 31 | #define MAPVIZ__COLOR_BUTTON_H_ 32 | 33 | #include 34 | #include 35 | 36 | namespace mapviz 37 | { 38 | /** 39 | * The ColorButton widget provides a color display that the user can 40 | * click on to select a new color. You can use this widget in Qt 41 | * Designer by placing a QPushButton and promoting it to a custom 42 | * widget. You have to setup the promoted widget once in each .ui file: 43 | * 44 | * Base class name: QPushButton 45 | * Promoted class name: mapviz::ColorButton 46 | * Include file name: mapviz/color_button.h 47 | * Global Include: True 48 | */ 49 | class ColorButton : public QPushButton 50 | { 51 | Q_OBJECT 52 | 53 | QColor color_; 54 | 55 | public: 56 | explicit ColorButton(QWidget *parent = 0); 57 | 58 | const QColor& color() const { return color_; } 59 | 60 | Q_SIGNALS: 61 | // Emitted when the color is changed by user interaction. 62 | void colorEdited(const QColor &color); 63 | // Emitted when the color is changed by user interaction or programatically. 64 | void colorChanged(const QColor &color); 65 | 66 | public Q_SLOTS: 67 | void setColor(const QColor &color); 68 | 69 | private Q_SLOTS: 70 | void handleClicked(); 71 | }; // class ColorButton 72 | } // namespace mapviz 73 | #endif // MAPVIZ__COLOR_BUTTON_H_ 74 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/config_item.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ__CONFIG_ITEM_H_ 31 | #define MAPVIZ__CONFIG_ITEM_H_ 32 | 33 | // QT libraries 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | // C++ standard libraries 40 | #include 41 | #include 42 | 43 | // Auto-generated UI files 44 | #include "ui_configitem.h" 45 | 46 | namespace mapviz 47 | { 48 | class ConfigItem : public QWidget 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit ConfigItem(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); 54 | ~ConfigItem() override = default; 55 | 56 | void SetName(QString name); 57 | void SetType(QString type); 58 | void SetWidget(QWidget* widget); 59 | 60 | void SetListItem(QListWidgetItem* item) { item_ = item; } 61 | bool Collapsed() const { return ui_.content->isHidden(); } 62 | QString Name() const { return name_; } 63 | 64 | Ui::configitem ui_; 65 | 66 | Q_SIGNALS: 67 | void UpdateSizeHint(); 68 | void ToggledDraw(QListWidgetItem* plugin, bool visible); 69 | void RemoveRequest(QListWidgetItem* plugin); 70 | 71 | public Q_SLOTS: 72 | void Hide(); 73 | void EditName(); 74 | void Remove(); 75 | void ToggleDraw(bool toggled); 76 | 77 | private: 78 | void contextMenuEvent(QContextMenuEvent *event) override; 79 | 80 | protected: 81 | QListWidgetItem* item_; 82 | QString name_; 83 | QString type_; 84 | QAction* edit_name_action_; 85 | QAction* remove_item_action_; 86 | bool visible_; 87 | }; 88 | } // namespace mapviz 89 | 90 | #endif // MAPVIZ__CONFIG_ITEM_H_ 91 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/mapviz_application.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ__MAPVIZ_APPLICATION_H_ 31 | #define MAPVIZ__MAPVIZ_APPLICATION_H_ 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | namespace mapviz 39 | { 40 | /** 41 | * This class exists solely so that we can override QApplication::notify and 42 | * log exceptions in the event loop as errors rather than letting them 43 | * crash the entire program. 44 | */ 45 | class MapvizApplication : public QApplication 46 | { 47 | public: 48 | MapvizApplication(int &argc, char** argv, 49 | rclcpp::Logger logger = rclcpp::get_logger("mapviz::MapvizApplication")); 50 | 51 | void setLogger(const rclcpp::Logger& logger); 52 | private: 53 | bool notify(QObject* receiver, QEvent* event) override; 54 | 55 | rclcpp::Logger logger_; 56 | }; 57 | } // namespace mapviz 58 | 59 | #endif // MAPVIZ__MAPVIZ_APPLICATION_H_ 60 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/rqt_mapviz.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ__RQT_MAPVIZ_H_ 31 | #define MAPVIZ__RQT_MAPVIZ_H_ 32 | 33 | /* 34 | * The RQT GUI CPP files use the Qt macros "slots" and "signals". These conflict 35 | * with Boost macros of the same name; normally we fix this by adding "-DQT_NO_KEYWORDS" 36 | * in our CMakeLists file, then using Q_SLOTS and Q_SIGNALS in our source code instead. 37 | * Since we can't edit the ROS source code, though, we need to define those macros before 38 | * we include the ROS headers and then undefine them afterwards. 39 | */ 40 | #define slots 41 | #define signals 42 | #include 43 | #undef slots 44 | #undef signals 45 | 46 | #include "mapviz.hpp" 47 | 48 | namespace mapviz 49 | { 50 | class RqtMapviz : public rqt_gui_cpp::Plugin 51 | { 52 | Q_OBJECT 53 | public: 54 | RqtMapviz(); 55 | virtual void initPlugin(qt_gui_cpp::PluginContext& context); 56 | virtual void shutdownPlugin(); 57 | virtual void saveSettings( 58 | qt_gui_cpp::Settings& plugin_settings, 59 | qt_gui_cpp::Settings& instance_settings) const; 60 | virtual void restoreSettings( 61 | const qt_gui_cpp::Settings& plugin_settings, 62 | const qt_gui_cpp::Settings& instance_settings); 63 | private: 64 | Mapviz* widget_; 65 | }; 66 | } // namespace mapviz 67 | 68 | #endif // MAPVIZ__RQT_MAPVIZ_H_ 69 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/stopwatch.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2017, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | #ifndef MAPVIZ__STOPWATCH_H_ 30 | #define MAPVIZ__STOPWATCH_H_ 31 | 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | 38 | namespace mapviz 39 | { 40 | /* This class measures the wall time of an interval and keeps track of 41 | * the number of intervals, the average duration, and the maximum 42 | * duration. This is used to provide some simple measurements to keep 43 | * an eye on performance. 44 | */ 45 | class Stopwatch 46 | { 47 | public: 48 | Stopwatch() 49 | : 50 | count_(0), 51 | clock(), 52 | total_time_(0, 0), 53 | max_time_(0, 0), 54 | start_(0, 0) 55 | { 56 | } 57 | 58 | /* Start measuring a new time interval. */ 59 | void start() 60 | { 61 | start_ = clock.now(); 62 | } 63 | 64 | /* End the current time interval and update the measurements. 65 | * Behavior is undefined if start() was not called prior to this. 66 | */ 67 | void stop() 68 | { 69 | rclcpp::Duration dt = clock.now() - start_; 70 | count_ += 1; 71 | total_time_ = total_time_ + dt; 72 | max_time_ = std::max(max_time_, dt); 73 | } 74 | 75 | /* Return the number of intervals measured. */ 76 | int count() const { return count_; } 77 | 78 | /* Returns the longest observed duration. */ 79 | rclcpp::Duration maxTime() const {return max_time_;} 80 | 81 | /* Returns the average duration spent in the interval. */ 82 | rclcpp::Duration avgTime() const 83 | { 84 | if (count_) { 85 | return total_time_*(1.0/count_); 86 | } else { 87 | return rclcpp::Duration(0, 0); 88 | } 89 | } 90 | 91 | /* Print measurement info to the ROS console. */ 92 | void printInfo(rclcpp::Logger logger, const std::string &name) const 93 | { 94 | if (count_) { 95 | RCLCPP_INFO(logger, 96 | "%s -- calls: %d, avg time: %.2fms, max time: %.2fms", 97 | name.c_str(), 98 | count_, 99 | avgTime().seconds()*1000.0, 100 | maxTime().seconds()*1000.0); 101 | } else { 102 | RCLCPP_INFO(logger, 103 | "%s -- calls: %d, avg time: --ms, max time: --ms", 104 | name.c_str(), 105 | count_); 106 | } 107 | } 108 | 109 | private: 110 | int count_; 111 | rclcpp::Clock clock; 112 | rclcpp::Duration total_time_; 113 | rclcpp::Duration max_time_; 114 | 115 | rclcpp::Time start_; 116 | }; // class PluginInstrumentation 117 | } // namespace mapviz 118 | 119 | #endif // MAPVIZ__STOPWATCH_H_ 120 | -------------------------------------------------------------------------------- /mapviz/include/mapviz/video_writer.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2017, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ__VIDEO_WRITER_H_ 31 | #define MAPVIZ__VIDEO_WRITER_H_ 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | #ifndef Q_MOC_RUN 41 | #include 42 | #endif 43 | 44 | namespace mapviz 45 | { 46 | class VideoWriter : public QObject 47 | { 48 | Q_OBJECT 49 | 50 | public: 51 | VideoWriter() : 52 | video_mutex_(QMutex::Recursive) 53 | {} 54 | 55 | bool initializeWriter(const std::string& directory, int width, int height); 56 | bool isRecording(); 57 | void stop(); 58 | 59 | public Q_SLOTS: 60 | void processFrame(QImage frame); 61 | 62 | private: 63 | int height_; 64 | int width_; 65 | QMutex video_mutex_; 66 | std::shared_ptr video_writer_; 67 | }; 68 | } // namespace mapviz 69 | 70 | #endif // MAPVIZ__VIDEO_WRITER_H_ 71 | -------------------------------------------------------------------------------- /mapviz/launch/mapviz.launch.py: -------------------------------------------------------------------------------- 1 | import launch 2 | import launch.actions 3 | import launch.substitutions 4 | import launch_ros.actions 5 | 6 | 7 | def generate_launch_description(): 8 | return launch.LaunchDescription([ 9 | launch_ros.actions.Node( 10 | package="mapviz", 11 | executable="mapviz", 12 | name="mapviz", 13 | ), 14 | launch_ros.actions.Node( 15 | package="swri_transform_util", 16 | executable="initialize_origin.py", 17 | name="initialize_origin", 18 | parameters=[ 19 | {"local_xy_frame": "map"}, 20 | {"local_xy_origin": "swri"}, 21 | {"local_xy_origins": """[ 22 | {"name": "swri", 23 | "latitude": 29.45196669, 24 | "longitude": -98.61370577, 25 | "altitude": 233.719, 26 | "heading": 0.0}, 27 | {"name": "back_40", 28 | "latitude": 29.447507, 29 | "longitude": -98.629367, 30 | "altitude": 200.0, 31 | "heading": 0.0} 32 | ]"""}, 33 | ] 34 | ), 35 | launch_ros.actions.Node( 36 | package="tf2_ros", 37 | executable="static_transform_publisher", 38 | name="swri_transform", 39 | arguments=["0", "0", "0", "0", "0", "0", "map", "origin"] 40 | ) 41 | ]) 42 | -------------------------------------------------------------------------------- /mapviz/launch/mapviz.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 21 | 22 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /mapviz/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \section mapviz 4 | 5 | \b mapviz is a set of API's for ... 6 | 7 | This package... (see sumet_perception/material_classification/mainpage.dox for example description) 8 | 9 | 10 | \subsection codeapi Code API 11 | 12 | The C++ API consists of the following main classes: 13 | 14 | - \b ConfigItem - \copybrief ConfigItem 15 | - \b MapCanvas - \copybrief MapCanvas 16 | - \b mapviz::MapvizPlugin - \copybrief mapviz::MapvizPlugin 17 | - \b Mapviz - \copybrief Mapviz 18 | 19 | **/ 20 | -------------------------------------------------------------------------------- /mapviz/package.xml: -------------------------------------------------------------------------------- 1 | 2 | mapviz 3 | 2.5.5 4 | 5 | 2D mapping display with extensible data overlays 6 | 7 | Marc Alban 8 | P. J. Reed 9 | Southwest Research Institute 10 | BSD 11 | https://github.com/swri-robotics/mapviz 12 | 13 | ament_cmake 14 | pkg-config 15 | qt5-qmake 16 | 17 | libqt5-core 18 | libqt5-opengl-dev 19 | ros_environment 20 | 21 | geometry_msgs 22 | glut 23 | image_transport 24 | libglew-dev 25 | libxi-dev 26 | libxmu-dev 27 | mapviz_interfaces 28 | pluginlib 29 | rclcpp 30 | rqt_gui_cpp 31 | rqt_gui 32 | std_srvs 33 | swri_math_util 34 | swri_transform_util 35 | tf2 36 | tf2_geometry_msgs 37 | tf2_ros 38 | yaml-cpp 39 | 40 | libqt5-opengl 41 | 42 | 43 | ament_cmake 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /mapviz/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mapviz is a ROS based visualization tool with a plug-in system similar to RVIZ focused on visualizing 2D data. 5 | 6 | 7 | 8 | 9 | folder 10 | Plugins related to visualization. 11 | 12 | 13 | image-x-generic 14 | 2D visualization tool 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mapviz/src/color_button.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | #include 31 | 32 | #include 33 | 34 | namespace mapviz 35 | { 36 | ColorButton::ColorButton(QWidget *parent) 37 | : 38 | QPushButton(parent) 39 | { 40 | setColor(Qt::black); 41 | QObject::connect(this, SIGNAL(clicked(bool)), 42 | this, SLOT(handleClicked())); 43 | } 44 | 45 | void ColorButton::setColor(const QColor &color) 46 | { 47 | if (!color.isValid() || color == color_) { 48 | return; 49 | } 50 | 51 | color_ = color; 52 | // This was a very strange bug. On initialization, the constructor 53 | // would set the stylesheet to black, then the external owner would 54 | // call setColor to change the color to something else. We would 55 | // properly set the internal color_ and stylesheet, but it would 56 | // continue to display black. If the user changed the color, it 57 | // would change properly. Calling setStylesheet() twice fixes the 58 | // behavior. 59 | setStyleSheet("background: " + color_.name()); 60 | setStyleSheet("background: " + color_.name()); 61 | Q_EMIT colorChanged(color_); 62 | } 63 | 64 | void ColorButton::handleClicked() 65 | { 66 | // Note: We do not pass ourself as the parent or else the dialog 67 | // will inherit our color as the background! 68 | QColor new_color = QColorDialog::getColor(color_); 69 | if (!new_color.isValid() || new_color == color_) { 70 | return; 71 | } 72 | setColor(new_color); 73 | Q_EMIT colorEdited(new_color); 74 | } 75 | } // namespace mapviz 76 | -------------------------------------------------------------------------------- /mapviz/src/config_item.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace mapviz 36 | { 37 | ConfigItem::ConfigItem(QWidget *parent, Qt::WindowFlags flags) : 38 | QWidget(parent, flags), 39 | item_(nullptr), 40 | visible_(true) 41 | { 42 | ui_.setupUi(this); 43 | 44 | edit_name_action_ = new QAction("Edit Name", this); 45 | edit_name_action_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_R)); 46 | remove_item_action_ = new QAction("Remove", this); 47 | remove_item_action_->setIcon(QIcon(":/images/remove-icon-th.png")); 48 | remove_item_action_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X)); 49 | 50 | connect(edit_name_action_, SIGNAL(triggered()), this, SLOT(EditName())); 51 | connect(remove_item_action_, SIGNAL(triggered()), this, SLOT(Remove())); 52 | } 53 | 54 | void ConfigItem::ToggleDraw(bool toggled) 55 | { 56 | if (visible_ != toggled) { 57 | visible_ = toggled; 58 | if (ui_.show->isChecked() != toggled) { 59 | ui_.show->setChecked(toggled); 60 | } 61 | 62 | Q_EMIT ToggledDraw(item_, toggled); 63 | } 64 | } 65 | 66 | void ConfigItem::contextMenuEvent(QContextMenuEvent* event) 67 | { 68 | QMenu menu(this); 69 | menu.addAction(edit_name_action_); 70 | menu.addAction(remove_item_action_); 71 | menu.exec(event->globalPos()); 72 | } 73 | 74 | void ConfigItem::SetName(QString name) 75 | { 76 | name_ = name; 77 | ui_.namelabel->setText(type_ + " (" + name_ + ")"); 78 | } 79 | 80 | void ConfigItem::SetType(QString type) 81 | { 82 | type_ = type; 83 | ui_.namelabel->setText(type_ + " (" + name_ + ")"); 84 | } 85 | 86 | void ConfigItem::SetWidget(QWidget* widget) 87 | { 88 | ui_.label->hide(); 89 | ui_.content_layout->addWidget(widget); 90 | } 91 | 92 | void ConfigItem::EditName() 93 | { 94 | bool ok; 95 | QString text = QInputDialog::getText( 96 | this, 97 | tr("Set Display name"), 98 | tr(""), 99 | QLineEdit::Normal, 100 | name_, &ok); 101 | 102 | if (ok && !text.isEmpty()) { 103 | SetName(text); 104 | } 105 | } 106 | 107 | void ConfigItem::Remove() 108 | { 109 | Q_EMIT RemoveRequest(item_); 110 | } 111 | 112 | void ConfigItem::Hide() 113 | { 114 | if (!ui_.content->isHidden()) { 115 | ui_.content->hide(); 116 | ui_.signlabel->setText(" + "); 117 | } else { 118 | ui_.content->show(); 119 | ui_.signlabel->setText(" - "); 120 | } 121 | 122 | Q_EMIT UpdateSizeHint(); 123 | } 124 | } // namespace mapviz 125 | -------------------------------------------------------------------------------- /mapviz/src/mapviz_application.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | 31 | #include "mapviz/mapviz_application.h" 32 | 33 | #include "rclcpp/rclcpp.hpp" 34 | 35 | namespace mapviz 36 | { 37 | MapvizApplication::MapvizApplication(int& argc, char** argv, rclcpp::Logger logger) : 38 | QApplication(argc, argv), 39 | logger_(logger) 40 | { 41 | } 42 | 43 | bool MapvizApplication::notify(QObject* receiver, QEvent* event) 44 | { 45 | try { 46 | return QApplication::notify(receiver, event); 47 | } 48 | catch (const rclcpp::exceptions::RCLError& e) { 49 | RCLCPP_ERROR(logger_, 50 | "Unhandled RCLError in Qt event loop: %s", e.what()); 51 | } 52 | catch (const std::exception& e) { 53 | RCLCPP_ERROR(logger_, 54 | "Unhandled std::exception in Qt event loop: %s", e.what()); 55 | } 56 | 57 | return false; 58 | } 59 | 60 | void MapvizApplication::setLogger(const rclcpp::Logger &logger) 61 | { 62 | logger_ = logger; 63 | } 64 | } // namespace mapviz 65 | -------------------------------------------------------------------------------- /mapviz/src/mapviz_main.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #include "mapviz/mapviz.hpp" 31 | #include "mapviz/mapviz_application.h" 32 | #include 33 | 34 | int main(int argc, char **argv) 35 | { 36 | // Initialize ROS; spinning on the Node is handled in mapviz.cpp 37 | rclcpp::init(argc, argv); 38 | 39 | // Initialize Qt resources 40 | Q_INIT_RESOURCE(icons); 41 | 42 | // Initialize QT 43 | mapviz::MapvizApplication app(argc, argv); 44 | 45 | // Initialize glut (for displaying text) 46 | glutInit(&argc, argv); 47 | 48 | // Start mapviz 49 | mapviz::Mapviz mapviz(true, argc, argv); 50 | app.setLogger(mapviz.GetNode()->get_logger()); 51 | mapviz.show(); 52 | 53 | return mapviz::MapvizApplication::exec(); 54 | } 55 | -------------------------------------------------------------------------------- /mapviz/src/resources/LICENSE: -------------------------------------------------------------------------------- 1 | The Tango base icon theme is released to the Public Domain. 2 | 3 | http://tango.freedesktop.org/ 4 | 5 | --- 6 | 7 | The Silk icon theme is licensed under the Creative Commons Attribution 2.4 License. 8 | 9 | http://www.famfamfam.com/lab/icons/silk/ 10 | -------------------------------------------------------------------------------- /mapviz/src/resources/arrow_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/arrow_in.png -------------------------------------------------------------------------------- /mapviz/src/resources/green-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/green-arrow.png -------------------------------------------------------------------------------- /mapviz/src/resources/icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | arrow_in.png 4 | image-x-generic.png 5 | media-playback-pause.png 6 | media-playback-stop.png 7 | media-record.png 8 | remove-icon-th.png 9 | green-arrow.png 10 | 11 | 12 | -------------------------------------------------------------------------------- /mapviz/src/resources/image-x-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/image-x-generic.png -------------------------------------------------------------------------------- /mapviz/src/resources/media-playback-pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/media-playback-pause.png -------------------------------------------------------------------------------- /mapviz/src/resources/media-playback-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/media-playback-stop.png -------------------------------------------------------------------------------- /mapviz/src/resources/media-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/media-record.png -------------------------------------------------------------------------------- /mapviz/src/resources/remove-icon-th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swri-robotics/mapviz/764a3207b33341edb11a69f7038518f4e32aea1f/mapviz/src/resources/remove-icon-th.png -------------------------------------------------------------------------------- /mapviz/src/rqt_mapviz.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #include "mapviz/rqt_mapviz.h" 31 | #include 32 | 33 | namespace mapviz 34 | { 35 | 36 | RqtMapviz::RqtMapviz() : 37 | widget_(nullptr) 38 | { 39 | setObjectName("RqtMapviz"); 40 | } 41 | 42 | void RqtMapviz::initPlugin(qt_gui_cpp::PluginContext& context) 43 | { 44 | // The plugin class doesn't really do very much -- just start Mapviz 45 | // and add it to the context. 46 | widget_ = new Mapviz(false, 0, nullptr); 47 | widget_->setWindowFlags(Qt::Widget); 48 | context.addWidget(widget_); 49 | } 50 | 51 | void RqtMapviz::shutdownPlugin() 52 | { 53 | } 54 | 55 | void RqtMapviz::saveSettings(qt_gui_cpp::Settings& plugin_settings, 56 | qt_gui_cpp::Settings& instance_settings) const 57 | { 58 | } 59 | 60 | void RqtMapviz::restoreSettings(const qt_gui_cpp::Settings& plugin_settings, 61 | const qt_gui_cpp::Settings& instance_settings) 62 | { 63 | } 64 | } // namespace mapviz 65 | 66 | PLUGINLIB_EXPORT_CLASS(mapviz::RqtMapviz, rqt_gui_cpp::Plugin) 67 | -------------------------------------------------------------------------------- /mapviz/ui/pluginselect.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | pluginselect 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Select New Display 15 | 16 | 17 | true 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | Qt::Vertical 31 | 32 | 33 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | buttonBox 43 | accepted() 44 | pluginselect 45 | accept() 46 | 47 | 48 | 306 49 | 243 50 | 51 | 52 | 157 53 | 274 54 | 55 | 56 | 57 | 58 | buttonBox 59 | rejected() 60 | pluginselect 61 | reject() 62 | 63 | 64 | 316 65 | 260 66 | 67 | 68 | 286 69 | 274 70 | 71 | 72 | 73 | 74 | displaylist 75 | doubleClicked(QModelIndex) 76 | pluginselect 77 | accept() 78 | 79 | 80 | 162 81 | 114 82 | 83 | 84 | 209 85 | 294 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /mapviz_interfaces/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package mapviz_interfaces 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 2.5.5 (2025-06-03) 6 | ------------------ 7 | 8 | 2.5.4 (2025-06-03) 9 | ------------------ 10 | 11 | 2.5.3 (2025-06-02) 12 | ------------------ 13 | 14 | 2.5.2 (2025-05-31) 15 | ------------------ 16 | 17 | 2.5.1 (2025-05-30) 18 | ------------------ 19 | 20 | 2.5.0 (2025-05-29) 21 | ------------------ 22 | * Correct CMake Export (`#842 `_) 23 | * Removes Boost 24 | * Removes deprecated ament macro 25 | * General fixes to fix CMake exports and dependencies 26 | --------- 27 | Co-authored-by: Ben Andrew 28 | * Contributors: David Anthony 29 | 30 | 2.4.9 (2025-05-20) 31 | ------------------ 32 | 33 | 2.4.8 (2025-05-20) 34 | ------------------ 35 | 36 | 2.4.7 (2025-05-20) 37 | ------------------ 38 | 39 | 2.4.6 (2025-04-02) 40 | ------------------ 41 | 42 | 2.4.5 (2025-01-20) 43 | ------------------ 44 | 45 | 2.4.4 (2024-12-09) 46 | ------------------ 47 | 48 | 2.4.3 (2024-09-18) 49 | ------------------ 50 | 51 | 2.4.2 (2024-08-12) 52 | ------------------ 53 | 54 | 2.4.1 (2024-08-09) 55 | ------------------ 56 | 57 | 2.4.0 (2024-08-09) 58 | ------------------ 59 | 60 | 2.3.0 (2023-08-24) 61 | ------------------ 62 | 63 | 2.2.2 (2023-06-07) 64 | ------------------ 65 | 66 | 2.2.1 (2023-05-30) 67 | ------------------ 68 | * Updating maintainers list (`#778 `_) 69 | * Contributors: David Anthony 70 | 71 | 2.1.0 (2020-10-22) 72 | ------------------ 73 | 74 | 2.0.0 (2020-05-13) 75 | ------------------ 76 | * Port mapviz to ROS 2 (`#672 `_) 77 | * Contributors: P. J. Reed 78 | 79 | 1.2.0 (2019-09-04) 80 | ------------------ 81 | 82 | 1.1.1 (2019-05-17) 83 | ------------------ 84 | 85 | 1.1.0 (2019-02-20) 86 | ------------------ 87 | 88 | 1.0.1 (2019-01-25) 89 | ------------------ 90 | 91 | 1.0.0 (2019-01-23) 92 | ------------------ 93 | 94 | 0.3.0 (2018-11-16) 95 | ------------------ 96 | 97 | 0.2.6 (2018-07-31 09:02) 98 | ------------------------ 99 | 100 | 0.2.5 (2018-04-12 16:26) 101 | ------------------------ 102 | 103 | 0.2.4 (2017-08-11 09:57) 104 | ------------------------ 105 | 106 | 0.2.3 (2016-12-10) 107 | ------------------ 108 | 109 | 0.2.2 (2016-12-07) 110 | ------------------ 111 | 112 | 0.2.1 (2016-10-23 22:33) 113 | ------------------------ 114 | 115 | 0.2.0 (2016-06-23) 116 | ------------------ 117 | 118 | 0.1.3 (2016-05-20 15:12) 119 | ------------------------ 120 | 121 | 0.1.2 (2016-01-06 17:04) 122 | ------------------------ 123 | 124 | 0.1.1 (2015-11-17) 125 | ------------------ 126 | 127 | 0.1.0 (2015-09-29) 128 | ------------------ 129 | 130 | 0.0.10 (2018-07-31 09:01) 131 | ------------------------- 132 | 133 | 0.0.9 (2018-04-12 16:23) 134 | ------------------------ 135 | 136 | 0.0.8 (2017-08-11 09:53) 137 | ------------------------ 138 | 139 | 0.0.7 (2016-10-23 21:55) 140 | ------------------------ 141 | 142 | 0.0.6 (2016-08-14) 143 | ------------------ 144 | 145 | 0.0.5 (2016-05-20 14:40) 146 | ------------------------ 147 | 148 | 0.0.4 (2016-01-06 17:00) 149 | ------------------------ 150 | 151 | 0.0.3 (2015-09-28) 152 | ------------------ 153 | -------------------------------------------------------------------------------- /mapviz_interfaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### SET CMAKE POLICIES ### 2 | cmake_minimum_required(VERSION 3.10...3.17) 3 | 4 | if(${CMAKE_VERSION} VERSION_LESS 3.12) 5 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 6 | endif() 7 | 8 | if(NOT CMAKE_CXX_STANDARD) 9 | set(CMAKE_CXX_STANDARD 17) 10 | endif() 11 | ### END CMAKE POLICIES ### 12 | 13 | project(mapviz_interfaces) 14 | 15 | find_package(ament_cmake REQUIRED) 16 | find_package(marti_common_msgs REQUIRED) 17 | find_package(rosidl_default_generators REQUIRED) 18 | 19 | rosidl_generate_interfaces(${PROJECT_NAME} 20 | srv/AddMapvizDisplay.srv 21 | DEPENDENCIES marti_common_msgs 22 | ) 23 | 24 | ament_export_dependencies(rosidl_default_runtime) 25 | ament_package() 26 | -------------------------------------------------------------------------------- /mapviz_interfaces/package.xml: -------------------------------------------------------------------------------- 1 | 2 | mapviz_interfaces 3 | 2.5.5 4 | 5 | ROS interfaces used by Mapviz 6 | 7 | P. J. Reed 8 | Southwest Research Institute 9 | BSD 10 | https://github.com/swri-robotics/mapviz 11 | 12 | builtin_interfaces 13 | marti_common_msgs 14 | 15 | rosidl_default_generators 16 | 17 | rosidl_default_runtime 18 | 19 | rosidl_interface_packages 20 | 21 | 22 | ament_cmake 23 | 24 | 25 | -------------------------------------------------------------------------------- /mapviz_interfaces/srv/AddMapvizDisplay.srv: -------------------------------------------------------------------------------- 1 | # Add or updates a mapviz display. 2 | 3 | string name # The name of the display. 4 | string type # The plugin type. 5 | 6 | int32 draw_order # The display order. 1 corresponds 7 | # to the first displayed, 2 to the 8 | # second, -1 to last, and -2 to the 9 | # second to last, etc. 0 will keep 10 | # the current display order of an 11 | # existing display and give a new 12 | # display the last display order. 13 | 14 | bool visible # If the display should be visible. 15 | 16 | marti_common_msgs/KeyValue[] properties # Configuration properties. 17 | 18 | --- 19 | 20 | bool success # indicate successful run of triggered service 21 | string message # informational, e.g. for error messages 22 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/canvas_click_filter.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__CANVAS_CLICK_FILTER_H_ 31 | #define MAPVIZ_PLUGINS__CANVAS_CLICK_FILTER_H_ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * This is a very simple event filter that listens for mouseReleased events; 38 | * when it sees one, it emits a signal with the given point. 39 | * 40 | * Click events are filtered by how long the mouse was held down and how far the 41 | * cursor moved in order to prevent the user holding and dragging the map 42 | * from firing a click event. By default, "clicks" that take longer than 500ms 43 | * or move longer than 2 pixels are ignored. 44 | */ 45 | namespace mapviz_plugins 46 | { 47 | class CanvasClickFilter : public QObject 48 | { 49 | Q_OBJECT 50 | 51 | public: 52 | CanvasClickFilter(); 53 | 54 | void setMaxClickTime(qint64 max_ms); 55 | void setMaxClickMovement(qreal max_distance); 56 | 57 | Q_SIGNALS: 58 | void pointClicked(const QPointF&); 59 | 60 | protected: 61 | bool eventFilter(QObject *object, QEvent* event) override; 62 | 63 | private: 64 | bool is_mouse_down_; 65 | QPointF mouse_down_pos_; 66 | qint64 mouse_down_time_; 67 | 68 | qint64 max_ms_; 69 | qreal max_distance_; 70 | }; 71 | } // namespace mapviz_plugins 72 | 73 | #endif // MAPVIZ_PLUGINS__CANVAS_CLICK_FILTER_H_ 74 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/coordinate_picker_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2018, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__COORDINATE_PICKER_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__COORDINATE_PICKER_PLUGIN_H_ 32 | 33 | #include 34 | 35 | // ROS Libraries 36 | #include 37 | 38 | // Mapviz libraries 39 | #include 40 | 41 | // C++ Standard Libraries 42 | #include 43 | 44 | // QT autogenerated files 45 | #include "ui_coordinate_picker_config.h" 46 | 47 | namespace mapviz_plugins 48 | { 49 | class CoordinatePickerPlugin : public mapviz::MapvizPlugin 50 | { 51 | Q_OBJECT 52 | 53 | public: 54 | CoordinatePickerPlugin(); 55 | ~CoordinatePickerPlugin() override; 56 | 57 | bool Initialize(QGLWidget* canvas) override; 58 | void Shutdown() override { } 59 | 60 | void Draw(double x, double y, double scale) override; 61 | void Transform() override { } 62 | 63 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 64 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 65 | 66 | QWidget* GetConfigWidget(QWidget* parent) override; 67 | 68 | void PrintError(const std::string& message) override; 69 | void PrintInfo(const std::string& message) override; 70 | void PrintWarning(const std::string& message) override; 71 | 72 | protected: 73 | bool eventFilter(QObject* object, QEvent* event) override; 74 | bool handleMousePress(QMouseEvent*); 75 | bool handleMouseRelease(QMouseEvent*); 76 | bool handleMouseMove(QMouseEvent*); 77 | 78 | protected Q_SLOTS: 79 | void SelectFrame(); 80 | void FrameEdited(); 81 | void ToggleCopyOnClick(int state); 82 | void ClearCoordList(); 83 | 84 | private: 85 | Ui::coordinate_picker_config ui_; 86 | QWidget* config_widget_; 87 | mapviz::MapCanvas* map_canvas_; 88 | 89 | bool copy_on_click_; 90 | }; 91 | } // namespace mapviz_plugins 92 | 93 | #endif // MAPVIZ_PLUGINS__COORDINATE_PICKER_PLUGIN_H_ 94 | 95 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/draw_polygon_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2016, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__DRAW_POLYGON_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__DRAW_POLYGON_PLUGIN_H_ 32 | 33 | #include 34 | 35 | // QT libraries 36 | #include 37 | #include 38 | #include 39 | 40 | // ROS libraries 41 | #include 42 | #include 43 | 44 | // Mapviz libraries 45 | #include 46 | 47 | // Messages 48 | #include 49 | 50 | // C++ standard libraries 51 | #include 52 | #include 53 | 54 | // QT autogenerated files 55 | #include "ui_draw_polygon_config.h" 56 | 57 | namespace mapviz_plugins 58 | { 59 | class DrawPolygonPlugin : public mapviz::MapvizPlugin 60 | { 61 | Q_OBJECT 62 | 63 | public: 64 | DrawPolygonPlugin(); 65 | ~DrawPolygonPlugin() override; 66 | 67 | bool Initialize(QGLWidget* canvas) override; 68 | void Shutdown() override {} 69 | 70 | void Draw(double x, double y, double scale) override; 71 | 72 | void Transform() override {}; 73 | 74 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 75 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 76 | 77 | QWidget* GetConfigWidget(QWidget* parent) override; 78 | 79 | protected: 80 | void PrintError(const std::string& message) override; 81 | void PrintInfo(const std::string& message) override; 82 | void PrintWarning(const std::string& message) override; 83 | bool eventFilter(QObject *object, QEvent* event) override; 84 | bool handleMousePress(QMouseEvent *); 85 | bool handleMouseRelease(QMouseEvent *); 86 | bool handleMouseMove(QMouseEvent *); 87 | 88 | protected Q_SLOTS: 89 | void PublishPolygon(); 90 | void Clear(); 91 | void SelectFrame(); 92 | void FrameEdited(); 93 | 94 | private: 95 | Ui::draw_polygon_config ui_; 96 | QWidget* config_widget_; 97 | mapviz::MapCanvas* map_canvas_; 98 | 99 | std::string polygon_topic_; 100 | rclcpp::Publisher::SharedPtr polygon_pub_; 101 | 102 | std::vector vertices_; 103 | std::vector transformed_vertices_; 104 | 105 | int selected_point_; 106 | bool is_mouse_down_; 107 | QPointF mouse_down_pos_; 108 | qint64 mouse_down_time_; 109 | 110 | qint64 max_ms_; 111 | qreal max_distance_; 112 | }; 113 | } // namespace mapviz_plugins 114 | 115 | #endif // MAPVIZ_PLUGINS__DRAW_POLYGON_PLUGIN_H_ 116 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/gps_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (C) 2013 All Right Reserved, Southwest Research Institute® (SwRI®) 4 | // 5 | // Contract No. 10-58058A 6 | // Contractor Southwest Research Institute® (SwRI®) 7 | // Address 6220 Culebra Road, San Antonio, Texas 78228-0510 8 | // Contact Steve Dellenback (210) 522-3914 9 | // 10 | // This code was developed as part of an internal research project fully funded 11 | // by Southwest Research Institute®. 12 | // 13 | // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 14 | // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 16 | // PARTICULAR PURPOSE. 17 | // 18 | // ***************************************************************************** 19 | 20 | #ifndef MAPVIZ_PLUGINS__GPS_PLUGIN_H_ 21 | #define MAPVIZ_PLUGINS__GPS_PLUGIN_H_ 22 | 23 | // Include mapviz_plugin.h first to ensure GL deps are included in the right order 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | // QT libraries 30 | #include 31 | #include 32 | #include 33 | 34 | // ROS libraries 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | // C++ standard libraries 41 | #include 42 | #include 43 | #include 44 | 45 | // QT autogenerated files 46 | #include "ui_gps_config.h" 47 | 48 | namespace mapviz_plugins 49 | { 50 | class GpsPlugin : public mapviz_plugins::PointDrawingPlugin 51 | { 52 | Q_OBJECT 53 | 54 | public: 55 | GpsPlugin(); 56 | ~GpsPlugin() override = default; 57 | 58 | bool Initialize(QGLWidget* canvas) override; 59 | void Shutdown() override {} 60 | 61 | void Draw(double x, double y, double scale) override; 62 | 63 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 64 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 65 | 66 | QWidget* GetConfigWidget(QWidget* parent) override; 67 | 68 | protected: 69 | void PrintError(const std::string& message) override; 70 | void PrintInfo(const std::string& message) override; 71 | void PrintWarning(const std::string& message) override; 72 | 73 | protected Q_SLOTS: 74 | void SelectTopic(); 75 | void TopicEdited(); 76 | 77 | private: 78 | Ui::gps_config ui_; 79 | QWidget* config_widget_; 80 | 81 | std::string topic_; 82 | rmw_qos_profile_t qos_; 83 | 84 | // ros::Subscriber gps_sub_; 85 | rclcpp::Subscription::SharedPtr gps_sub_; 86 | bool has_message_; 87 | 88 | void GPSFixCallback(const gps_msgs::msg::GPSFix::SharedPtr gps); 89 | void connectCallback(const std::string& topic, const rmw_qos_profile_t& qos); 90 | }; 91 | } // namespace mapviz_plugins 92 | 93 | #endif // MAPVIZ_PLUGINS__GPS_PLUGIN_H_ 94 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/grid_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__GRID_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__GRID_PLUGIN_H_ 32 | 33 | #include 34 | 35 | // QT libraries 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | // ROS libraries 42 | #include 43 | #include 44 | 45 | #include 46 | 47 | // C++ standard libraries 48 | #include 49 | #include 50 | 51 | // QT autogenerated files 52 | #include "ui_grid_config.h" 53 | 54 | namespace mapviz_plugins 55 | { 56 | class GridPlugin : public mapviz::MapvizPlugin 57 | { 58 | Q_OBJECT 59 | 60 | public: 61 | GridPlugin(); 62 | ~GridPlugin() override = default; 63 | 64 | bool Initialize(QGLWidget* canvas) override; 65 | void Shutdown() override {} 66 | 67 | void Draw(double x, double y, double scale) override; 68 | 69 | void Transform() override; 70 | 71 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 72 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 73 | 74 | QWidget* GetConfigWidget(QWidget* parent) override; 75 | 76 | protected: 77 | void PrintError(const std::string& message) override; 78 | void PrintInfo(const std::string& message) override; 79 | void PrintWarning(const std::string& message) override; 80 | 81 | protected Q_SLOTS: 82 | void SelectFrame(); 83 | void FrameEdited(); 84 | void SetAlpha(double alpha); 85 | void SetX(double x); 86 | void SetY(double y); 87 | void SetSize(double size); 88 | void SetRows(int rows); 89 | void SetColumns(int columns); 90 | void DrawIcon() override; 91 | 92 | private: 93 | Ui::grid_config ui_; 94 | QWidget* config_widget_; 95 | 96 | double alpha_; 97 | 98 | tf2::Vector3 top_left_; 99 | 100 | double size_; 101 | int rows_; 102 | int columns_; 103 | 104 | bool transformed_; 105 | 106 | std::list top_points_; 107 | std::list bottom_points_; 108 | std::list left_points_; 109 | std::list right_points_; 110 | 111 | std::list transformed_top_points_; 112 | std::list transformed_bottom_points_; 113 | std::list transformed_left_points_; 114 | std::list transformed_right_points_; 115 | 116 | swri_transform_util::Transform transform_; 117 | 118 | void RecalculateGrid(); 119 | void Transform(std::list& src, std::list& dst); 120 | }; 121 | } // namespace mapviz_plugins 122 | 123 | #endif // MAPVIZ_PLUGINS__GRID_PLUGIN_H_ 124 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/navsat_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (C) 2013 All Right Reserved, Southwest Research Institute® (SwRI®) 4 | // 5 | // Contract No. 10-58058A 6 | // Contractor Southwest Research Institute® (SwRI®) 7 | // Address 6220 Culebra Road, San Antonio, Texas 78228-0510 8 | // Contact Steve Dellenback (210) 522-3914 9 | // 10 | // This code was developed as part of an internal research project fully funded 11 | // by Southwest Research Institute®. 12 | // 13 | // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 14 | // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 15 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 16 | // PARTICULAR PURPOSE. 17 | // 18 | // ***************************************************************************** 19 | 20 | #ifndef MAPVIZ_PLUGINS__NAVSAT_PLUGIN_H_ 21 | #define MAPVIZ_PLUGINS__NAVSAT_PLUGIN_H_ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | // QT libraries 28 | #include 29 | #include 30 | #include 31 | 32 | // ROS libraries 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | // C++ standard libraries 39 | #include 40 | #include 41 | #include 42 | 43 | // QT autogenerated files 44 | #include "ui_navsat_config.h" 45 | 46 | namespace mapviz_plugins 47 | { 48 | class NavSatPlugin : public mapviz_plugins::PointDrawingPlugin 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | NavSatPlugin(); 54 | ~NavSatPlugin() override = default; 55 | 56 | bool Initialize(QGLWidget* canvas) override; 57 | void Shutdown() override {} 58 | 59 | void Draw(double x, double y, double scale) override; 60 | 61 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 62 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 63 | 64 | QWidget* GetConfigWidget(QWidget* parent) override; 65 | 66 | protected: 67 | void PrintError(const std::string& message) override; 68 | void PrintInfo(const std::string& message) override; 69 | void PrintWarning(const std::string& message) override; 70 | 71 | protected Q_SLOTS: 72 | void SelectTopic(); 73 | void TopicEdited(); 74 | 75 | private: 76 | Ui::navsat_config ui_; 77 | QWidget* config_widget_; 78 | 79 | std::string topic_; 80 | rmw_qos_profile_t qos_; 81 | 82 | rclcpp::Subscription::SharedPtr navsat_sub_; 83 | bool has_message_; 84 | 85 | void connectCallback(const std::string& topic, const rmw_qos_profile_t& qos); 86 | void NavSatFixCallback(const sensor_msgs::msg::NavSatFix::ConstSharedPtr navsat); 87 | }; 88 | } // namespace mapviz_plugins 89 | 90 | #endif // MAPVIZ_PLUGINS__NAVSAT_PLUGIN_H_ 91 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/odometry_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__ODOMETRY_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__ODOMETRY_PLUGIN_H_ 32 | 33 | #include 34 | #include 35 | // QT libraries 36 | #include 37 | #include 38 | #include 39 | 40 | // ROS libraries 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | 47 | // C++ standard libraries 48 | #include 49 | #include 50 | #include 51 | 52 | // QT autogenerated files 53 | #include "ui_odometry_config.h" 54 | 55 | namespace mapviz_plugins 56 | { 57 | class OdometryPlugin : public mapviz_plugins::PointDrawingPlugin 58 | { 59 | Q_OBJECT 60 | 61 | public: 62 | OdometryPlugin(); 63 | ~OdometryPlugin() override = default; 64 | 65 | bool Initialize(QGLWidget* canvas) override; 66 | void Shutdown() override {} 67 | 68 | void Paint(QPainter* painter, double x, double y, double scale) override; 69 | void Draw(double x, double y, double scale) override; 70 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 71 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 72 | 73 | QWidget* GetConfigWidget(QWidget* parent) override; 74 | 75 | bool SupportsPainting() override 76 | { 77 | return true; 78 | } 79 | 80 | protected: 81 | void PrintError(const std::string& message) override; 82 | void PrintInfo(const std::string& message) override; 83 | void PrintWarning(const std::string& message) override; 84 | 85 | protected Q_SLOTS: 86 | void SelectTopic(); 87 | void TopicEdited(); 88 | 89 | private: 90 | Ui::odometry_config ui_; 91 | QWidget* config_widget_; 92 | std::string topic_; 93 | rmw_qos_profile_t qos_; 94 | rclcpp::Subscription::SharedPtr odometry_sub_; 95 | bool has_message_; 96 | void odometryCallback(const nav_msgs::msg::Odometry::SharedPtr odometry); 97 | void connectCallback(const std::string& topic, const rmw_qos_profile_t& qos); 98 | }; 99 | } // namespace mapviz_plugins 100 | 101 | #endif // MAPVIZ_PLUGINS__ODOMETRY_PLUGIN_H_ 102 | 103 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/path_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__PATH_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__PATH_PLUGIN_H_ 32 | 33 | #include 34 | 35 | // QT libraries 36 | #include 37 | #include 38 | #include 39 | 40 | // ROS libraries 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | 48 | // C++ standard libraries 49 | #include 50 | #include 51 | 52 | // QT autogenerated files 53 | #include "ui_path_config.h" 54 | 55 | namespace mapviz_plugins 56 | { 57 | class PathPlugin : public mapviz_plugins::PointDrawingPlugin 58 | { 59 | Q_OBJECT 60 | 61 | public: 62 | PathPlugin(); 63 | ~PathPlugin() override = default; 64 | 65 | bool Initialize(QGLWidget* canvas) override; 66 | void Shutdown() override {} 67 | 68 | void Draw(double x, double y, double scale) override; 69 | 70 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 71 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 72 | 73 | QWidget* GetConfigWidget(QWidget* parent) override; 74 | 75 | protected: 76 | void PrintError(const std::string& message) override; 77 | void PrintInfo(const std::string& message) override; 78 | void PrintWarning(const std::string& message) override; 79 | 80 | protected Q_SLOTS: 81 | void SelectTopic(); 82 | void TopicEdited(); 83 | 84 | private: 85 | Ui::path_config ui_; 86 | QWidget* config_widget_; 87 | 88 | std::string topic_; 89 | rmw_qos_profile_t qos_; 90 | 91 | rclcpp::Subscription::SharedPtr path_sub_; 92 | bool has_message_; 93 | 94 | void connectCallback(const std::string& topic, const rmw_qos_profile_t& qos); 95 | void pathCallback(const nav_msgs::msg::Path::SharedPtr path); 96 | }; 97 | } // namespace mapviz_plugins 98 | 99 | #endif // MAPVIZ_PLUGINS__PATH_PLUGIN_H_ 100 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/point_click_publisher_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014-2020, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__POINT_CLICK_PUBLISHER_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__POINT_CLICK_PUBLISHER_PLUGIN_H_ 32 | 33 | // Include mapviz_plugin.h first to ensure GL deps are included in the right order 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | 44 | #include 45 | 46 | // C++ Standard Libraries 47 | #include 48 | 49 | // QT autogenerated files 50 | #include "ui_point_click_publisher_config.h" 51 | 52 | /** 53 | * This is a pretty straightforward plugin. It watches for user clicks on the 54 | * canvas, then converts the coordinates into a specified frame and publishes 55 | * them as PointStamped messages on a specified topic. 56 | */ 57 | namespace mapviz_plugins 58 | { 59 | class PointClickPublisherPlugin : public mapviz::MapvizPlugin 60 | { 61 | Q_OBJECT 62 | public: 63 | PointClickPublisherPlugin(); 64 | ~PointClickPublisherPlugin() override; 65 | 66 | bool Initialize(QGLWidget* canvas) override; 67 | void Shutdown() override {} 68 | 69 | void SetNode(rclcpp::Node& node) override; 70 | void PrintError(const std::string& message) override; 71 | void PrintInfo(const std::string& message) override; 72 | void PrintWarning(const std::string& message) override; 73 | 74 | void Draw(double x, double y, double scale) override; 75 | 76 | void Transform() override {} 77 | 78 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 79 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 80 | 81 | QWidget* GetConfigWidget(QWidget* parent) override; 82 | 83 | protected Q_SLOTS: 84 | void pointClicked(const QPointF& point); 85 | void topicChanged(const QString& topic); 86 | void updateFrames(); 87 | 88 | private: 89 | Ui::point_click_publisher_config ui_{}; 90 | QWidget* config_widget_; 91 | 92 | CanvasClickFilter click_filter_; 93 | mapviz::MapCanvas* canvas_; 94 | 95 | QTimer frame_timer_; 96 | rclcpp::Publisher::SharedPtr point_publisher_; 97 | }; 98 | } // namespace mapviz_plugins 99 | 100 | #endif // MAPVIZ_PLUGINS__POINT_CLICK_PUBLISHER_PLUGIN_H_ 101 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/pose_plugin.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 Hatchbed L.L.C. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | **/ 30 | 31 | #ifndef MAPVIZ_PLUGINS__POSE_PLUGIN_H_ 32 | #define MAPVIZ_PLUGINS__POSE_PLUGIN_H_ 33 | 34 | // Include mapviz_plugin.h first to ensure GL deps are included in the right order 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | // QT libraries 41 | #include 42 | #include 43 | #include 44 | 45 | // ROS libraries 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | // C++ standard libraries 52 | #include 53 | #include 54 | #include 55 | 56 | // QT autogenerated files 57 | #include "ui_pose_config.h" 58 | 59 | namespace mapviz_plugins 60 | { 61 | class PosePlugin : public mapviz_plugins::PointDrawingPlugin 62 | { 63 | Q_OBJECT 64 | 65 | public: 66 | PosePlugin(); 67 | ~PosePlugin() override = default; 68 | 69 | bool Initialize(QGLWidget* canvas) override; 70 | void Shutdown() override {} 71 | 72 | void Draw(double x, double y, double scale) override; 73 | 74 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 75 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 76 | 77 | QWidget* GetConfigWidget(QWidget* parent) override; 78 | 79 | protected: 80 | void PrintError(const std::string& message) override; 81 | void PrintInfo(const std::string& message) override; 82 | void PrintWarning(const std::string& message) override; 83 | 84 | protected Q_SLOTS: 85 | void SelectTopic(); 86 | void TopicEdited(); 87 | 88 | private: 89 | Ui::pose_config ui_; 90 | QWidget* config_widget_; 91 | 92 | std::string topic_; 93 | rmw_qos_profile_t qos_; 94 | 95 | rclcpp::Subscription::SharedPtr pose_sub_; 96 | bool has_message_; 97 | 98 | void connectCallback(const std::string& topic, const rmw_qos_profile_t& qos); 99 | void PoseCallback(const geometry_msgs::msg::PoseStamped::SharedPtr pose); 100 | }; 101 | } // namespace mapviz_plugins 102 | 103 | #endif // MAPVIZ_PLUGINS__POSE_PLUGIN_H_ 104 | -------------------------------------------------------------------------------- /mapviz_plugins/include/mapviz_plugins/tf_frame_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014-2020, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS__TF_FRAME_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS__TF_FRAME_PLUGIN_H_ 32 | 33 | #include 34 | #include 35 | // QT libraries 36 | #include 37 | #include 38 | #include 39 | 40 | // ROS libraries 41 | #include 42 | #include 43 | 44 | #include 45 | 46 | // C++ standard libraries 47 | #include 48 | #include 49 | #include 50 | 51 | // QT autogenerated files 52 | #include "ui_tf_frame_config.h" 53 | 54 | namespace mapviz_plugins 55 | { 56 | class TfFramePlugin : public mapviz_plugins::PointDrawingPlugin 57 | { 58 | Q_OBJECT 59 | 60 | public: 61 | TfFramePlugin(); 62 | ~TfFramePlugin() override = default; 63 | 64 | bool Initialize(QGLWidget* canvas) override; 65 | void Shutdown() override {} 66 | 67 | void Draw(double x, double y, double scale) override; 68 | 69 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 70 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 71 | 72 | QWidget* GetConfigWidget(QWidget* parent) override; 73 | 74 | protected: 75 | void PrintError(const std::string& message) override; 76 | void PrintInfo(const std::string& message) override; 77 | void PrintWarning(const std::string& message) override; 78 | 79 | protected Q_SLOTS: 80 | void SelectFrame(); 81 | void FrameEdited(); 82 | 83 | private: 84 | Ui::tf_frame_config ui_{}; 85 | QWidget* config_widget_; 86 | 87 | rclcpp::TimerBase::SharedPtr timer_; 88 | 89 | void TimerCallback(); 90 | }; 91 | } // namespace mapviz_plugins 92 | 93 | #endif // MAPVIZ_PLUGINS__TF_FRAME_PLUGIN_H_ 94 | -------------------------------------------------------------------------------- /mapviz_plugins/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \section mapviz_plugins 4 | 5 | \b mapviz_plugins is a set of API's for ... 6 | 7 | This package... (see sumet_perception/material_classification/mainpage.dox for example description) 8 | 9 | 10 | \subsection codeapi Code API 11 | 12 | The C++ API consists of the following main classes: 13 | 14 | - \b mapviz_plugins::GridPlugin - \copybrief mapviz_plugins::GridPlugin 15 | - \b mapviz_plugins::ImagePlugin - \copybrief mapviz_plugins::ImagePlugin 16 | - \b mapviz_plugins::MarkerPlugin - \copybrief mapviz_plugins::MarkerPlugin 17 | - \b mapviz_plugins::MultiresImagePlugin - \copybrief mapviz_plugins::MultiresImagePlugin 18 | - \b MultiresView - \copybrief MultiresView 19 | - \b mapviz_plugins::OdometryPlugin - \copybrief mapviz_plugins::OdometryPlugin 20 | - \b mapviz_plugins::PathPlugin - \copybrief mapviz_plugins::PathPlugin 21 | - \b mapviz_plugins::RobotImagePlugin - \copybrief mapviz_plugins::RobotImagePlugin 22 | 23 | **/ 24 | -------------------------------------------------------------------------------- /mapviz_plugins/package.xml: -------------------------------------------------------------------------------- 1 | 2 | mapviz_plugins 3 | 2.5.5 4 | 5 | 6 | Common plugins for the Mapviz visualization tool 7 | 8 | 9 | Marc Alban 10 | P. J. Reed 11 | Southwest Research Institute 12 | BSD 13 | https://github.com/swri-robotics/mapviz 14 | 15 | ament_cmake 16 | qt5-qmake 17 | 18 | libqt5-core 19 | libqt5-opengl-dev 20 | ros_environment 21 | 22 | ament_index_cpp 23 | cv_bridge 24 | geometry_msgs 25 | gps_msgs 26 | image_transport 27 | map_msgs 28 | mapviz 29 | marti_common_msgs 30 | marti_nav_msgs 31 | marti_sensor_msgs 32 | marti_visualization_msgs 33 | 34 | 35 | nav_msgs 36 | pluginlib 37 | rclcpp_action 38 | rclcpp 39 | sensor_msgs 40 | std_msgs 41 | std_srvs 42 | stereo_msgs 43 | swri_image_util 44 | swri_math_util 45 | swri_route_util 46 | swri_transform_util 47 | tf2 48 | visualization_msgs 49 | 50 | libqt5-opengl 51 | 52 | 53 | ament_cmake 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /mapviz_plugins/src/canvas_click_filter.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #include 31 | #include 32 | #include 33 | #include "mapviz_plugins/canvas_click_filter.h" 34 | 35 | namespace mapviz_plugins 36 | { 37 | CanvasClickFilter::CanvasClickFilter() 38 | : QObject() 39 | , is_mouse_down_(false) 40 | , max_ms_(Q_INT64_C(500)) 41 | , max_distance_(2.0) 42 | { } 43 | 44 | void CanvasClickFilter::setMaxClickTime(qint64 max_ms) 45 | { 46 | max_ms_ = max_ms; 47 | } 48 | 49 | void CanvasClickFilter::setMaxClickMovement(qreal max_distance) 50 | { 51 | max_distance_ = max_distance; 52 | } 53 | 54 | bool CanvasClickFilter::eventFilter(QObject* object, QEvent* event) 55 | { 56 | if (event->type() == QEvent::MouseButtonPress) 57 | { 58 | is_mouse_down_ = true; 59 | QMouseEvent* me = dynamic_cast(event); 60 | mouse_down_pos_ = me->localPos(); 61 | mouse_down_time_ = QDateTime::currentMSecsSinceEpoch(); 62 | } else if (event->type() == QEvent::MouseButtonRelease) { 63 | if (is_mouse_down_) 64 | { 65 | QMouseEvent* me = dynamic_cast(event); 66 | 67 | qreal distance = QLineF(mouse_down_pos_, me->localPos()).length(); 68 | qint64 msecsDiff = QDateTime::currentMSecsSinceEpoch() - mouse_down_time_; 69 | 70 | // Only fire the event if the mouse has moved less than the maximum distance 71 | // and was held for shorter than the maximum time.. This prevents click 72 | // events from being fired if the user is dragging the mouse across the map 73 | // or just holding the cursor in place. 74 | if (msecsDiff < max_ms_ && distance <= max_distance_) 75 | { 76 | Q_EMIT pointClicked(me->localPos()); 77 | } 78 | } 79 | is_mouse_down_ = false; 80 | } 81 | return false; 82 | } 83 | } // namespace mapviz_plugins 84 | -------------------------------------------------------------------------------- /mapviz_plugins/ui/attitude_indicator_config.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | attitude_indicator_config 4 | 5 | 6 | 7 | 0 8 | 0 9 | 401 10 | 68 11 | 12 | 13 | 14 | false 15 | 16 | 17 | Form 18 | 19 | 20 | 21 | 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 2 34 | 35 | 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | Sans Serif 43 | 8 44 | 45 | 46 | 47 | Status: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Sans Serif 56 | 8 57 | 58 | 59 | 60 | 61 | 62 | 63 | No topic 64 | 65 | 66 | true 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Sans Serif 75 | 10 76 | 77 | 78 | 79 | Topic: 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | false 90 | 91 | 92 | Select 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | SelectColor() 102 | SelectTopic() 103 | TopicEdited() 104 | PositionToleranceChanged(double) 105 | AngleToleranceChanged(double) 106 | 107 | 108 | -------------------------------------------------------------------------------- /mapviz_plugins/ui/coordinate_picker_config.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | coordinate_picker_config 4 | 5 | 6 | 7 | 0 8 | 0 9 | 404 10 | 304 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Status: 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | No topic 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | QPlainTextEdit::NoWrap 65 | 66 | 67 | true 68 | 69 | 70 | 4.000000000000000 71 | 72 | 73 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 74 | 75 | 76 | 77 | 78 | 79 | 80 | Frame: 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Select 91 | 92 | 93 | 94 | 95 | 96 | 97 | Copy to Clipboard on Click 98 | 99 | 100 | 101 | 102 | 103 | 104 | Clear List 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | SelectColor() 114 | SelectTopic() 115 | TopicEdited() 116 | PositionToleranceChanged(double) 117 | AngleToleranceChanged(double) 118 | 119 | 120 | -------------------------------------------------------------------------------- /mapviz_plugins/ui/draw_polygon_config.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | draw_polygon_config 4 | 5 | 6 | 7 | 0 8 | 0 9 | 404 10 | 304 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 24 43 | 24 44 | 45 | 46 | 47 | false 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Topic: 64 | 65 | 66 | 67 | 68 | 69 | 70 | Publish Polygon 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Status: 81 | 82 | 83 | 84 | 85 | 86 | 87 | Clear 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Color: 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | No topic 111 | 112 | 113 | true 114 | 115 | 116 | 117 | 118 | 119 | 120 | Frame: 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | Select 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | mapviz::ColorButton 139 | QPushButton 140 |
mapviz/color_button.h
141 |
142 |
143 | 144 | 145 | 146 | SelectColor() 147 | SelectTopic() 148 | TopicEdited() 149 | PositionToleranceChanged(double) 150 | AngleToleranceChanged(double) 151 | 152 |
153 | -------------------------------------------------------------------------------- /mapviz_plugins/ui/marker_config.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | marker_config 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | Sans Serif 40 | 8 41 | 42 | 43 | 44 | 45 | 46 | 47 | No topic 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Sans Serif 59 | 8 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Sans Serif 69 | 8 70 | 71 | 72 | 73 | Status: 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 55 82 | 16777215 83 | 84 | 85 | 86 | 87 | Sans Serif 88 | 8 89 | 90 | 91 | 92 | 93 | 94 | 95 | Select 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Sans Serif 104 | 8 105 | 106 | 107 | 108 | Topic: 109 | 110 | 111 | 112 | 113 | 114 | 115 | Clear All Markers 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | SelectColor() 128 | SelectTopic() 129 | TopicEdited() 130 | PositionToleranceChanged(double) 131 | AngleToleranceChanged(double) 132 | 133 | 134 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/QGLMap.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_QGLMAP_H_ 31 | #define MULTIRES_IMAGE_QGLMAP_H_ 32 | 33 | // QT libraries 34 | #include 35 | #include 36 | #include 37 | 38 | // QT auto-generated headers 39 | #include "ui_QGLMap.h" 40 | 41 | #include 42 | 43 | #include 44 | #include 45 | 46 | namespace multires_image 47 | { 48 | class QGLMap : public QGLWidget 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit QGLMap(QWidget *parent = 0); 54 | ~QGLMap() override = default; 55 | 56 | void Exit(); 57 | void UpdateView(); 58 | void SetTiles(TileSet* tiles); 59 | 60 | tf2::Vector3 SceneCenter() { return m_scene_center; } 61 | tf2::Vector3 ViewCenter() { return m_view_center; } 62 | 63 | signals: 64 | void SignalZoomChange(double z); 65 | void SignalViewChange(double x1, double y1, double x2, double y2); 66 | void SignalMemorySize(int64_t bytes); 67 | 68 | public slots: 69 | void LoadTexture(Tile* tile); 70 | void DeleteTexture(Tile* tile); 71 | void ChangeCenter(double x, double y); 72 | void SetTextureMemory(int64_t bytes); 73 | 74 | protected: 75 | void initializeGL() override; 76 | void resizeGL(int w, int h) override; 77 | void paintGL() override; 78 | void mousePressEvent(QMouseEvent* e) override; 79 | void mouseDoubleClickEvent(QMouseEvent* e) override; 80 | void mouseReleaseEvent(QMouseEvent* e) override; 81 | void mouseMoveEvent(QMouseEvent* e) override; 82 | void wheelEvent(QWheelEvent* e) override; 83 | 84 | private: 85 | Ui::QGLMapClass ui; 86 | 87 | bool m_initialized; 88 | 89 | double m_scale; 90 | 91 | bool m_mouseDown; 92 | int m_mouseDownX; 93 | int m_mouseDownY; 94 | 95 | TileView* m_tileView; 96 | 97 | tf2::Vector3 m_view_top_left; 98 | tf2::Vector3 m_view_bottom_right; 99 | tf2::Vector3 m_view_center; 100 | 101 | tf2::Vector3 m_scene_top_left; 102 | tf2::Vector3 m_scene_bottom_right; 103 | tf2::Vector3 m_scene_center; 104 | 105 | void Recenter(); 106 | void MousePan(int x, int y); 107 | }; 108 | } 109 | 110 | #endif // MULTIRES_IMAGE_QGLMAP_H_ 111 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/multires_image_plugin.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014-2020, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS_MULTIRES_IMAGE_PLUGIN_H_ 31 | #define MAPVIZ_PLUGINS_MULTIRES_IMAGE_PLUGIN_H_ 32 | 33 | // C++ standard libraries 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | // QT libraries 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | 47 | #include 48 | 49 | // QT autogenerated files 50 | #include "ui_multires_config.h" 51 | 52 | namespace mapviz_plugins 53 | { 54 | class MultiresImagePlugin : public mapviz::MapvizPlugin 55 | { 56 | Q_OBJECT 57 | 58 | public: 59 | MultiresImagePlugin(); 60 | ~MultiresImagePlugin() override; 61 | 62 | bool Initialize(QGLWidget* canvas) override; 63 | void Shutdown() override {} 64 | 65 | void Draw(double x, double y, double scale) override; 66 | 67 | void Transform() override; 68 | 69 | void LoadConfig(const YAML::Node& node, const std::string& path) override; 70 | void SaveConfig(YAML::Emitter& emitter, const std::string& path) override; 71 | 72 | QWidget* GetConfigWidget(QWidget* parent) override; 73 | 74 | protected: 75 | void PrintError(const std::string& message) override; 76 | void PrintInfo(const std::string& message) override; 77 | void PrintWarning(const std::string& message) override; 78 | 79 | protected Q_SLOTS: 80 | void SelectFile(); 81 | void AcceptConfiguration(); 82 | void SetXOffset(double long_offset); 83 | void SetYOffset(double latitude_offset); 84 | 85 | private: 86 | bool loaded_; 87 | double center_x_; 88 | double center_y_; 89 | double offset_x_; 90 | double offset_y_; 91 | 92 | multires_image::TileSet* tile_set_; 93 | MultiresView* tile_view_; 94 | 95 | Ui::multires_config ui_; 96 | QWidget* config_widget_; 97 | 98 | swri_transform_util::Transform transform_; 99 | swri_transform_util::Transform inverse_transform_; 100 | 101 | bool transformed_; 102 | 103 | void GetCenterPoint(double x, double y); 104 | 105 | std::filesystem::path MakePathRelative( 106 | const std::filesystem::path& path, 107 | const std::filesystem::path& base); 108 | }; 109 | } 110 | 111 | #endif // MAPVIZ_PLUGINS_MULTIRES_IMAGE_PLUGIN_H_ 112 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/multires_view.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MAPVIZ_PLUGINS_MULTIRES_VIEW_H_ 31 | #define MAPVIZ_PLUGINS_MULTIRES_VIEW_H_ 32 | 33 | // QT libraries 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | namespace mapviz_plugins 40 | { 41 | class MultiresView 42 | { 43 | public: 44 | MultiresView(multires_image::TileSet* tiles, QGLWidget* widget); 45 | ~MultiresView() = default; 46 | 47 | const multires_image::TileCache* Cache() { return &m_cache; } 48 | 49 | void SetView(double x, double y, double radius, double scale); 50 | 51 | void Draw(); 52 | 53 | void Exit() { m_cache.Exit(); } 54 | 55 | private: 56 | multires_image::TileSet* m_tiles; 57 | multires_image::TileCache m_cache; 58 | int m_currentLayer; 59 | int m_startRow; 60 | int m_startColumn; 61 | int m_endRow; 62 | int m_endColumn; 63 | 64 | double min_scale_; 65 | }; 66 | } 67 | 68 | #endif // MAPVIZ_PLUGINS_MULTIRES_VIEW_H_ 69 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/multires_view_node.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_MULTIRES_VIEW_NODE_H_ 31 | #define MULTIRES_IMAGE_MULTIRES_VIEW_NODE_H_ 32 | 33 | // C++ standard libraries 34 | #include 35 | #include 36 | 37 | // QT libraries 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | // ROS libraries 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | namespace multires_image 50 | { 51 | class MultiresViewNode : public QMainWindow 52 | { 53 | Q_OBJECT 54 | 55 | public: 56 | MultiresViewNode(int argc, char **argv, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()); 57 | ~MultiresViewNode() override = default; 58 | 59 | virtual void showEvent(QShowEvent* event) override; 60 | 61 | void Initialize(); 62 | 63 | void Spin(); 64 | 65 | private: 66 | void SpinLoop(); 67 | 68 | int argc_; 69 | char** argv_; 70 | 71 | rclcpp::Node::SharedPtr node_; 72 | std::thread* thread_; 73 | 74 | bool initialized_; 75 | 76 | std::string image_path_; 77 | 78 | TileSet* tile_set_; 79 | }; 80 | } 81 | 82 | #endif // MULTIRES_IMAGE_MULTIRES_VIEW_NODE_H_ 83 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/tile.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_TILE_H_ 31 | #define MULTIRES_IMAGE_TILE_H_ 32 | 33 | // C++ standard libraries 34 | #include 35 | 36 | // QT libraries 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | 44 | #ifndef GL_CLAMP_TO_EDGE 45 | #define GL_CLAMP_TO_EDGE 0x812F 46 | #endif 47 | 48 | namespace multires_image 49 | { 50 | class Tile 51 | { 52 | public: 53 | Tile( 54 | const std::string& path, int column, int row, int level, 55 | const tf2::Vector3& topLeft, 56 | const tf2::Vector3& topRight, 57 | const tf2::Vector3& bottomLeft, 58 | const tf2::Vector3& bottomRight); 59 | ~Tile() = default; 60 | 61 | bool Exists(); 62 | bool Failed() const { return m_failed; } 63 | bool TextureLoaded() const { return m_textureLoaded; } 64 | const QImage& Image() const { return m_image; } 65 | int64_t TileID() const { return m_tileId; } 66 | int Layer() const { return m_level; } 67 | int MemorySize() const { return m_memorySize; } 68 | int Row() const { return m_row; } 69 | int Column() const { return m_column; } 70 | 71 | bool LoadImageToMemory(bool gl = true); 72 | void UnloadImage(); 73 | 74 | bool LoadTexture(); 75 | void UnloadTexture(); 76 | 77 | void Draw(); 78 | 79 | void Transform(const swri_transform_util::Transform& transform); 80 | void Transform(const swri_transform_util::Transform& transform, const swri_transform_util::Transform& offset_tf); 81 | 82 | private: 83 | const std::string m_path; 84 | const int m_column; 85 | const int m_row; 86 | const int m_level; 87 | 88 | tf2::Vector3 m_top_left; 89 | tf2::Vector3 m_top_right; 90 | tf2::Vector3 m_bottom_right; 91 | tf2::Vector3 m_bottom_left; 92 | 93 | tf2::Vector3 m_transformed_top_left; 94 | tf2::Vector3 m_transformed_top_right; 95 | tf2::Vector3 m_transformed_bottom_right; 96 | tf2::Vector3 m_transformed_bottom_left; 97 | 98 | bool m_failed; 99 | bool m_textureLoaded; 100 | int m_dimension; 101 | int m_textureId; 102 | int64_t m_tileId; 103 | int m_memorySize; 104 | QImage m_image; 105 | QMutex m_mutex; 106 | }; 107 | } 108 | 109 | #endif // MULTIRES_IMAGE_TILE_H_ 110 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/tile_set.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_TILE_SET_H_ 31 | #define MULTIRES_IMAGE_TILE_SET_H_ 32 | 33 | // C++ standard libraries 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | namespace multires_image 42 | { 43 | class TileSet 44 | { 45 | public: 46 | explicit TileSet(const std::string& geofile); 47 | TileSet(const std::string& geofile, const std::string extension); 48 | explicit TileSet(const swri_transform_util::GeoReference& georeference); 49 | TileSet(const swri_transform_util::GeoReference& georeference, 50 | const std::string extension); 51 | 52 | ~TileSet(); 53 | 54 | bool Load(); 55 | 56 | int LayerCount() { return m_layerCount; } 57 | int TileSize() { return m_tileSize; } 58 | 59 | swri_transform_util::GeoReference& GeoReference() { return m_geo; } 60 | 61 | TileSetLayer* GetLayer(int layer) { return m_layers[layer]; } 62 | 63 | private: 64 | swri_transform_util::GeoReference m_geo; 65 | int m_tileSize{}; 66 | int m_width{}; 67 | int m_height{}; 68 | 69 | std::string m_cacheDir; 70 | std::string m_extension; 71 | 72 | int m_layerCount{}; 73 | 74 | std::vector m_layers; 75 | }; 76 | } 77 | 78 | #endif // MULTIRES_IMAGE_TILE_SET_H_ 79 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/tile_set_layer.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_TILE_SET_LAYER_H_ 31 | #define MULTIRES_IMAGE_TILE_SET_LAYER_H_ 32 | 33 | // C++ standard libraries 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include 42 | 43 | namespace multires_image 44 | { 45 | class TileSetLayer 46 | { 47 | public: 48 | TileSetLayer( 49 | const swri_transform_util::GeoReference& geo, 50 | const std::string& path, 51 | int tileSize, int layer); 52 | 53 | ~TileSetLayer() = default; 54 | 55 | bool Load(); 56 | bool Load(const std::string extension); 57 | 58 | Tile* GetTile(int column, int row) { return m_tiles[column][row]; } 59 | 60 | void GetTileIndex(const tf2::Vector3& position, int& row, int& column) const; 61 | void GetTileIndex(double x, double y, int& row, int& column) const; 62 | void GetTileRange( 63 | const tf2::Vector3& top_left, 64 | const tf2::Vector3& bottom_right, 65 | int& startRow, int& startColumn, 66 | int& endRow, int& endColumn) const; 67 | 68 | int RowCount() { return m_rows; } 69 | int ColumnCount() { return m_columns; } 70 | 71 | private: 72 | const swri_transform_util::GeoReference& m_geo; 73 | const std::string m_path; 74 | const int m_tileSize; 75 | const int m_layer; 76 | const double m_scale; 77 | 78 | bool m_expectTiles; 79 | 80 | int m_columns; 81 | int m_rows; 82 | 83 | std::vector > m_tiles; 84 | }; 85 | } 86 | 87 | #endif // MULTIRES_IMAGE_TILE_SET_LAYER_H_ 88 | -------------------------------------------------------------------------------- /multires_image/include/multires_image/tile_view.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef MULTIRES_IMAGE_TILE_VIEW_H_ 31 | #define MULTIRES_IMAGE_TILE_VIEW_H_ 32 | 33 | // QT libraries 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | namespace multires_image 40 | { 41 | class TileView 42 | { 43 | public: 44 | TileView(TileSet* tiles, QGLWidget* widget); 45 | ~TileView() = default; 46 | 47 | const TileCache* Cache() { return &m_cache; } 48 | 49 | void SetView(double x, double y, double radius, double scale); 50 | 51 | void Draw(); 52 | 53 | void Exit() { m_cache.Exit(); } 54 | 55 | private: 56 | TileSet* m_tiles; 57 | TileCache m_cache; 58 | int m_currentLayer; 59 | int m_startRow; 60 | int m_startColumn; 61 | int m_endRow; 62 | int m_endColumn; 63 | double min_scale_; 64 | }; 65 | } 66 | 67 | #endif // MULTIRES_IMAGE_TILE_VIEW_H_ 68 | -------------------------------------------------------------------------------- /multires_image/launch/mapviz_tile_loader.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [{ name: swri, 8 | latitude: 29.45196669, 9 | longitude: -98.61370577, 10 | altitude: 233.719, 11 | heading: 0.0}, 12 | 13 | { name: back_40, 14 | latitude: 29.447507, 15 | longitude: -98.629367, 16 | altitude: 200.0, 17 | heading: 0.0}] 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /multires_image/launch/multires.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /multires_image/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \section multires_image 4 | 5 | \b multires_image is a set of API's and nodes for ... 6 | 7 | This package... (see sumet_perception/material_classification/mainpage.dox for example description) 8 | 9 | 10 | \subsection codeapi Code API 11 | 12 | The C++ API consists of the following main classes: 13 | 14 | - \b multires_image::GeoRegister - \copybrief multires_image::GeoRegister 15 | - \b multires_image::ImageManip - \copybrief multires_image::ImageManip 16 | - \b multires_image::MathUtil - \copybrief multires_image::MathUtil 17 | - \b multires_image::Point - \copybrief multires_image::Point 18 | - \b multires_image::QGLMap - \copybrief multires_image::QGLMap 19 | - \b multires_image::StringUtil - \copybrief multires_image::StringUtil 20 | - \b multires_image::TileCache - \copybrief multires_image::TileCache 21 | - \b multires_image::TileSetLayer - \copybrief multires_image::TileSetLayer 22 | - \b multires_image::TileSet - \copybrief multires_image::TileSet 23 | - \b multires_image::TileView - \copybrief multires_image::TileView 24 | - \b multires_image::Tile - \copybrief multires_image::Tile 25 | 26 | 27 | \subsection nodes Nodes 28 | 29 | \subsubsection multires_view_node 30 | \copydetails src/nodes/multires_view_node.cpp 31 | 32 | 33 | **/ 34 | -------------------------------------------------------------------------------- /multires_image/mapviz_plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Multires image mapviz plugin. 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /multires_image/package.xml: -------------------------------------------------------------------------------- 1 | 2 | multires_image 3 | 2.5.5 4 | 5 | 6 | multires_image 7 | 8 | 9 | Marc Alban 10 | P. J. Reed 11 | Southwest Research Institute 12 | BSD 13 | https://github.com/swri-robotics/mapviz 14 | 15 | ament_cmake 16 | qt5-qmake 17 | 18 | libqt5-core 19 | libqt5-opengl-dev 20 | 21 | geometry_msgs 22 | mapviz 23 | pluginlib 24 | rclcpp 25 | swri_math_util 26 | swri_transform_util 27 | tf2 28 | 29 | libqt5-opengl 30 | rclpy 31 | 32 | 33 | ament_cmake 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /multires_image/src/QGLMap.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | QGLMapClass 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | QGLMap 15 | 16 | 17 | 18 | 19 | 20 | QGLWidget 21 | QWidget 22 |
qglwidget.h
23 | 1 24 |
25 |
26 | 27 | 28 | 29 | LoadTexture(Tile*tile) 30 | DeleteTexture(Tile*tile) 31 | 32 |
33 | -------------------------------------------------------------------------------- /multires_image/src/nodes/multires_view_node.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | /** 31 | * \file 32 | * 33 | * multires_image::MultiresViewNode. Description. 34 | * - \b Parameters 35 | * - \e "node_name"/image_path [string] - Description. [""] 36 | */ 37 | 38 | #include 39 | #include 40 | 41 | // QT libraries 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include 49 | 50 | namespace multires_image 51 | { 52 | MultiresViewNode::MultiresViewNode(int argc, char **argv, QWidget *parent, Qt::WindowFlags flags) 53 | : QMainWindow(parent, flags) 54 | , argc_(argc) 55 | , argv_(argv) 56 | , node_(nullptr) 57 | , thread_{} 58 | , initialized_(false) 59 | , tile_set_(nullptr) 60 | { 61 | setCentralWidget(new QGLMap()); 62 | this->setMinimumSize(640, 480); 63 | } 64 | 65 | void MultiresViewNode::Spin() 66 | { 67 | if (!thread_) 68 | { 69 | thread_ = new std::thread(&MultiresViewNode::SpinLoop, this); 70 | } 71 | } 72 | 73 | void MultiresViewNode::SpinLoop() 74 | { 75 | while (rclcpp::ok()) 76 | { 77 | rclcpp::spin_some(node_); 78 | 79 | usleep(10); 80 | } 81 | } 82 | 83 | void MultiresViewNode::showEvent(QShowEvent* event) 84 | { 85 | Initialize(); 86 | } 87 | 88 | void MultiresViewNode::Initialize() 89 | { 90 | if (!initialized_) 91 | { 92 | rclcpp::init(argc_, argv_); 93 | 94 | node_ = std::make_shared("multires_view_node"); 95 | 96 | node_->declare_parameter("image_path", ""); 97 | 98 | node_->get_parameter("image_path", image_path_); 99 | 100 | tile_set_ = new TileSet(image_path_); 101 | 102 | if (tile_set_->Load()) 103 | { 104 | QGLMap* glMap = reinterpret_cast(centralWidget()); 105 | glMap->SetTiles(tile_set_); 106 | glMap->UpdateView(); 107 | } 108 | else 109 | { 110 | QMessageBox::warning(this, "Error", "Failed to load tiles."); 111 | } 112 | 113 | Spin(); 114 | 115 | initialized_ = true; 116 | } 117 | } 118 | } 119 | 120 | int main(int argc, char **argv) 121 | { 122 | // Initialize QT 123 | QApplication app(argc, argv); 124 | 125 | multires_image::MultiresViewNode node(argc, argv); 126 | node.show(); 127 | 128 | return QApplication::exec(); 129 | } 130 | -------------------------------------------------------------------------------- /multires_image/src/tile_set.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #include 31 | 32 | // C++ standard libraries 33 | #include 34 | #include 35 | #include 36 | 37 | // QT libraries 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | namespace multires_image 44 | { 45 | TileSet::TileSet(const std::string& geofile) : 46 | m_geo(geofile), 47 | m_extension("jpg") 48 | { 49 | } 50 | 51 | TileSet::TileSet(const std::string& geofile, const std::string extension) : 52 | m_geo(geofile), 53 | m_extension(extension) 54 | { 55 | } 56 | 57 | TileSet::TileSet(const swri_transform_util::GeoReference& georeference) : 58 | m_geo(georeference), 59 | m_extension("jpg") 60 | { 61 | } 62 | 63 | TileSet::TileSet(const swri_transform_util::GeoReference& georeference, 64 | const std::string extension) : 65 | m_geo(georeference), 66 | m_extension(extension) 67 | { 68 | } 69 | 70 | TileSet::~TileSet() 71 | { 72 | // Free each of the layers. 73 | for (auto & m_layer : m_layers) 74 | { 75 | delete m_layer; 76 | } 77 | } 78 | 79 | bool TileSet::Load() 80 | { 81 | if (!m_geo.Load()) 82 | { 83 | return false; 84 | } 85 | 86 | m_cacheDir = m_geo.Path(); 87 | m_width = m_geo.Width(); 88 | m_height = m_geo.Height(); 89 | m_tileSize = m_geo.TileSize(); 90 | m_extension = m_geo.Extension(); 91 | 92 | float max_dim = std::max(m_width, m_height); 93 | m_layerCount = std::ceil(std::log(max_dim / m_tileSize) / std::log(2.0f)) + 1; 94 | m_layers.reserve(m_layerCount); 95 | 96 | // Check if the cache directory for this image exists. 97 | QDir directory(m_cacheDir.c_str()); 98 | if (!directory.exists()) 99 | { 100 | return false; 101 | } 102 | 103 | // Load each layer. 104 | for (int i = 0; i < m_layerCount; i++) 105 | { 106 | QString layerNum = QString::number(i); 107 | 108 | // Check if this layer exists in the cache. 109 | QDir layerDir(directory.absolutePath() + "/layer" + layerNum); 110 | if (!layerDir.exists(layerDir.absolutePath())) 111 | { 112 | return false; 113 | } 114 | 115 | // Load the base layer. 116 | m_layers.push_back(new TileSetLayer(m_geo, layerDir.absolutePath().toStdString(), m_tileSize, i)); 117 | 118 | if (!m_layers[i]->Load(m_extension)) 119 | return false; 120 | } 121 | 122 | return true; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /multires_image/test.geo: -------------------------------------------------------------------------------- 1 | // Image properties 2 | image_path: tiles 3 | image_width: 25600 4 | image_height: 17920 5 | tile_size: 512 6 | 7 | // Coordinate System 8 | datum: wgs84 9 | projection: geographic 10 | 11 | // Georeference 12 | tiepoint: [6785, 336, 29.45196669, -98.61370577] 13 | pixel_scale: [0.00000157, 0.000001375] 14 | -------------------------------------------------------------------------------- /tile_map/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ### SET CMAKE POLICIES ### 2 | cmake_minimum_required(VERSION 3.10...3.17) 3 | 4 | if(${CMAKE_VERSION} VERSION_LESS 3.12) 5 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 6 | endif() 7 | 8 | if (NOT CMAKE_CXX_STANDARD) 9 | set(CMAKE_CXX_STANDARD 17) 10 | endif() 11 | 12 | if(${CMAKE_VERSION} VERSION_EQUAL "3.11.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.11.0") 13 | cmake_policy(SET CMP0072 NEW) 14 | endif() 15 | 16 | if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_ID MATCHES "Clang") 17 | add_compile_options(-Wall -Wextra -Wpedantic) 18 | endif() 19 | ### END CMAKE POLICIES ### 20 | 21 | project(tile_map 22 | LANGUAGES CXX) 23 | 24 | # ROS packages 25 | find_package(ament_cmake REQUIRED) 26 | find_package(mapviz REQUIRED) 27 | find_package(pluginlib REQUIRED) 28 | find_package(rclcpp REQUIRED) 29 | find_package(swri_math_util REQUIRED) 30 | find_package(swri_transform_util REQUIRED) 31 | find_package(tf2 REQUIRED) 32 | 33 | # Qt 5 34 | find_package(Qt5Core REQUIRED) 35 | find_package(Qt5Gui REQUIRED) 36 | find_package(Qt5Network REQUIRED) 37 | find_package(Qt5OpenGL REQUIRED) 38 | find_package(Qt5Widgets REQUIRED) 39 | 40 | ### OpenGL ### 41 | find_package(OpenGL REQUIRED) 42 | 43 | ### GLEW ### 44 | find_package(GLEW REQUIRED) 45 | 46 | ### PkgConfig ### 47 | find_package(PkgConfig REQUIRED) 48 | 49 | ### yaml-cpp ### 50 | pkg_check_modules(YamlCpp yaml-cpp) 51 | 52 | ### Use PkgConfig to find jsoncpp ### 53 | pkg_check_modules(JSONCPP REQUIRED jsoncpp) 54 | 55 | # Need to include the current dir to include the results of building Qt UI files 56 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 57 | 58 | set(TILE_SRC_FILES 59 | src/image_cache.cpp 60 | src/texture_cache.cpp 61 | src/bing_source.cpp 62 | src/tile_source.cpp 63 | src/wmts_source.cpp 64 | src/${PROJECT_NAME}_view.cpp 65 | ) 66 | set(QT_HEADERS 67 | include/${PROJECT_NAME}/image_cache.h 68 | include/${PROJECT_NAME}/tile_source.h 69 | include/${PROJECT_NAME}/wmts_source.h 70 | include/${PROJECT_NAME}/bing_source.h 71 | ) 72 | qt5_wrap_cpp(TILE_SRC_FILES ${QT_HEADERS}) 73 | add_library(${PROJECT_NAME} ${TILE_SRC_FILES}) 74 | target_include_directories(${PROJECT_NAME} 75 | PUBLIC 76 | $ 77 | $ 78 | ${JSONCPP_INCLUDE_DIRS} 79 | ${YamlCpp_INCLUDE_DIRS}) 80 | 81 | target_link_libraries(${PROJECT_NAME} PUBLIC 82 | ${GLU_LIBRARY} 83 | GLEW::GLEW 84 | ${JSONCPP_LIBRARIES} 85 | ${mapviz_TARGETS} 86 | Qt5::Network 87 | Qt5::Core 88 | Qt5::Gui 89 | Qt5::OpenGL 90 | Qt5::Widgets 91 | pluginlib::pluginlib 92 | rclcpp::rclcpp 93 | ${swri_transform_util_TARGETS} 94 | tf2::tf2 95 | ${YamlCpp_LIBRARIES}) 96 | 97 | set(PLUGIN_SRC_FILES 98 | src/${PROJECT_NAME}_plugin.cpp) 99 | set(PLUGIN_UI_FILES 100 | src/${PROJECT_NAME}_config.ui) 101 | 102 | qt5_wrap_ui(PLUGIN_SRC_FILES ${PLUGIN_UI_FILES}) 103 | qt5_wrap_cpp(PLUGIN_SRC_FILES include/${PROJECT_NAME}/${PROJECT_NAME}_plugin.h) 104 | 105 | add_library(${PROJECT_NAME}_plugin SHARED ${PLUGIN_SRC_FILES}) 106 | target_link_libraries(${PROJECT_NAME}_plugin ${PROJECT_NAME}) 107 | 108 | install(DIRECTORY include/ 109 | DESTINATION include/${PROJECT_NAME} 110 | FILES_MATCHING PATTERN "*.h" 111 | ) 112 | 113 | install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_plugin 114 | EXPORT export_${PROJECT_NAME} 115 | RUNTIME DESTINATION bin 116 | LIBRARY DESTINATION lib 117 | ARCHIVE DESTINATION lib 118 | ) 119 | 120 | pluginlib_export_plugin_description_file(mapviz mapviz_plugins.xml) 121 | 122 | ament_export_targets(export_${PROJECT_NAME}) 123 | ament_export_dependencies(${RUNTIME_DEPS} 124 | Qt5::Network 125 | Qt5::Core 126 | Qt5::Gui 127 | Qt5::OpenGL 128 | Qt5::Widgets 129 | ) 130 | ament_package() 131 | -------------------------------------------------------------------------------- /tile_map/include/tile_map/texture_cache.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2014, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef TILE_MAP_TEXTURE_CACHE_H_ 31 | #define TILE_MAP_TEXTURE_CACHE_H_ 32 | 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | namespace tile_map 40 | { 41 | class Texture 42 | { 43 | public: 44 | Texture(int32_t texture_id, size_t hash); 45 | ~Texture(); 46 | 47 | const int32_t id; 48 | const size_t url_hash; 49 | 50 | bool failed; 51 | }; 52 | typedef std::shared_ptr TexturePtr; 53 | 54 | class TextureCache 55 | { 56 | public: 57 | explicit TextureCache(ImageCachePtr image_cache, 58 | size_t size = 512, 59 | rclcpp::Logger logger = rclcpp::get_logger("tile_map::TextureCache")); 60 | 61 | TexturePtr GetTexture(size_t url_hash, const QString& url, bool& failed, int priority); 62 | void AddTexture(const TexturePtr& texture); 63 | 64 | void SetLogger(rclcpp::Logger logger); 65 | 66 | void Clear(); 67 | 68 | private: 69 | QCache cache_; 70 | 71 | ImageCachePtr image_cache_; 72 | 73 | rclcpp::Logger logger_; 74 | }; 75 | typedef std::shared_ptr TextureCachePtr; 76 | } 77 | 78 | #endif // TILE_MAP_TEXTURE_CACHE_H_ 79 | -------------------------------------------------------------------------------- /tile_map/include/tile_map/tile_map_view.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 21 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | // 28 | // ***************************************************************************** 29 | 30 | #ifndef TILE_MAP_TILE_MAP_VIEW_H_ 31 | #define TILE_MAP_TILE_MAP_VIEW_H_ 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | #include 41 | 42 | namespace tile_map 43 | { 44 | class TileSource; 45 | 46 | struct Tile 47 | { 48 | public: 49 | QString url; 50 | size_t url_hash; 51 | int32_t level; 52 | int32_t subdiv_count; 53 | double subwidth; 54 | 55 | TexturePtr texture; 56 | 57 | std::vector points; 58 | std::vector points_t; 59 | }; 60 | 61 | class TileMapView 62 | { 63 | public: 64 | explicit TileMapView(rclcpp::Logger logger = rclcpp::get_logger("tile_map::TileMapView")); 65 | 66 | bool IsReady(); 67 | 68 | void ResetCache(); 69 | 70 | void SetLogger(rclcpp::Logger logger); 71 | 72 | void SetTileSource(const std::shared_ptr& tile_source); 73 | 74 | void SetTransform(const swri_transform_util::Transform& transform); 75 | 76 | void SetView( 77 | double latitude, 78 | double longitude, 79 | double scale, 80 | int32_t width, 81 | int32_t height); 82 | 83 | void Draw(); 84 | 85 | private: 86 | void DrawTiles(std::vector &tiles ,int priority); 87 | 88 | std::shared_ptr tile_source_; 89 | 90 | swri_transform_util::Transform transform_; 91 | 92 | int32_t level_; 93 | 94 | int64_t center_x_; 95 | int64_t center_y_; 96 | 97 | int64_t size_; 98 | 99 | int32_t width_; 100 | int32_t height_; 101 | 102 | std::vector tiles_; 103 | std::vector precache_; 104 | 105 | TextureCachePtr tile_cache_; 106 | 107 | rclcpp::Logger logger_; 108 | 109 | void ToLatLon(int32_t level, double x, double y, double& latitude, double& longitude); 110 | 111 | void InitializeTile(int32_t level, int64_t x, int64_t y, Tile& tile, int priority); 112 | }; 113 | } 114 | 115 | #endif // TILE_MAP_TILE_MAP_VIEW_H_ 116 | -------------------------------------------------------------------------------- /tile_map/include/tile_map/wmts_source.h: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015-2025, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | 31 | #ifndef TILE_MAP_WMTS_SOURCE_H 32 | #define TILE_MAP_WMTS_SOURCE_H 33 | 34 | #include "tile_source.h" 35 | 36 | #include 37 | 38 | namespace tile_map 39 | { 40 | class WmtsSource : public TileSource 41 | { 42 | Q_OBJECT 43 | public: 44 | /** 45 | * Creates a new tile source from a set of known parameters. 46 | * 47 | * @param[in] name A user-friendly display name 48 | * @param[in] base_url The base HTTP URL of the data source; e. g.: 49 | * "http://tile.stamen.com/terrain/" 50 | * @param[in] is_custom If this is a custom (i. e. not one of the default) 51 | * tile source; custom sources are saved and loaded from our settings 52 | * @param[in] max_zoom The maximum zoom level 53 | */ 54 | explicit WmtsSource(const QString& name, 55 | const QString& base_url, 56 | bool is_custom, 57 | int32_t max_zoom); 58 | 59 | virtual size_t GenerateTileHash(int32_t level, int64_t x, int64_t y); 60 | 61 | /** 62 | * Given a zoom level and x and y coordinates appropriate for the tile source's 63 | * projection, this will generate a URL that points to an image tile for that 64 | * location. 65 | * 66 | * This expects the URL to have three strings in it, "{level}", "{x}", and "{y}", 67 | * which will be replaced with the passed values. See tile_map_plugin.cpp for 68 | * example URLs. 69 | * 70 | * @param[in] level The zoom level 71 | * @param[in] x The X coordinate of the tile 72 | * @param[in] y The Y coordinate of the tile 73 | * @return A URL that references that tile 74 | */ 75 | virtual QString GenerateTileUrl(int32_t level, int64_t x, int64_t y); 76 | 77 | virtual QString GetType() const; 78 | 79 | static const QString WMTS_TYPE; 80 | 81 | private: 82 | std::hash hash_; 83 | }; 84 | } 85 | 86 | #endif //TILE_MAP_WMTS_SOURCE_H 87 | -------------------------------------------------------------------------------- /tile_map/mapviz_plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Plugin for viewing slippy maps from a map server. 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tile_map/package.xml: -------------------------------------------------------------------------------- 1 | 2 | tile_map 3 | 2.5.5 4 | 5 | 6 | Tile map provides a slippy map style interface for visualizing 7 | OpenStreetMap and GoogleMap tiles. A mapviz visualization plug-in is also 8 | implemented 9 | 10 | 11 | Marc Alban 12 | P. J. Reed 13 | Southwest Research Institute 14 | BSD 15 | https://github.com/swri-robotics/mapviz 16 | 17 | ament_cmake 18 | qt5-qmake 19 | 20 | libjsoncpp-dev 21 | libqt5-core 22 | libqt5-opengl-dev 23 | 24 | libglew-dev 25 | mapviz 26 | pluginlib 27 | rclcpp 28 | swri_math_util 29 | swri_transform_util 30 | tf2 31 | yaml-cpp 32 | 33 | libjsoncpp 34 | libqt5-opengl 35 | 36 | 37 | ament_cmake 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tile_map/src/tile_source.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | 31 | #include 32 | 33 | namespace tile_map 34 | { 35 | const QString& TileSource::GetBaseUrl() const 36 | { 37 | return base_url_; 38 | } 39 | 40 | void TileSource::SetBaseUrl(const QString& base_url) 41 | { 42 | base_url_ = base_url; 43 | } 44 | 45 | bool TileSource::IsCustom() const 46 | { 47 | return is_custom_; 48 | } 49 | 50 | void TileSource::SetCustom(bool is_custom) 51 | { 52 | is_custom_ = is_custom; 53 | } 54 | 55 | int32_t TileSource::GetMaxZoom() const 56 | { 57 | return max_zoom_; 58 | } 59 | 60 | void TileSource::SetMaxZoom(int32_t max_zoom) 61 | { 62 | max_zoom_ = max_zoom; 63 | } 64 | 65 | int32_t TileSource::GetMinZoom() const 66 | { 67 | return min_zoom_; 68 | } 69 | 70 | void TileSource::SetMinZoom(int32_t min_zoom) 71 | { 72 | min_zoom_ = min_zoom; 73 | } 74 | 75 | const QString& TileSource::GetName() const 76 | { 77 | return name_; 78 | } 79 | 80 | void TileSource::SetName(const QString& name) 81 | { 82 | name_ = name; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /tile_map/src/wmts_source.cpp: -------------------------------------------------------------------------------- 1 | // ***************************************************************************** 2 | // 3 | // Copyright (c) 2015-2025, Southwest Research Institute® (SwRI®) 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of Southwest Research Institute® (SwRI®) nor the 14 | // names of its contributors may be used to endorse or promote products 15 | // derived from this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | // DAMAGE. 28 | // 29 | // ***************************************************************************** 30 | 31 | #include 32 | 33 | namespace tile_map 34 | { 35 | const QString WmtsSource::WMTS_TYPE = "wmts"; 36 | 37 | WmtsSource::WmtsSource(const QString& name, 38 | const QString& base_url, 39 | bool is_custom, 40 | int32_t max_zoom) : 41 | TileSource() 42 | { 43 | name_ = name; 44 | base_url_ = base_url; 45 | is_custom_ = is_custom; 46 | max_zoom_ = max_zoom; 47 | min_zoom_ = 1; 48 | } 49 | 50 | QString WmtsSource::GetType() const 51 | { 52 | return WMTS_TYPE; 53 | } 54 | 55 | size_t WmtsSource::GenerateTileHash(int32_t level, int64_t x, int64_t y) 56 | { 57 | return hash_(GenerateTileUrl(level, x, y).toStdString()); 58 | } 59 | 60 | QString WmtsSource::GenerateTileUrl(int32_t level, int64_t x, int64_t y) 61 | { 62 | QString url(base_url_); 63 | url.replace(QString::fromStdString("{level}"), QString::number(level)); 64 | url.replace(QString::fromStdString("{x}"), QString::number(x)); 65 | url.replace(QString::fromStdString("{y}"), QString::number(y)); 66 | 67 | return url; 68 | } 69 | } 70 | --------------------------------------------------------------------------------