@@ -50,10 +50,15 @@ void OutOfLaneModule::init(rclcpp::Node & node, const std::string & module_name)
50
50
logger_ = node.get_logger ();
51
51
clock_ = node.get_clock ();
52
52
init_parameters (node);
53
- debug_publisher =
53
+ velocity_factor_interface_.init (motion_utils::PlanningBehavior::ROUTE_OBSTACLE);
54
+
55
+ debug_publisher_ =
54
56
node.create_publisher <visualization_msgs::msg::MarkerArray>(" ~/" + ns_ + " /debug_markers" , 1 );
55
- virtual_wall_publisher =
57
+ virtual_wall_publisher_ =
56
58
node.create_publisher <visualization_msgs::msg::MarkerArray>(" ~/" + ns_ + " /virtual_walls" , 1 );
59
+ velocity_factor_publisher_ =
60
+ node.create_publisher <autoware_adapi_v1_msgs::msg::VelocityFactorArray>(
61
+ std::string (" /planning/velocity_factors/" ) + ns_, 1 );
57
62
}
58
63
void OutOfLaneModule::init_parameters (rclcpp::Node & node)
59
64
{
@@ -258,6 +263,15 @@ VelocityPlanningResult OutOfLaneModule::plan(
258
263
result.slowdown_intervals .emplace_back (
259
264
point_to_insert->point .pose .position , point_to_insert->point .pose .position ,
260
265
point_to_insert->slowdown .velocity );
266
+
267
+ const auto is_approaching = motion_utils::calcSignedArcLength (
268
+ ego_trajectory_points, ego_data.pose .position ,
269
+ point_to_insert->point .pose .position ) > 0.1 &&
270
+ ego_data.velocity > 0.1 ;
271
+ const auto status = is_approaching ? motion_utils::VelocityFactor::APPROACHING
272
+ : motion_utils::VelocityFactor::STOPPED;
273
+ velocity_factor_interface_.set (
274
+ ego_trajectory_points, ego_data.pose , point_to_insert->point .pose , status, " out_of_lane" );
261
275
} else if (!decisions.empty ()) {
262
276
RCLCPP_WARN (logger_, " Could not insert stop point (would violate max deceleration limits)" );
263
277
}
@@ -278,10 +292,11 @@ VelocityPlanningResult OutOfLaneModule::plan(
278
292
total_time_us, calculate_lanelets_us, calculate_trajectory_footprints_us,
279
293
calculate_overlapping_ranges_us, filter_predicted_objects_ms, calculate_decisions_us,
280
294
calc_slowdown_points_us, insert_slowdown_points_us);
281
- debug_publisher ->publish (out_of_lane::debug::create_debug_marker_array (debug_data_));
295
+ debug_publisher_ ->publish (out_of_lane::debug::create_debug_marker_array (debug_data_));
282
296
virtual_wall_marker_creator.add_virtual_walls (
283
297
out_of_lane::debug::create_virtual_walls (debug_data_, params_));
284
- virtual_wall_publisher->publish (virtual_wall_marker_creator.create_markers (clock_->now ()));
298
+ virtual_wall_publisher_->publish (virtual_wall_marker_creator.create_markers (clock_->now ()));
299
+ velocity_factor_publisher_->publish (velocity_factor_interface_.get_array (clock_->now ()));
285
300
return result;
286
301
}
287
302
0 commit comments