Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add autoware_remaining_distance_time_calculator and overlay #6855

Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
606a961
feat(remaining_dist_eta): add initial implementation for testing rema…
ahmeddesokyebrahim Apr 18, 2024
235039d
feat(remaining_dist_eta): add initial implementation for ETA
ahmeddesokyebrahim Apr 19, 2024
e0a9843
feat(remaining_dist_eta): change eta values to uint8
ahmeddesokyebrahim Apr 19, 2024
96c8ea7
feat(remaining_dist_eta): add publisher and using the remaining dista…
Apr 19, 2024
36ef21a
feat(remaining_dist_eta): removing functions usage from mission plann…
Apr 19, 2024
2755265
style(pre-commit): autofix
pre-commit-ci[bot] Apr 19, 2024
7d3247c
feat(remaining_dist_eta): improving and cleaning remaining dist and e…
Apr 22, 2024
a012502
style(pre-commit): autofix
pre-commit-ci[bot] Apr 22, 2024
2d57d45
feat(remaining_dist_eta): change in remaining dist and time calculati…
Apr 23, 2024
8598fea
feat(remaining_dist_eta): add visualization overlay for mission detai…
Apr 23, 2024
2876776
feat(remaining_dist_eta): update visualization and behavior path plan…
Apr 23, 2024
8dd46aa
feat(remaining_dist_eta): cleaning up
Apr 23, 2024
52ca290
style(pre-commit): autofix
pre-commit-ci[bot] Apr 23, 2024
73a3428
feat(remaining_dist_eta): change dependency from autoware_planning_ms…
Apr 24, 2024
62df403
style(pre-commit): autofix
pre-commit-ci[bot] Apr 24, 2024
10e5f81
feat(remaining_dist_eta): reverting back to route_handler and lanelet…
Apr 25, 2024
a7408be
style(pre-commit): autofix
pre-commit-ci[bot] Apr 25, 2024
2c1bc34
feat(remaining_dist_eta): fix review comment to have the remaining di…
Apr 25, 2024
662f409
style(pre-commit): autofix
pre-commit-ci[bot] Apr 25, 2024
d39f1b4
feat(remaining_dist_eta): add remaining time back to the visualizatio…
Apr 29, 2024
1776e43
style(pre-commit): autofix
pre-commit-ci[bot] Apr 29, 2024
bcf9dbb
added goal distance/time icons
KhalilSelyan Apr 30, 2024
20e076b
Refactor remaining_distance_time_display.hpp to add goal distance/tim…
KhalilSelyan Apr 30, 2024
f17f11b
Refactor to use icons and use km/m depending on distance
KhalilSelyan Apr 30, 2024
82471ad
update widget size
KhalilSelyan Apr 30, 2024
1ddb209
feat(remaining_dist_eta): add slight changes to icons and values/text…
Apr 30, 2024
7f29beb
feat(remaining_dist_eta): update readme file
Apr 30, 2024
64d1114
style(pre-commit): autofix
pre-commit-ci[bot] Apr 30, 2024
4e60c16
feat(remaining_dist_eta): [wip] fix review comments - separate the im…
ahmeddesokyebrahim May 7, 2024
3401f91
feat(remaining_dist_eta): remove functionalities from behavior path p…
ahmeddesokyebrahim May 7, 2024
64ce68a
feat(remaining_dist_eta): remove some other change in behavior path p…
ahmeddesokyebrahim May 7, 2024
76389ec
feat(remaining_dist_eta): removing unused files in remaining dist and…
ahmeddesokyebrahim May 7, 2024
020c8dc
feat(remaining_dist_eta): header file cleaning up
ahmeddesokyebrahim May 7, 2024
84b3c0e
feat(remaining_dist_eta): node cpp file cleaning up
ahmeddesokyebrahim May 7, 2024
ae74169
feat(remaining_dist_eta): package.xml clean up
ahmeddesokyebrahim May 7, 2024
33ff5dc
feat(remaining_dist_eta): package.xml cleaning up
ahmeddesokyebrahim May 7, 2024
87e48d2
feat(remaining_dist_eta): package.xml cleaning up
ahmeddesokyebrahim May 7, 2024
5e332ba
feat(remaining_dist_eta): add comments
ahmeddesokyebrahim May 7, 2024
686f808
style(pre-commit): autofix
pre-commit-ci[bot] May 7, 2024
614c82c
feat(remaining_dist_eta): remove unneeded changes
ahmeddesokyebrahim May 7, 2024
4a25f9b
feat(remaining_dist_eta): update visualization to calculate remaining…
May 7, 2024
9662b2a
feat(remaining_dist_eta): fix review comments
May 7, 2024
a9e3433
style(pre-commit): autofix
pre-commit-ci[bot] May 7, 2024
5b91356
feat(remaining_dist_eta): add content to package readme file
May 7, 2024
ab6c316
style(pre-commit): autofix
pre-commit-ci[bot] May 7, 2024
bd722f5
feat(remaining_dist_eta): removing info log lines - minor update in r…
May 7, 2024
322f751
style(pre-commit): autofix
pre-commit-ci[bot] May 7, 2024
5d5955c
Merge branch 'main' into 4593-feat-remaining-distance-eta
xmfcx May 10, 2024
9fcda4d
update the readme
May 10, 2024
694886b
refactor all
May 10, 2024
d43a1c3
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
24db0c0
remove unused dep
May 10, 2024
4925f03
reformat cmakelists
May 10, 2024
be4ba57
update the namespace, remove unused code
May 10, 2024
137cae4
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
59cebe7
remove unused headers
May 10, 2024
7920153
update the images
May 10, 2024
30fc9f4
icon sources
May 10, 2024
8a4c8e9
simplify readme
May 10, 2024
8ebe0ae
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
dfd410b
remove unused fonts
May 10, 2024
6c35ab9
fix the messy display code
May 10, 2024
fa79682
fix anchoring, update readme
May 10, 2024
38ae94f
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
a4c28dd
remove unused panel and dependency
May 10, 2024
42611d6
clean up more
May 10, 2024
5e98a6f
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
7b1901e
use max vel instead
May 10, 2024
3b2957f
rm comment
May 10, 2024
2d80db8
style(pre-commit): autofix
pre-commit-ci[bot] May 10, 2024
b4770f8
proportionally extend the rect to the right
May 11, 2024
56b432f
fix typo
May 11, 2024
68a8be7
feat(remaining_dist_eta): add checks for calculating remaining distance
May 13, 2024
ee08bc2
feat(remaining_dist_eta): handle cases when routing graph is not able…
May 13, 2024
8e8954b
feat(remaining_dist_eta): update readme
May 13, 2024
650eb80
style(pre-commit): autofix
pre-commit-ci[bot] May 13, 2024
8a9b86b
feat(remaining_dist_eta): add check for velocity limit preventing uni…
May 13, 2024
cadd17c
feat(remaining_dist_eta): fix type
May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_mission_details_overlay_rviz_plugin)

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

set(
headers_to_moc
include/mission_details_display.hpp
)

set(
headers_to_not_moc
include/remaining_distance_time_display.hpp
)

foreach(header "${headers_to_moc}")
qt5_wrap_cpp(display_moc_files "${header}")
endforeach()

set(
display_source_files
src/overlay_utils.cpp
src/mission_details_display.cpp
src/remaining_distance_time_display.cpp
)

add_library(
${PROJECT_NAME} SHARED
${display_moc_files}
${headers_to_not_moc}
${display_source_files}
)

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)

target_include_directories(
${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${Qt5Widgets_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)

target_link_libraries(
${PROJECT_NAME} PUBLIC
rviz_ogre_vendor::OgreMain
rviz_ogre_vendor::OgreOverlay
)

target_compile_definitions(${PROJECT_NAME} PRIVATE "${PROJECT_NAME}_BUILDING_LIBRARY")

# prevent pluginlib from using boost
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)

ament_target_dependencies(
${PROJECT_NAME}
PUBLIC
rviz_common
rviz_rendering
autoware_internal_msgs
)

ament_export_include_directories(include)
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(
rviz_common
rviz_ogre_vendor
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(
DIRECTORY include/
DESTINATION include
)

install(
TARGETS
DESTINATION lib/${PROJECT_NAME}
)

# Copy the assets directory to the installation directory
install(
DIRECTORY assets/
DESTINATION share/${PROJECT_NAME}/assets
)

add_definitions(-DQT_NO_KEYWORDS)

ament_package(
CONFIG_EXTRAS "autoware_mission_details_overlay_rviz_plugin-extras.cmake"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2022, Team Spatzenhirn
Copyright (c) 2014, JSK Lab

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# autoware_mission_details_overlay_rviz_plugin

This RViz plugin displays the remaining distance and time for the current mission.

## Inputs / Outputs

### Input

| Name | Type | Description |
| ------------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------- |
| `/planning/mission_remaining_distance_time` | `autoware_planning_msgs::msg::MissionRemainingDistanceTime` | The topic is for mission remaining distance and time |

## Overlay Parameters

| Name | Type | Default Value | Description |
| -------- | ---- | ------------- | --------------------------------- |
| `Width` | int | 170 | Width of the overlay [px] |
| `Height` | int | 100 | Height of the overlay [px] |
| `Right` | int | 10 | Margin from the right border [px] |
| `Top` | int | 10 | Margin from the top border [px] |

The mission details display is aligned with top right corner of the screen.

## Usage

Similar to [autoware_overlay_rviz_plugin](../autoware_overlay_rviz_plugin/README.md)

## Credits

Based on the [jsk_visualization](https://github.com/jsk-ros-pkg/jsk_visualization) package.

### Icons

- <https://fonts.google.com/icons?selected=Material+Symbols+Outlined:conversion_path:FILL@1;wght@400;GRAD@200;opsz@20&icon.size=20&icon.color=%23e8eaed&icon.query=path>
- <https://fonts.google.com/icons?selected=Material+Symbols+Outlined:av_timer:FILL@1;wght@400;GRAD@200;opsz@20&icon.size=20&icon.color=%23e8eaed&icon.query=av+timer>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2011 The Quicksand Project Authors (https://github.com/andrew-paglinawan/QuicksandFamily), with Reserved Font Name “Quicksand”.

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2021, Open Source Robotics Foundation, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# find package Qt5 because otherwise using the rviz_default_plugins::rviz_default_plugins
# exported target will complain that the Qt5::Widgets target does not exist
find_package(Qt5 REQUIRED QUIET COMPONENTS Widgets)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2024 The Autoware Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MISSION_DETAILS_DISPLAY_HPP_
#define MISSION_DETAILS_DISPLAY_HPP_
#ifndef Q_MOC_RUN
#include "overlay_utils.hpp"
#include "remaining_distance_time_display.hpp"

#include <QImage>
#include <QString>
#include <rviz_common/display.hpp>
#include <rviz_common/properties/color_property.hpp>
#include <rviz_common/properties/float_property.hpp>
#include <rviz_common/properties/int_property.hpp>
#include <rviz_common/properties/ros_topic_property.hpp>

#include <OgreColourValue.h>
#include <OgreMaterial.h>
#include <OgreTexture.h>

#include <memory>
#include <mutex>
#endif

namespace autoware::mission_details_overlay_rviz_plugin
{
class MissionDetailsDisplay : public rviz_common::Display
{
Q_OBJECT
public:
MissionDetailsDisplay();
~MissionDetailsDisplay() override;

protected:
void onInitialize() override;
void update(float wall_dt, float ros_dt) override;
void reset() override;
void onEnable() override;
void onDisable() override;

private Q_SLOTS:
void update_size();
void topic_updated_remaining_distance_time();

private:
std::mutex mutex_;
autoware::mission_details_overlay_rviz_plugin::OverlayObject::SharedPtr overlay_;
rviz_common::properties::IntProperty * property_width_;
rviz_common::properties::IntProperty * property_height_;
rviz_common::properties::IntProperty * property_right_;
rviz_common::properties::IntProperty * property_top_;
std::unique_ptr<rviz_common::properties::RosTopicProperty>
remaining_distance_time_topic_property_;

void draw_rounded_rect(QPainter & painter, const QRectF & backgroundRect);
void setupRosSubscriptions();

std::unique_ptr<RemainingDistanceTimeDisplay> remaining_distance_time_display_;

rclcpp::Subscription<autoware_internal_msgs::msg::MissionRemainingDistanceTime>::SharedPtr
remaining_distance_time_sub_;

std::mutex property_mutex_;

void cb_remaining_distance_time(
const autoware_internal_msgs::msg::MissionRemainingDistanceTime::ConstSharedPtr & msg);
void draw_widget(QImage & hud);
};
} // namespace autoware::mission_details_overlay_rviz_plugin

#endif // MISSION_DETAILS_DISPLAY_HPP_
Loading
Loading