Skip to content

Commit

Permalink
Merge branch 'autowarefoundation:main' into chore/rework_param_map_lo…
Browse files Browse the repository at this point in the history
…ader
  • Loading branch information
Anh Nguyen authored Jan 30, 2024
2 parents 3693fa8 + 25bc636 commit f593330
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ std::map<std::string, PCDFileMetadata> PointCloudMapLoaderNode::getPCDMetadata(
{
std::map<std::string, PCDFileMetadata> pcd_metadata_dict;
if (pcd_paths.size() != 1) {
if (!fs::exists(pcd_metadata_path)) {
throw std::runtime_error("PCD metadata file not found: " + pcd_metadata_path);
while (!fs::exists(pcd_metadata_path)) {
RCLCPP_ERROR_STREAM(get_logger(), "PCD metadata file not found: " << pcd_metadata_path);
std::this_thread::sleep_for(std::chrono::seconds(1));
}

pcd_metadata_dict = loadPCDMetadata(pcd_metadata_path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class GoalPlannerModule : public SceneModuleInterface
std::optional<BehaviorModuleOutput> last_previous_module_output_{};
bool hasPreviousModulePathShapeChanged() const;
bool hasDeviatedFromLastPreviousModulePath() const;
bool hasDeviatedFromCurrentPreviousModulePath() const;

// timer for generating pull over path candidates in a separate thread
void onTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ bool GoalPlannerModule::hasDeviatedFromLastPreviousModulePath() const
planner_data_->self_odometry->pose.pose.position)) > 0.3;
}

bool GoalPlannerModule::hasDeviatedFromCurrentPreviousModulePath() const
{
return std::abs(motion_utils::calcLateralOffset(
getPreviousModuleOutput().path.points,
planner_data_->self_odometry->pose.pose.position)) > 0.3;
}

// generate pull over candidate paths
void GoalPlannerModule::onTimer()
{
Expand All @@ -179,6 +186,10 @@ void GoalPlannerModule::onTimer()

// check if new pull over path candidates are needed to be generated
const bool need_update = std::invoke([&]() {
if (hasDeviatedFromCurrentPreviousModulePath()) {
RCLCPP_ERROR(getLogger(), "has deviated from current previous module path");
return false;
}
if (thread_safe_data_.get_pull_over_path_candidates().empty()) {
return true;
}
Expand Down

0 comments on commit f593330

Please sign in to comment.