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 topic relay controller #9979

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01a61e5
feat(velocity_smoother): introduce diagnostics (#9933)
takayuki5168 Jan 16, 2025
6b4eb62
test(start_planner): disable GenerateValidFreespacePullOutPath test (…
kyoichi-sugahara Jan 16, 2025
3b3263c
feat(planning_factor)!: remove velocity_factor, steering_factor and i…
soblin Jan 16, 2025
dea525e
feat(motion_utils): add detail and pass type to VirtualWall (#9940)
soblin Jan 16, 2025
8a90cbf
fix(start_planner, goal_planner): refactor lane departure checker ini…
kyoichi-sugahara Jan 16, 2025
581f311
refactor(lane_change): add missing safety check parameter (#9928)
zulfaqar-azmi-t4 Jan 16, 2025
adf6047
feat(behavior_velocity_planner)!: remove velocity_factor completely (…
soblin Jan 16, 2025
6383df2
feat: add node base
TetsuKawa Jan 9, 2025
fd50406
modify: include guard
TetsuKawa Jan 10, 2025
4497e70
feat: delete schema
TetsuKawa Jan 10, 2025
4c4255e
feat: delete config
TetsuKawa Jan 10, 2025
8b1445a
feat: add subscriber
TetsuKawa Jan 9, 2025
8cb9dd3
modify: add include
TetsuKawa Jan 10, 2025
af7abe8
feat: add publisher
TetsuKawa Jan 9, 2025
3cc7e17
feat: add service
TetsuKawa Jan 9, 2025
6a1a945
modify: typo
TetsuKawa Jan 10, 2025
310cdd3
style(pre-commit): autofix
pre-commit-ci[bot] Jan 10, 2025
1429668
modify: add include memory
TetsuKawa Jan 14, 2025
663ec50
modify: add qos setting
TetsuKawa Jan 14, 2025
3c5d5ae
style(pre-commit): autofix
pre-commit-ci[bot] Jan 14, 2025
677a596
feat: add enable_keep_publishing
TetsuKawa Jan 14, 2025
1cfa03e
style(pre-commit): autofix
pre-commit-ci[bot] Jan 14, 2025
12e9dac
feat: add maintainer
TetsuKawa Jan 19, 2025
290e3df
feat: add read me
TetsuKawa Jan 19, 2025
8695334
style(pre-commit): autofix
pre-commit-ci[bot] Jan 20, 2025
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
Expand Up @@ -40,6 +40,11 @@ visualization_msgs::msg::MarkerArray createDeadLineVirtualWallMarker(
const double longitudinal_offset = 0.0, const std::string & ns_prefix = "",
const bool is_driving_forward = true);

visualization_msgs::msg::MarkerArray createIntendedPassVirtualMarker(
const geometry_msgs::msg::Pose & pose, const std::string & module_name, const rclcpp::Time & now,
const int32_t id, const double longitudinal_offset, const std::string & ns_prefix,
const bool is_driving_forward);

visualization_msgs::msg::MarkerArray createDeletedStopVirtualWallMarker(
const rclcpp::Time & now, const int32_t id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ namespace autoware::motion_utils
{

/// @brief type of virtual wall associated with different marker styles and namespace
enum VirtualWallType { stop, slowdown, deadline };
enum VirtualWallType { stop, slowdown, deadline, pass };
/// @brief virtual wall to be visualized in rviz
struct VirtualWall
{
geometry_msgs::msg::Pose pose{};
std::string text{};
std::string detail{};
std::string ns{};
VirtualWallType style = stop;
double longitudinal_offset{};
Expand Down
49 changes: 48 additions & 1 deletion common/autoware_motion_utils/src/marker/marker_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Tier IV, Inc.

Check notice on line 1 in common/autoware_motion_utils/src/marker/marker_helper.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Missing Arguments Abstractions

The average number of function arguments increases from 4.86 to 5.22, threshold = 4.00. The functions in this file have too many arguments, indicating a lack of encapsulation or too many responsibilities in the same functions. Avoid adding more.

Check notice on line 1 in common/autoware_motion_utils/src/marker/marker_helper.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Primitive Obsession

The ratio of primitive types in function arguments increases from 44.12% to 44.68%, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,7 +54,7 @@
{
auto marker = createDefaultMarker(
"map", now, ns_prefix + "factor_text", id, visualization_msgs::msg::Marker::TEXT_VIEW_FACING,
createMarkerScale(0.0, 0.0, 1.0), createMarkerColor(1.0, 1.0, 1.0, 1.0));
createMarkerScale(0.0, 0.0, 1.0 /*font size*/), createMarkerColor(1.0, 1.0, 1.0, 1.0));

Check warning on line 57 in common/autoware_motion_utils/src/marker/marker_helper.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Code Duplication

introduced similar code in: createIntendedPassArrowMarkerArray,createIntendedPassVirtualMarker,createVirtualWallMarkerArray. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

marker.pose = vehicle_front_pose;
marker.pose.position.z += 2.0;
Expand Down Expand Up @@ -85,6 +85,41 @@

return marker_array;
}

inline visualization_msgs::msg::MarkerArray createIntendedPassArrowMarkerArray(
const geometry_msgs::msg::Pose & vehicle_front_pose, const std::string & module_name,
const std::string & ns_prefix, const rclcpp::Time & now, const int32_t id,
const std_msgs::msg::ColorRGBA & color)
{
visualization_msgs::msg::MarkerArray marker_array;

// Arrow
{
auto marker = createDefaultMarker(
"map", now, ns_prefix + "direction", id, visualization_msgs::msg::Marker::ARROW,
createMarkerScale(2.5 /*length*/, 0.15 /*width*/, 1.0 /*height*/), color);

marker.pose = vehicle_front_pose;

marker_array.markers.push_back(marker);
}

// Factor Text
{
auto marker = createDefaultMarker(
"map", now, ns_prefix + "factor_text", id, visualization_msgs::msg::Marker::TEXT_VIEW_FACING,
createMarkerScale(0.0, 0.0, 0.4 /*font size*/), createMarkerColor(1.0, 1.0, 1.0, 1.0));

marker.pose = vehicle_front_pose;
marker.pose.position.z += 2.0;
marker.text = module_name;

marker_array.markers.push_back(marker);
}

return marker_array;
}

Check notice on line 121 in common/autoware_motion_utils/src/marker/marker_helper.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Excess Number of Function Arguments

createIntendedPassArrowMarkerArray has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

} // namespace

namespace autoware::motion_utils
Expand Down Expand Up @@ -125,6 +160,18 @@
createMarkerColor(0.0, 1.0, 0.0, 0.5));
}

visualization_msgs::msg::MarkerArray createIntendedPassVirtualMarker(
const geometry_msgs::msg::Pose & pose, const std::string & module_name, const rclcpp::Time & now,
const int32_t id, const double longitudinal_offset, const std::string & ns_prefix,
const bool is_driving_forward)
{
const auto pose_with_offset = autoware::universe_utils::calcOffsetPose(
pose, longitudinal_offset * (is_driving_forward ? 1.0 : -1.0), 0.0, 0.0);
return createIntendedPassArrowMarkerArray(
pose_with_offset, module_name, ns_prefix + "intended_pass_", now, id,
createMarkerColor(0.77, 0.77, 0.77, 0.5));
}

Check notice on line 173 in common/autoware_motion_utils/src/marker/marker_helper.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Excess Number of Function Arguments

createIntendedPassVirtualMarker has 7 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

visualization_msgs::msg::MarkerArray createDeletedStopVirtualWallMarker(
const rclcpp::Time & now, const int32_t id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@
case deadline:
create_fn = autoware::motion_utils::createDeadLineVirtualWallMarker;
break;
case pass:
create_fn = autoware::motion_utils::createIntendedPassVirtualMarker;
break;
}
const auto wall_text = virtual_wall.detail.empty()
? virtual_wall.text
: virtual_wall.text + "(" + virtual_wall.detail + ")";
auto markers = create_fn(
virtual_wall.pose, virtual_wall.text, now, 0, virtual_wall.longitudinal_offset,
virtual_wall.ns, virtual_wall.is_driving_forward);
virtual_wall.pose, wall_text, now, 0, virtual_wall.longitudinal_offset, virtual_wall.ns,
virtual_wall.is_driving_forward);

Check notice on line 75 in common/autoware_motion_utils/src/marker/virtual_wall_marker_creator.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Complex Method

VirtualWallMarkerCreator::create_markers increases in cyclomatic complexity from 9 to 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
for (auto & marker : markers.markers) {
marker.id = static_cast<int>(marker_count_per_namespace_[marker.ns].current++);
marker_array.markers.push_back(marker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef AUTOWARE__OBSTACLE_CRUISE_PLANNER__PLANNER_INTERFACE_HPP_
#define AUTOWARE__OBSTACLE_CRUISE_PLANNER__PLANNER_INTERFACE_HPP_

#include "autoware/motion_utils/factor/planning_factor_interface.hpp"
#include "autoware/motion_utils/trajectory/trajectory.hpp"
#include "autoware/obstacle_cruise_planner/common_structs.hpp"
#include "autoware/obstacle_cruise_planner/stop_planning_debug_info.hpp"
Expand Down Expand Up @@ -47,15 +48,15 @@ class PlannerInterface
rclcpp::Node & node, const LongitudinalInfo & longitudinal_info,
const autoware::vehicle_info_utils::VehicleInfo & vehicle_info,
const EgoNearestParam & ego_nearest_param, const std::shared_ptr<DebugData> debug_data_ptr)
: longitudinal_info_(longitudinal_info),
: planning_factor_interface_{std::make_unique<autoware::motion_utils::PlanningFactorInterface>(
&node, "obstacle_cruise_planner")},
longitudinal_info_(longitudinal_info),
vehicle_info_(vehicle_info),
ego_nearest_param_(ego_nearest_param),
debug_data_ptr_(debug_data_ptr),
slow_down_param_(SlowDownParam(node)),
stop_param_(StopParam(node, longitudinal_info))
{
velocity_factors_pub_ =
node.create_publisher<VelocityFactorArray>("/planning/velocity_factors/obstacle_cruise", 1);
stop_speed_exceeded_pub_ =
node.create_publisher<StopSpeedExceeded>("~/output/stop_speed_exceeded", 1);
metrics_pub_ = node.create_publisher<MetricArray>("~/metrics", 10);
Expand Down Expand Up @@ -101,6 +102,7 @@ class PlannerInterface
const std::optional<geometry_msgs::msg::Pose> & stop_pose = std::nullopt,
const std::optional<StopObstacle> & stop_obstacle = std::nullopt);
void publishMetrics(const rclcpp::Time & current_time);
void publishPlanningFactors() { planning_factor_interface_->publish(); }
void clearMetrics();

void onParam(const std::vector<rclcpp::Parameter> & parameters)
Expand Down Expand Up @@ -128,6 +130,8 @@ class PlannerInterface
double getSafeDistanceMargin() const { return longitudinal_info_.safe_distance_margin; }

protected:
std::unique_ptr<autoware::motion_utils::PlanningFactorInterface> planning_factor_interface_;

// Parameters
bool enable_debug_info_{false};
bool enable_calculation_time_info_{false};
Expand All @@ -145,7 +149,6 @@ class PlannerInterface
stop_watch_;

// Publishers
rclcpp::Publisher<VelocityFactorArray>::SharedPtr velocity_factors_pub_;
rclcpp::Publisher<StopSpeedExceeded>::SharedPtr stop_speed_exceeded_pub_;
rclcpp::Publisher<MetricArray>::SharedPtr metrics_pub_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include "autoware_vehicle_info_utils/vehicle_info_utils.hpp"

#include "autoware_adapi_v1_msgs/msg/planning_behavior.hpp"
#include "autoware_adapi_v1_msgs/msg/velocity_factor_array.hpp"
#include "autoware_perception_msgs/msg/predicted_object.hpp"
#include "autoware_perception_msgs/msg/predicted_objects.hpp"
#include "autoware_planning_msgs/msg/trajectory.hpp"
Expand All @@ -39,9 +37,6 @@
#include <pcl/point_types.h>

using autoware::vehicle_info_utils::VehicleInfo;
using autoware_adapi_v1_msgs::msg::PlanningBehavior;
using autoware_adapi_v1_msgs::msg::VelocityFactor;
using autoware_adapi_v1_msgs::msg::VelocityFactorArray;
using autoware_perception_msgs::msg::ObjectClassification;
using autoware_perception_msgs::msg::PredictedObject;
using autoware_perception_msgs::msg::PredictedObjects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ size_t getIndexWithLongitudinalOffset(
return 0;
}

VelocityFactorArray makeVelocityFactorArray(
const rclcpp::Time & time, const std::string & behavior = PlanningBehavior::ROUTE_OBSTACLE,
const std::optional<geometry_msgs::msg::Pose> pose = std::nullopt);
} // namespace obstacle_cruise_utils

#endif // AUTOWARE__OBSTACLE_CRUISE_PLANNER__UTILS_HPP_
1 change: 0 additions & 1 deletion planning/autoware_obstacle_cruise_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_adapi_v1_msgs</depend>
<depend>autoware_interpolation</depend>
<depend>autoware_lanelet2_extension</depend>
<depend>autoware_motion_utils</depend>
Expand Down
1 change: 1 addition & 0 deletions planning/autoware_obstacle_cruise_planner/src/node.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 TIER IV, Inc.

Check notice on line 1 in planning/autoware_obstacle_cruise_planner/src/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 1735 to 1736, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -726,6 +726,7 @@
// 8. Publish debug data
published_time_publisher_->publish_if_subscribed(trajectory_pub_, output_traj.header.stamp);
planner_ptr_->publishMetrics(now());
planner_ptr_->publishPlanningFactors();
publishDebugMarker();
publishDebugInfo();
objects_of_interest_marker_interface_.publishMarkerArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 TIER IV, Inc.

Check notice on line 1 in planning/autoware_obstacle_cruise_planner/src/pid_based_planner/pid_based_planner.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Function Size

The median function size increase from 55.0 to 55.5 LOC, threshold = 50.0. This file contains overly long functions, measured by their lines of code.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -335,9 +335,10 @@
debug_data_ptr_->obstacles_to_cruise.push_back(cruise_obstacle_info->obstacle);
debug_data_ptr_->cruise_metrics = makeMetrics("PIDBasedPlanner", "cruise", planner_data);

velocity_factors_pub_->publish(obstacle_cruise_utils::makeVelocityFactorArray(
planner_data.current_time, PlanningBehavior::ADAPTIVE_CRUISE,
stop_traj_points.at(wall_idx).pose));
planning_factor_interface_->add(
stop_traj_points, planner_data.ego_pose, stop_traj_points.at(wall_idx).pose,
tier4_planning_msgs::msg::PlanningFactor::NONE,
tier4_planning_msgs::msg::SafetyFactorArray{});
}

// do cruise planning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@
: std::abs(vehicle_info_.min_longitudinal_offset_m);

if (stop_obstacles.empty()) {
velocity_factors_pub_->publish(
obstacle_cruise_utils::makeVelocityFactorArray(planner_data.current_time));
// delete marker
const auto markers =
autoware::motion_utils::createDeletedStopVirtualWallMarker(planner_data.current_time, 0);
Expand Down Expand Up @@ -336,8 +334,10 @@

// Publish Stop Reason
const auto stop_pose = output_traj_points.at(*zero_vel_idx).pose;
velocity_factors_pub_->publish(obstacle_cruise_utils::makeVelocityFactorArray(
planner_data.current_time, PlanningBehavior::ROUTE_OBSTACLE, stop_pose));
planning_factor_interface_->add(
output_traj_points, planner_data.ego_pose, stop_pose,
tier4_planning_msgs::msg::PlanningFactor::STOP,
tier4_planning_msgs::msg::SafetyFactorArray{});
// Store stop reason debug data
debug_data_ptr_->stop_metrics =
makeMetrics("PlannerInterface", "stop", planner_data, stop_pose, *determined_stop_obstacle);
Expand Down Expand Up @@ -589,11 +589,15 @@

const auto markers = autoware::motion_utils::createSlowDownVirtualWallMarker(
slow_down_traj_points.at(slow_down_wall_idx).pose, "obstacle slow down",
planner_data.current_time, i, abs_ego_offset, "", planner_data.is_driving_forward);
velocity_factors_pub_->publish(obstacle_cruise_utils::makeVelocityFactorArray(
planner_data.current_time, PlanningBehavior::ROUTE_OBSTACLE,
slow_down_traj_points.at(slow_down_wall_idx).pose));
autoware::universe_utils::appendMarkerArray(markers, &debug_data_ptr_->slow_down_wall_marker);
planning_factor_interface_->add(
slow_down_traj_points, planner_data.ego_pose,
slow_down_traj_points.at(*slow_down_start_idx).pose,
slow_down_traj_points.at(*slow_down_end_idx).pose,
tier4_planning_msgs::msg::PlanningFactor::SLOW_DOWN,
tier4_planning_msgs::msg::SafetyFactorArray{}, planner_data.is_driving_forward,
stable_slow_down_vel);

Check warning on line 600 in planning/autoware_obstacle_cruise_planner/src/planner_interface.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

PlannerInterface::generateSlowDownTrajectory already has high cyclomatic complexity, and now it increases in Lines of Code from 125 to 129. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
}

// add debug virtual wall
Expand Down
21 changes: 0 additions & 21 deletions planning/autoware_obstacle_cruise_planner/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,4 @@ std::vector<StopObstacle> getClosestStopObstacles(const std::vector<StopObstacle
return candidates;
}

VelocityFactorArray makeVelocityFactorArray(
const rclcpp::Time & time, const std::string & behavior,
const std::optional<geometry_msgs::msg::Pose> pose)
{
VelocityFactorArray velocity_factor_array;
velocity_factor_array.header.frame_id = "map";
velocity_factor_array.header.stamp = time;

if (pose) {
using distance_type = VelocityFactor::_distance_type;
VelocityFactor velocity_factor;
velocity_factor.behavior = behavior;
velocity_factor.pose = pose.value();
velocity_factor.distance = std::numeric_limits<distance_type>::quiet_NaN();
velocity_factor.status = VelocityFactor::UNKNOWN;
velocity_factor.detail = std::string();
velocity_factor_array.factors.push_back(velocity_factor);
}
return velocity_factor_array;
}

} // namespace obstacle_cruise_utils
1 change: 0 additions & 1 deletion planning/autoware_surround_obstacle_checker/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<buildtool_depend>autoware_cmake</buildtool_depend>
<buildtool_depend>eigen3_cmake_module</buildtool_depend>

<depend>autoware_adapi_v1_msgs</depend>
<depend>autoware_motion_utils</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_planning_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ SurroundObstacleCheckerDebugNode::SurroundObstacleCheckerDebugNode(
const double & surround_check_back_distance, const double & surround_check_hysteresis_distance,
const geometry_msgs::msg::Pose & self_pose, const rclcpp::Clock::SharedPtr clock,
rclcpp::Node & node)
: vehicle_info_(vehicle_info),
: planning_factor_interface_{std::make_unique<autoware::motion_utils::PlanningFactorInterface>(
&node, "surround_obstacle_checker")},
vehicle_info_(vehicle_info),
object_label_(object_label),
surround_check_front_distance_(surround_check_front_distance),
surround_check_side_distance_(surround_check_side_distance),
Expand All @@ -77,8 +79,6 @@ SurroundObstacleCheckerDebugNode::SurroundObstacleCheckerDebugNode(
clock_(clock)
{
debug_viz_pub_ = node.create_publisher<visualization_msgs::msg::MarkerArray>("~/debug/marker", 1);
velocity_factor_pub_ =
node.create_publisher<VelocityFactorArray>("/planning/velocity_factors/surround_obstacle", 1);
vehicle_footprint_pub_ = node.create_publisher<PolygonStamped>("~/debug/footprint", 1);
vehicle_footprint_offset_pub_ =
node.create_publisher<PolygonStamped>("~/debug/footprint_offset", 1);
Expand Down Expand Up @@ -143,8 +143,12 @@ void SurroundObstacleCheckerDebugNode::publish()
debug_viz_pub_->publish(visualization_msg);

/* publish stop reason for autoware api */
const auto velocity_factor_msg = makeVelocityFactorArray();
velocity_factor_pub_->publish(velocity_factor_msg);
if (stop_pose_ptr_ != nullptr) {
planning_factor_interface_->add(
0.0, *stop_pose_ptr_, tier4_planning_msgs::msg::PlanningFactor::STOP,
tier4_planning_msgs::msg::SafetyFactorArray{});
}
planning_factor_interface_->publish();

/* reset variables */
stop_pose_ptr_ = nullptr;
Expand All @@ -170,25 +174,6 @@ MarkerArray SurroundObstacleCheckerDebugNode::makeVisualizationMarker()
return msg;
}

VelocityFactorArray SurroundObstacleCheckerDebugNode::makeVelocityFactorArray()
{
VelocityFactorArray velocity_factor_array;
velocity_factor_array.header.frame_id = "map";
velocity_factor_array.header.stamp = clock_->now();

if (stop_pose_ptr_) {
using distance_type = VelocityFactor::_distance_type;
VelocityFactor velocity_factor;
velocity_factor.behavior = PlanningBehavior::SURROUNDING_OBSTACLE;
velocity_factor.pose = *stop_pose_ptr_;
velocity_factor.distance = std::numeric_limits<distance_type>::quiet_NaN();
velocity_factor.status = VelocityFactor::UNKNOWN;
velocity_factor.detail = std::string();
velocity_factor_array.factors.push_back(velocity_factor);
}
return velocity_factor_array;
}

PolygonStamped SurroundObstacleCheckerDebugNode::boostPolygonToPolygonStamped(
const Polygon2d & boost_polygon, const double & z)
{
Expand Down
Loading
Loading