Skip to content

Commit ff9dfd8

Browse files
6: Check TODOs/FIXMEs
1 parent 77749eb commit ff9dfd8

File tree

8 files changed

+83
-37
lines changed

8 files changed

+83
-37
lines changed

planning/mapless_architecture/autoware_hmi/src/hmi_node.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ void HMINode::PublishMission_(std::string mission)
8383
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::TAKE_NEXT_EXIT_RIGHT;
8484
}
8585

86-
// TODO(simon.eisenmann@driveblocks.ai): Change deadline parameter
87-
missionMessage.deadline = 1000;
86+
missionMessage.deadline = 1000; // This parameter can be changed if needed (it will be set by the
87+
// software in the future).
8888

8989
mission_publisher_->publish(missionMessage);
9090
}

planning/mapless_architecture/autoware_local_mission_planner/include/autoware/local_mission_planner/mission_planner_node.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,10 @@ class MissionPlannerNode : public rclcpp::Node
248248
Direction target_lane_ = stay;
249249
Direction mission_ = stay;
250250
int retry_attempts_ = 0;
251+
int recenter_counter_ = 0;
251252
bool lane_change_trigger_success_ = true;
252253
Direction lane_change_direction_ = stay;
254+
float deadline_target_lane_ = 1000;
253255

254256
lanelet::BasicPoint2d goal_point_;
255257
std::vector<int> ego_lane_;
@@ -262,9 +264,10 @@ class MissionPlannerNode : public rclcpp::Node
262264
float projection_distance_on_goallane_;
263265
int retrigger_attempts_max_;
264266
std::string local_map_frame_;
267+
int recenter_period_;
265268

266269
// Unique ID for each marker
267-
int centerline_marker_id_ = 0;
270+
ID centerline_marker_id_;
268271
};
269272
} // namespace autoware::mapless_architecture
270273

planning/mapless_architecture/autoware_local_mission_planner/param/mission_planner_default.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
projection_distance_on_goallane: 20.0 # [m] projection distance of goal point
66
retrigger_attempts_max: 10 # number of attempts for triggering a lane change
77
local_map_frame: map # Identifier of local map frame. Currently, there is no way to set global ROS params https://github.com/ros2/ros2cli/issues/778 -> This param has to be set in the mission converter also!
8+
recenter_period: 10 # recenter goal point after 10 odometry updates

planning/mapless_architecture/autoware_local_mission_planner/src/mission_planner_node.cpp

+27-18
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ MissionPlannerNode::MissionPlannerNode(const rclcpp::NodeOptions & options)
9393
tf_listener_ = std::make_unique<tf2_ros::TransformListener>(*tf_buffer_);
9494

9595
// Set ros parameters (DEFAULT values will be overwritten by external
96-
// parameter file if exists)
96+
// parameter file)
9797
distance_to_centerline_threshold_ =
9898
declare_parameter<float>("distance_to_centerline_threshold", 0.2);
9999
RCLCPP_INFO(
@@ -113,6 +113,13 @@ MissionPlannerNode::MissionPlannerNode(const rclcpp::NodeOptions & options)
113113

114114
local_map_frame_ = declare_parameter<std::string>("local_map_frame", "map");
115115
RCLCPP_INFO(this->get_logger(), "Local map frame identifier: %s", local_map_frame_.c_str());
116+
117+
recenter_period_ = declare_parameter<int>("recenter_period", 10);
118+
RCLCPP_INFO(
119+
this->get_logger(),
120+
"After this number of odometry updates the goal point (used for lane change) is recentered (on "
121+
"the centerline): %d",
122+
recenter_period_);
116123
}
117124

118125
void MissionPlannerNode::CallbackLocalMapMessages_(
@@ -233,9 +240,7 @@ void MissionPlannerNode::CallbackLocalMapMessages_(
233240
break;
234241
}
235242

236-
lanes.deadline_target_lane =
237-
std::numeric_limits<double>::infinity(); // TODO(simon.eisenmann@driveblocks.ai):
238-
// Change this value
243+
lanes.deadline_target_lane = deadline_target_lane_;
239244

240245
// Create driving corridors and add them to the MissionLanesStamped message
241246
lanes.ego_lane = CreateDrivingCorridor(ego_lane_, converted_lanelets);
@@ -308,14 +313,22 @@ void MissionPlannerNode::CallbackOdometryMessages_(const nav_msgs::msg::Odometry
308313
goal_point_.x() = target_pose.get_x();
309314
goal_point_.y() = target_pose.get_y();
310315

311-
// Re-center updated goal point to lie on centerline (to get rid of issues
316+
// Recenter updated goal point to lie on centerline (to get rid of issues
312317
// with a less accurate odometry update which could lead to loosing the
313-
// goal lane)
314-
const lanelet::BasicPoint2d target_point_2d = RecenterGoalPoint(goal_point_, current_lanelets_);
318+
// goal lane), recenter only after a certain number of steps (recenter_period_) to reduce the
319+
// calling frequency
320+
if (recenter_counter_ >= recenter_period_) {
321+
const lanelet::BasicPoint2d target_point_2d =
322+
RecenterGoalPoint(goal_point_, current_lanelets_);
315323

316-
// Overwrite goal point
317-
goal_point_.x() = target_point_2d.x();
318-
goal_point_.y() = target_point_2d.y();
324+
// Overwrite goal point
325+
goal_point_.x() = target_point_2d.x();
326+
goal_point_.y() = target_point_2d.y();
327+
328+
recenter_counter_ = 0;
329+
} else {
330+
recenter_counter_++;
331+
}
319332

320333
// --- Start of debug visualization
321334
// Create marker and publish it
@@ -405,6 +418,8 @@ void MissionPlannerNode::CallbackMissionMessages_(const autoware_planning_msgs::
405418
RCLCPP_INFO(this->get_logger(), "Mission does not match.");
406419
}
407420

421+
deadline_target_lane_ = msg.deadline;
422+
408423
return;
409424
}
410425

@@ -548,8 +563,7 @@ void MissionPlannerNode::CheckIfGoalPointShouldBeReset_(
548563
{
549564
// Check if goal point should be reset: If the x value of the goal point is
550565
// negative, then the point is behind the vehicle and must be therefore reset.
551-
if (goal_point_.x() < 0 && mission_ != stay) { // TODO(simon.eisenmann@driveblocks.ai): Maybe
552-
// remove condition mission_ != stay
566+
if (goal_point_.x() < 0 && mission_ != stay) {
553567
// Find the index of the lanelet containing the goal point
554568
int goal_index =
555569
FindOccupiedLaneletID(converted_lanelets, goal_point_); // Returns -1 if no match
@@ -763,12 +777,7 @@ void MissionPlannerNode::VisualizeCenterlineOfDrivingCorridor(
763777
centerline_marker.ns = "centerline";
764778

765779
// Unique ID
766-
if (centerline_marker_id_ == std::numeric_limits<int>::max()) {
767-
// Handle overflow
768-
centerline_marker_id_ = 0;
769-
} else {
770-
centerline_marker.id = centerline_marker_id_++;
771-
}
780+
centerline_marker.id = centerline_marker_id_.ReturnIDAndIncrement();
772781

773782
centerline_marker.type = visualization_msgs::msg::Marker::LINE_STRIP;
774783
centerline_marker.action = visualization_msgs::msg::Marker::ADD;

planning/mapless_architecture/autoware_local_mission_planner_common/include/autoware/local_mission_planner_common/helper_functions.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ class Pose2D
6666
double psi_;
6767
};
6868

69+
class ID
70+
{
71+
public:
72+
ID() : value_(0) {}
73+
unsigned int ReturnIDAndIncrement();
74+
75+
private:
76+
unsigned int value_;
77+
};
78+
6979
/**
7080
* Represent a 2D pose (pose_prev) in a new origin / coordinate system, which
7181
* is given in relation to the previous coordinate system / origin

planning/mapless_architecture/autoware_local_mission_planner_common/src/helper_functions.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ std::vector<int> GetRelevantAdjacentLanelets(
229229
ids_relevant_successors = ids_adjacent_lanelets;
230230
}
231231

232-
// FIXME: avoid that list is empty -> has to be -1 if no relevant lanelet
233-
// exists, this fixes an issue that originates in the lanelet converter; should be fixed there!
234232
if (ids_relevant_successors.empty()) {
235233
ids_relevant_successors.push_back(-1);
236234
}
@@ -664,4 +662,13 @@ void CalculatePredecessors(std::vector<LaneletConnection> & lanelet_connections)
664662
}
665663
}
666664

665+
unsigned int ID::ReturnIDAndIncrement()
666+
{
667+
if (value_ == std::numeric_limits<unsigned int>::max()) {
668+
RCLCPP_WARN(rclcpp::get_logger("ID"), "ID overflow");
669+
value_ = 0; // Reset value_ to 0
670+
}
671+
return value_++;
672+
}
673+
667674
} // namespace autoware::mapless_architecture

planning/mapless_architecture/autoware_mission_lane_converter/include/autoware/mission_lane_converter/mission_lane_converter_node.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef AUTOWARE__MISSION_LANE_CONVERTER__MISSION_LANE_CONVERTER_NODE_HPP_
1616
#define AUTOWARE__MISSION_LANE_CONVERTER__MISSION_LANE_CONVERTER_NODE_HPP_
1717

18+
#include "autoware/local_mission_planner_common/helper_functions.hpp"
1819
#include "rclcpp/rclcpp.hpp"
1920

2021
#include "autoware_planning_msgs/msg/mission_lanes_stamped.hpp"
@@ -201,6 +202,9 @@ class MissionLaneConverterNode : public rclcpp::Node
201202
// ROS parameters
202203
float target_speed_;
203204
std::string local_map_frame_;
205+
206+
// Unique ID for each marker
207+
ID marker_id_;
204208
};
205209
} // namespace autoware::mapless_architecture
206210

planning/mapless_architecture/autoware_mission_lane_converter/src/mission_lane_converter_node.cpp

+26-14
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ void MissionLaneConverterNode::MissionLanesCallback_(
161161
path_publisher_->publish(path_msg);
162162
path_publisher_global_->publish(path_msg_global);
163163

164-
// TODO(thomas.herrmann@driveblocks.ai): outsource this to a separate method
165164
// Clear all markers in scene
166165
visualization_msgs::msg::Marker msg_marker;
167166
msg_marker.header = msg_mission.header;
@@ -239,8 +238,12 @@ MissionLaneConverterNode::ConvertMissionToTrajectory(
239238
trj_msg, path_msg, trj_vis, path_center_vis, msg.ego_lane.centerline);
240239

241240
// Fill path bounds left and right
242-
CreatePathBound_(path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left, 1);
243-
CreatePathBound_(path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right, 2);
241+
CreatePathBound_(
242+
path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left,
243+
marker_id_.ReturnIDAndIncrement());
244+
CreatePathBound_(
245+
path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right,
246+
marker_id_.ReturnIDAndIncrement());
244247
break;
245248
case -1:
246249
// Lane change to the left
@@ -249,18 +252,24 @@ MissionLaneConverterNode::ConvertMissionToTrajectory(
249252

250253
// Fill path bounds left and right
251254
CreatePathBound_(
252-
path_msg.left_bound, path_left_vis, msg.drivable_lanes_left[0].bound_left, 1);
253-
CreatePathBound_(path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right, 2);
255+
path_msg.left_bound, path_left_vis, msg.drivable_lanes_left[0].bound_left,
256+
marker_id_.ReturnIDAndIncrement());
257+
CreatePathBound_(
258+
path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right,
259+
marker_id_.ReturnIDAndIncrement());
254260
break;
255261
case 1:
256262
// Lane change to the right
257263
CreateMotionPlannerInput_(
258264
trj_msg, path_msg, trj_vis, path_center_vis, msg.drivable_lanes_right[0].centerline);
259265

260266
// Fill path bounds left and right
261-
CreatePathBound_(path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left, 1);
262267
CreatePathBound_(
263-
path_msg.right_bound, path_right_vis, msg.drivable_lanes_right[0].bound_right, 2);
268+
path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left,
269+
marker_id_.ReturnIDAndIncrement());
270+
CreatePathBound_(
271+
path_msg.right_bound, path_right_vis, msg.drivable_lanes_right[0].bound_right,
272+
marker_id_.ReturnIDAndIncrement());
264273
break;
265274
case -2:
266275
// Take exit left
@@ -269,18 +278,24 @@ MissionLaneConverterNode::ConvertMissionToTrajectory(
269278

270279
// Fill path bounds left and right
271280
CreatePathBound_(
272-
path_msg.left_bound, path_left_vis, msg.drivable_lanes_left.back().bound_left, 1);
273-
CreatePathBound_(path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right, 2);
281+
path_msg.left_bound, path_left_vis, msg.drivable_lanes_left.back().bound_left,
282+
marker_id_.ReturnIDAndIncrement());
283+
CreatePathBound_(
284+
path_msg.right_bound, path_right_vis, msg.ego_lane.bound_right,
285+
marker_id_.ReturnIDAndIncrement());
274286
break;
275287
case 2:
276288
// Take exit right
277289
CreateMotionPlannerInput_(
278290
trj_msg, path_msg, trj_vis, path_center_vis, msg.drivable_lanes_right.back().centerline);
279291

280292
// Fill path bounds left and right
281-
CreatePathBound_(path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left, 1);
282293
CreatePathBound_(
283-
path_msg.right_bound, path_right_vis, msg.drivable_lanes_right.back().bound_right, 2);
294+
path_msg.left_bound, path_left_vis, msg.ego_lane.bound_left,
295+
marker_id_.ReturnIDAndIncrement());
296+
CreatePathBound_(
297+
path_msg.right_bound, path_right_vis, msg.drivable_lanes_right.back().bound_right,
298+
marker_id_.ReturnIDAndIncrement());
284299
break;
285300

286301
default:
@@ -374,7 +389,6 @@ void MissionLaneConverterNode::CreatePathBound_(
374389
}
375390

376391
// Add last added point to a marker message for debugging
377-
// FIXME: probably no unique ids for multiple calls?
378392
AddPointVisualizationMarker_(path_vis, bound_path.back().x, bound_path.back().y, id_marker);
379393
}
380394

@@ -456,8 +470,6 @@ void MissionLaneConverterNode::AddHeadingToTrajectory_(
456470
return;
457471
}
458472

459-
// TODO(thomas.herrmann@driveblocks.ai): store the latest odometry message here and then re-use in
460-
// the output conversion
461473
void MissionLaneConverterNode::CallbackOdometryMessages_(const nav_msgs::msg::Odometry & msg)
462474
{
463475
// Store current odometry information

0 commit comments

Comments
 (0)