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

[pull] main from autowarefoundation:main #30

Closed
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
283ff47
refactor(pointcloud_preprocessor): publish noise points in ring outli…
kyoichi-sugahara Mar 13, 2024
0eac12e
fix: add cspell ignore for CTRV (#6606)
h-ohta Mar 13, 2024
47d1212
feat(probabilistic_occupancy_grid_map): add synchronized ogm fusion n…
YoshiRi Mar 13, 2024
10ed352
fix(shape_estimation): preserve irregular large size vehicle detected…
badai-nguyen Mar 13, 2024
3ba1ecd
feat(intersection_occlusion): quickly delete occlusion wall on change…
soblin Mar 13, 2024
b6cd8f4
feat(pid_longitudinal_controller): add maker for stop reason (#6579)
takayuki5168 Mar 13, 2024
59c504b
feat(tier4_simulator_launch): add option to disable all perception re…
brkay54 Mar 13, 2024
3c01dc9
perf(occupancy_grid_map_outlier_filter): improve performance (#5980)
TakanoTaiga Mar 14, 2024
f9fbd39
docs(diagnostic_graph_aggregator): update documents (#6613)
isamu-takagi Mar 14, 2024
ca46a8f
fix(multi_object_tracker): mot multi-step prediction is not work as i…
technolojin Mar 14, 2024
6ee9627
feat(pointcloud_preprocessor): add pipeline_latency_ms debug publishe…
brkay54 Mar 14, 2024
5a6c82e
feat(diagnostic_graph_aggregator): update tools (#6614)
isamu-takagi Mar 15, 2024
7ba8016
feat(multi_object_tracker): add object class filtering in tracking pr…
technolojin Mar 15, 2024
c653236
fix(avoidance): the module ignored merging objects unexpectedly (#6601)
satoshi-ota Mar 15, 2024
152b11e
fix(lane_change): consider max velocity during path planning (#6615)
zulfaqar-azmi-t4 Mar 15, 2024
7f36c52
feat: add published_time publisher debug to packages (#6490)
brkay54 Mar 15, 2024
aa0c633
fix(ndt_scan_matcher): avoid passing nullptr in ndt (#6620)
SakodaShintaro Mar 15, 2024
a993a06
ci: add pr-agent (#6632)
xmfcx Mar 15, 2024
353a2ec
ci(pr-agent): don't run automatically (#6634)
xmfcx Mar 15, 2024
52b2fd6
feat(behavior_path_planner_common): add general method for calculatin…
danielsanchezaran Mar 15, 2024
e1d19d6
feat(start_planner): move collision check to plan method (#6564)
danielsanchezaran Mar 15, 2024
c24c3b0
feat(published_time_publisher): add unit test (#6610)
brkay54 Mar 16, 2024
546df44
feat(start_planner): add general turn signal method to start planner …
danielsanchezaran Mar 18, 2024
7e09808
fix(route_handler): detect looped road shoulders in getShoulderLanele…
soblin Mar 18, 2024
523b084
feat(pointcloud_preprocessor): make concatenate node to publish point…
YoshiRi Mar 18, 2024
f82f420
fix(tier4_autoware_utils): fix build error (caused by `published_time…
satoshi-ota Mar 18, 2024
f03f7f2
feat(behavior_path_avoidance_module): use the general calc turn signa…
danielsanchezaran Mar 18, 2024
f5f0683
feat(start_planner): add a sanity check if the path is empty (#6643)
danielsanchezaran Mar 18, 2024
6241fe0
refactor(trajectory_follower_node): apply default param to the param …
kyoichi-sugahara Mar 18, 2024
8a9965a
feat(lane_change_module): add general method to get turn signal for L…
danielsanchezaran Mar 18, 2024
413514b
refactor(obstacle_cruise_planner): move slow down params to a clear l…
danielsanchezaran Mar 18, 2024
bd568e8
ci(build-and-test-differential): bring back clang-tidy-differential j…
xmfcx Mar 18, 2024
0625e4a
fix(ar_tag_based_localizer): added 1 second wait to test (#6624)
SakodaShintaro Mar 18, 2024
3b53061
fix(tier4_autoware_utils): clang-tidy errors for published_time_publi…
xmfcx Mar 18, 2024
1ca97cf
feat(avoidance): wait and see ambiguous stopped vehicle (#6631)
satoshi-ota Mar 18, 2024
1cbdfa3
feat(dynamic_obstacle_stop): add option to ignore unavoidable collisi…
maxime-clem Mar 19, 2024
46ac827
fix(behavior_velocity_run_out): construct predicted path up to max pr…
TomohitoAndo Mar 19, 2024
a8364b4
refactor(pointcloud_preprocessor): move roi_mode_map_ definition insi…
kyoichi-sugahara Mar 20, 2024
872cbdd
fix(avoidance): don't slow down if avoidance is NOT definitely necess…
satoshi-ota Mar 21, 2024
3a346c7
fix(out_of_lane): use bigger stop lines to cut predicted paths (#6630)
maxime-clem Mar 22, 2024
e903d11
feat: enable multithreading for the control container (#6666)
tkimura4 Mar 22, 2024
af04566
feat(dynamic_obstacle_stop): set velocity factor to ROUTE_OBSTACLE (#…
maxime-clem Mar 22, 2024
62c1b89
feat(out_of_lane): set velocity_factor to ROUTE_OBSTACLE (#6668)
maxime-clem Mar 22, 2024
338aca7
feat(crosswalk): add velocity factor when slowing down (#6670)
maxime-clem Mar 22, 2024
b44fb20
fix(motion_utils): check size after overlap points removal (#6653)
zulfaqar-azmi-t4 Mar 22, 2024
7908a4a
feat(tier4_system_launch): add option to launch mrm handler (#6660)
isamu-takagi Mar 22, 2024
262ec55
fix(probabilistic_occupancy_grid_map): fix launch config name from ol…
YoshiRi Mar 23, 2024
b9f7ae6
fix(planning_validator): calculate max lateral acceleration after res…
kaigohirao Mar 25, 2024
3683131
test(ndt_scan_matcher): added an unit test to ndt_scan_matcher (#6649)
SakodaShintaro Mar 25, 2024
b7f2079
feat(perception_online_evaluator): add yaw rate metrics for stopped o…
kosuke55 Mar 25, 2024
f36005b
chore(tier4_planning_launch): set log output both (#6685)
shmpwk Mar 25, 2024
1d721dc
fix(out_of_lane): calculate path lanelets that we can miss during a l…
maxime-clem Mar 26, 2024
297b486
feat(goal_planner): add general turnsignalinfo method for goal planne…
danielsanchezaran Mar 26, 2024
106ee3e
feat(goal_planner): add param reconfig to goal planner (#6646)
danielsanchezaran Mar 26, 2024
ce6de02
feat(AEB): add height filter for avoiding the ghost brake by false po…
Shin-kyoto Mar 26, 2024
93dfcbb
fix(vehicle_cmd_gate): fix publisher HZ in the unit test by introduci…
xmfcx Mar 26, 2024
d26565d
feat(default_ad_api): add door api (#5737)
isamu-takagi Mar 27, 2024
2d524dc
fix(lane_change): do not return empty path if no valid path (#6686)
zulfaqar-azmi-t4 Mar 27, 2024
aa057b8
fix(avoidance_by_lane_change): object filtering too conservative (#6662)
zulfaqar-azmi-t4 Mar 27, 2024
a0bac37
feat(behavior_velocity_run_out_module): exclude obstacle crossing ego…
danielsanchezaran Mar 27, 2024
e84aaee
feat(run_out): add motorcyles to run out module target obstacles (#6690)
danielsanchezaran Mar 27, 2024
dd7c252
refactor(start planner): refactor for clarity, readability and maybe …
danielsanchezaran Mar 27, 2024
fe5e63f
fix(goal_planner): stop path candidates update after arriving modifie…
kosuke55 Mar 28, 2024
1ed6462
perf(static_centerline_optimizer): cleanup the package dependencies (…
maxime-clem Mar 28, 2024
6d7cd0a
fix(freespace_planner): fix parking trajectory errors and warnings wh…
ahmeddesokyebrahim Mar 28, 2024
c2f57ae
chore(tier4_system_launch): add option to select graph path depending…
TomohitoAndo Mar 29, 2024
61beca1
fix(dynamic_obstacle_stop,out_of_lane,crosswalk): update velocity fac…
maxime-clem Mar 29, 2024
37cd3f8
chore(blockage_diag): add dust diagnostic option param (#6645)
badai-nguyen Mar 29, 2024
dd2ff22
feat(dynamic_obstacle_stop): use a time buffer for each dynamic objec…
maxime-clem Mar 29, 2024
6c75c7b
refactor(image_projection_based_fusion): rename template argument (#6…
kminoda Mar 29, 2024
52efb84
docs(dynamic_avoidance): update doc (#6648)
yuki-takagi-66 Mar 29, 2024
031c873
feat(crosswalk): ignore occlusions in the presence of traffic lights …
maxime-clem Mar 29, 2024
1527f8a
fix(dynamic_obstacle_stop): fix run time error (#6714)
takayuki5168 Mar 29, 2024
b5c29fc
docs(mpc_lateral_controller): modify mathjax visualization error (#6486)
sak-0822 Mar 31, 2024
badd949
refactor(dynamic_obstacle_stop): change log level for processing time…
kyoichi-sugahara Mar 31, 2024
7869149
feat(default_ad_api): add dynamic_obstacle_stop velocity factor topic…
maxime-clem Apr 1, 2024
d49680d
feat(default_ad_api): release adapi v1.2.0 (#6694)
isamu-takagi Apr 1, 2024
0836cfb
feat(run_out_module): exclude obstacles on path (#6703)
danielsanchezaran Apr 1, 2024
42d4936
feat(lane_change): additional debug markers (#6529)
zulfaqar-azmi-t4 Apr 1, 2024
46e3ad4
feat(ndt_scan_matcher): fix first update map (#6699)
YamatoAndo Apr 1, 2024
8c02272
feat(pose_initilizer): set intial pose directly (#6692)
YamatoAndo Apr 1, 2024
a808ff0
docs(lane_change): update documentation (#6544)
zulfaqar-azmi-t4 Apr 1, 2024
f8e6047
feat(perception_online_evaluator): unify debug markers instead of sep…
kosuke55 Apr 1, 2024
f77f0f7
feat(perception_online_evaluator): extract moving object for deviatio…
kosuke55 Apr 1, 2024
dadbb2c
feat(start_planner): add validation check to prevent over cropped pat…
danielsanchezaran Apr 1, 2024
2d105d5
feat(obstacle_avoidance_planner): sanitize reference points (#6704)
danielsanchezaran Apr 1, 2024
8f67bc9
fix(pose_initializer): added "user_defined_initial_pose" to dummy loc…
SakodaShintaro Apr 2, 2024
6e6e601
feat(static_centerline_optimizer): static centerline optimizer with G…
takayuki5168 Apr 2, 2024
8948859
feat(multi_object_tracker): debug timer to work with reduced replay r…
technolojin Apr 2, 2024
1aa5bb9
fix(object_recognition_utils): check polygon area on iou calculation …
technolojin Apr 2, 2024
5617f74
fix(predicted_path_checker): check if trajectory size (#6730)
beyzanurkaya Apr 2, 2024
f97cdc0
fix(static_centerline_optimizer): fix latlon values of generated LL2 …
takayuki5168 Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 37 additions & 0 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,40 @@ jobs:

- name: Show disk space after the tasks
run: df -h

clang-tidy-differential:
runs-on: ubuntu-latest
container: ghcr.io/autowarefoundation/autoware-openadk:latest-prebuilt-cuda
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Show disk space before the tasks
run: df -h

- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1

- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1

- name: Get modified files
id: get-modified-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.cpp
**/*.hpp

- name: Run clang-tidy
if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
target-files: ${{ steps.get-modified-files.outputs.all_changed_files }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
build-depends-repos: build_depends.repos
31 changes: 31 additions & 0 deletions .github/workflows/pr-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR-Agent

on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
issue_comment:

jobs:
prevent-no-label-execution-pr-agent:
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
with:
label: tag:pr-agent
pr_agent_job:
needs: prevent-no-label-execution-pr-agent
if: ${{ needs.prevent-no-label-execution-pr-agent.outputs.run == 'true' }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
name: Run pr agent on every pull request, respond to user comments
steps:
- name: PR Agent action step
id: pragent
uses: Codium-ai/pr-agent@main
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY_PR_AGENT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_action_config.auto_review: "false"
github_action_config.auto_describe: "false"
github_action_config.auto_improve: "false"
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

#include <rclcpp/qos.hpp>

#include <autoware_adapi_v1_msgs/msg/door_status_array.hpp>
#include <autoware_adapi_v1_msgs/msg/vehicle_kinematics.hpp>
#include <autoware_adapi_v1_msgs/msg/vehicle_status.hpp>
#include <autoware_adapi_v1_msgs/srv/get_door_layout.hpp>
#include <autoware_adapi_v1_msgs/srv/get_vehicle_dimensions.hpp>
#include <autoware_adapi_v1_msgs/srv/set_door_command.hpp>

namespace autoware_ad_api::vehicle
{
Expand Down Expand Up @@ -48,6 +51,27 @@ struct Dimensions
static constexpr char name[] = "/api/vehicle/dimensions";
};

struct DoorCommand
{
using Service = autoware_adapi_v1_msgs::srv::SetDoorCommand;
static constexpr char name[] = "/api/vehicle/doors/command";
};

struct DoorLayout
{
using Service = autoware_adapi_v1_msgs::srv::GetDoorLayout;
static constexpr char name[] = "/api/vehicle/doors/layout";
};

struct DoorStatus
{
using Message = autoware_adapi_v1_msgs::msg::DoorStatusArray;
static constexpr char name[] = "/api/vehicle/doors/status";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

} // namespace autoware_ad_api::vehicle

#endif // AUTOWARE_AD_API_SPECS__VEHICLE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

#include <rclcpp/qos.hpp>

#include <autoware_adapi_v1_msgs/msg/door_status_array.hpp>
#include <autoware_adapi_v1_msgs/srv/get_door_layout.hpp>
#include <autoware_adapi_v1_msgs/srv/set_door_command.hpp>
#include <autoware_auto_vehicle_msgs/msg/gear_report.hpp>
#include <autoware_auto_vehicle_msgs/msg/hazard_lights_report.hpp>
#include <autoware_auto_vehicle_msgs/msg/steering_report.hpp>
Expand Down Expand Up @@ -71,6 +74,27 @@ struct EnergyStatus
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

struct DoorCommand
{
using Service = autoware_adapi_v1_msgs::srv::SetDoorCommand;
static constexpr char name[] = "/vehicle/doors/command";
};

struct DoorLayout
{
using Service = autoware_adapi_v1_msgs::srv::GetDoorLayout;
static constexpr char name[] = "/vehicle/doors/layout";
};

struct DoorStatus
{
using Message = autoware_adapi_v1_msgs::msg::DoorStatusArray;
static constexpr char name[] = "/vehicle/doors/status";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

} // namespace vehicle_interface

#endif // COMPONENT_INTERFACE_SPECS__VEHICLE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,12 @@ double calcLateralOffset(
return std::nan("");
}

const auto p_front = tier4_autoware_utils::getPoint(overlap_removed_points.at(seg_idx));
const auto p_back = tier4_autoware_utils::getPoint(overlap_removed_points.at(seg_idx + 1));
const auto p_indices = overlap_removed_points.size() - 2;
const auto p_front_idx = (p_indices > seg_idx) ? seg_idx : p_indices;
const auto p_back_idx = p_front_idx + 1;

const auto p_front = tier4_autoware_utils::getPoint(overlap_removed_points.at(p_front_idx));
const auto p_back = tier4_autoware_utils::getPoint(overlap_removed_points.at(p_back_idx));

const Eigen::Vector3d segment_vec{p_back.x - p_front.x, p_back.y - p_front.y, 0.0};
const Eigen::Vector3d target_vec{p_target.x - p_front.x, p_target.y - p_front.y, 0.0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
namespace object_recognition_utils
{
using tier4_autoware_utils::Polygon2d;
// minimum area to avoid division by zero
static const double MIN_AREA = 1e-6;

inline double getConvexShapeArea(const Polygon2d & source_polygon, const Polygon2d & target_polygon)
{
Expand Down Expand Up @@ -66,10 +68,12 @@ template <class T1, class T2>
double get2dIoU(const T1 source_object, const T2 target_object, const double min_union_area = 0.01)
{
const auto source_polygon = tier4_autoware_utils::toPolygon2d(source_object);
if (boost::geometry::area(source_polygon) < MIN_AREA) return 0.0;
const auto target_polygon = tier4_autoware_utils::toPolygon2d(target_object);
if (boost::geometry::area(target_polygon) < MIN_AREA) return 0.0;

const double intersection_area = getIntersectionArea(source_polygon, target_polygon);
if (intersection_area == 0.0) return 0.0;
if (intersection_area < MIN_AREA) return 0.0;
const double union_area = getUnionArea(source_polygon, target_polygon);

const double iou =
Expand All @@ -81,7 +85,9 @@ template <class T1, class T2>
double get2dGeneralizedIoU(const T1 & source_object, const T2 & target_object)
{
const auto source_polygon = tier4_autoware_utils::toPolygon2d(source_object);
if (boost::geometry::area(source_polygon) < MIN_AREA) return 0.0;
const auto target_polygon = tier4_autoware_utils::toPolygon2d(target_object);
if (boost::geometry::area(target_polygon) < MIN_AREA) return 0.0;

const double intersection_area = getIntersectionArea(source_polygon, target_polygon);
const double union_area = getUnionArea(source_polygon, target_polygon);
Expand All @@ -95,11 +101,13 @@ template <class T1, class T2>
double get2dPrecision(const T1 source_object, const T2 target_object)
{
const auto source_polygon = tier4_autoware_utils::toPolygon2d(source_object);
const double source_area = boost::geometry::area(source_polygon);
if (source_area < MIN_AREA) return 0.0;
const auto target_polygon = tier4_autoware_utils::toPolygon2d(target_object);
if (boost::geometry::area(target_polygon) < MIN_AREA) return 0.0;

const double intersection_area = getIntersectionArea(source_polygon, target_polygon);
if (intersection_area == 0.0) return 0.0;
const double source_area = boost::geometry::area(source_polygon);
if (intersection_area < MIN_AREA) return 0.0;

return std::min(1.0, intersection_area / source_area);
}
Expand All @@ -108,11 +116,13 @@ template <class T1, class T2>
double get2dRecall(const T1 source_object, const T2 target_object)
{
const auto source_polygon = tier4_autoware_utils::toPolygon2d(source_object);
if (boost::geometry::area(source_polygon) < MIN_AREA) return 0.0;
const auto target_polygon = tier4_autoware_utils::toPolygon2d(target_object);
const double target_area = boost::geometry::area(target_polygon);
if (target_area < MIN_AREA) return 0.0;

const double intersection_area = getIntersectionArea(source_polygon, target_polygon);
if (intersection_area == 0.0) return 0.0;
const double target_area = boost::geometry::area(target_polygon);
if (intersection_area < MIN_AREA) return 0.0;

return std::min(1.0, intersection_area / target_area);
}
Expand Down
1 change: 1 addition & 0 deletions common/tier4_adapi_rviz_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
ament_auto_add_library(${PROJECT_NAME} SHARED
src/route_tool.cpp
src/route_panel.cpp
src/door_panel.cpp
)

target_link_libraries(${PROJECT_NAME}
Expand Down
4 changes: 4 additions & 0 deletions common/tier4_adapi_rviz_plugin/plugins/plugin_description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<description>RoutePanel</description>
</class>

<class type="tier4_adapi_rviz_plugins::DoorPanel" base_class_type="rviz_common::Panel">
<description>DoorPanel</description>
</class>

</library>
118 changes: 118 additions & 0 deletions common/tier4_adapi_rviz_plugin/src/door_panel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// Copyright 2023 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.

#include "door_panel.hpp"

#include <rviz_common/display_context.hpp>

#include <memory>

namespace tier4_adapi_rviz_plugins
{

DoorPanel::DoorPanel(QWidget * parent) : rviz_common::Panel(parent)
{
status_ = new QLabel("Trying to get door layout.");
layout_ = new QGridLayout();
layout_->addWidget(status_, 0, 0, 1, 4);
setLayout(layout_);
}

void DoorPanel::onInitialize()
{
const auto on_layout = [this](const rclcpp::Client<DoorLayout::Service>::SharedFuture future) {
const auto res = future.get();
if (!res->status.success) {
status_->setText(QString::fromStdString("failed to get layout: " + res->status.message));
return;
}
const auto & layouts = res->doors;
for (size_t index = 0; index < layouts.size(); ++index) {
const auto & layout = layouts[index];
DoorUI door;
door.description = new QLabel(QString::fromStdString(layout.description));
door.status = new QLabel("unknown");
door.open = new QPushButton("open");
door.close = new QPushButton("close");
doors_.push_back(door);

layout_->addWidget(door.description, index + 1, 0);
layout_->addWidget(door.status, index + 1, 1);
layout_->addWidget(door.open, index + 1, 2);
layout_->addWidget(door.close, index + 1, 3);

using Command = autoware_adapi_v1_msgs::msg::DoorCommand;
const auto on_open = [this, index] { on_button(index, Command::OPEN); };
const auto on_close = [this, index] { on_button(index, Command::CLOSE); };
connect(door.open, &QPushButton::clicked, on_open);
connect(door.close, &QPushButton::clicked, on_close);
}
status_->hide();
};

const auto on_status = [this](const DoorStatus::Message::ConstSharedPtr msg) {
using Status = autoware_adapi_v1_msgs::msg::DoorStatus;
if (doors_.size() != msg->doors.size()) {
return;
}
for (size_t index = 0; index < doors_.size(); ++index) {
const auto & label = doors_[index].status;
switch (msg->doors[index].status) {
case Status::NOT_AVAILABLE:
label->setText("not available");
break;
case Status::OPENED:
label->setText("opened");
break;
case Status::CLOSED:
label->setText("closed");
break;
case Status::OPENING:
label->setText("opening");
break;
case Status::CLOSING:
label->setText("closing");
break;
default:
label->setText("unknown");
break;
}
}
};

auto lock = getDisplayContext()->getRosNodeAbstraction().lock();
auto node = lock->get_raw_node();

const auto adaptor = component_interface_utils::NodeAdaptor(node.get());
adaptor.init_cli(cli_command_);
adaptor.init_cli(cli_layout_);
adaptor.init_sub(sub_status_, on_status);

const auto req = std::make_shared<DoorLayout::Service::Request>();
cli_layout_->async_send_request(req, on_layout);
}

void DoorPanel::on_button(uint32_t index, uint8_t command)
{
const auto req = std::make_shared<DoorCommand::Service::Request>();
req->doors.resize(1);
req->doors.back().index = index;
req->doors.back().command = command;
cli_command_->async_send_request(req);
}

} // namespace tier4_adapi_rviz_plugins

#include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(tier4_adapi_rviz_plugins::DoorPanel, rviz_common::Panel)
Loading
Loading