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

Fix Sonor Cloud Issue8-3 #1474

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -51,19 +51,19 @@ class LaneletUtils

double computeDistance(
const traffic_simulator_msgs::msg::LaneletPose & p1,
const traffic_simulator_msgs::msg::LaneletPose & p2);
const traffic_simulator_msgs::msg::LaneletPose & p2) const;
std::optional<traffic_simulator_msgs::msg::LaneletPose> getOppositeLaneLet(
const traffic_simulator_msgs::msg::LaneletPose & pose);
std::vector<LaneletPart> getLanesWithinDistance(
const traffic_simulator_msgs::msg::LaneletPose & pose, double min_distance,
double max_distance);

std::vector<int64_t> getLaneletIds();
std::vector<int64_t> getLaneletIds() const;
geometry_msgs::msg::PoseStamped toMapPose(
const traffic_simulator_msgs::msg::LaneletPose & lanelet_pose, const bool fill_pitch);
const traffic_simulator_msgs::msg::LaneletPose & lanelet_pose, const bool fill_pitch) const;
std::vector<int64_t> getRoute(int64_t from_lanelet_id, int64_t to_lanelet_id);
double getLaneletLength(int64_t lanelet_id);
bool isInLanelet(int64_t lanelet_id, double s);
double getLaneletLength(int64_t lanelet_id) const;
bool isInLanelet(int64_t lanelet_id, double s) const;

private:
lanelet::LaneletMapPtr lanelet_map_ptr_;
Expand Down
13 changes: 8 additions & 5 deletions test_runner/random_test_runner/src/lanelet_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ LaneletUtils::LaneletUtils(const boost::filesystem::path & filename)
std::make_shared<hdmap_utils::HdMapUtils>(filename, geographic_msgs::msg::GeoPoint());
}

std::vector<int64_t> LaneletUtils::getLaneletIds() { return hdmap_utils_ptr_->getLaneletIds(); }
std::vector<int64_t> LaneletUtils::getLaneletIds() const
{
return hdmap_utils_ptr_->getLaneletIds();
}

geometry_msgs::msg::PoseStamped LaneletUtils::toMapPose(
const traffic_simulator_msgs::msg::LaneletPose & lanelet_pose, const bool fill_pitch)
const traffic_simulator_msgs::msg::LaneletPose & lanelet_pose, const bool fill_pitch) const
{
return hdmap_utils_ptr_->toMapPose(lanelet_pose, fill_pitch);
}
Expand All @@ -60,14 +63,14 @@ std::vector<int64_t> LaneletUtils::getRoute(int64_t from_lanelet_id, int64_t to_
return hdmap_utils_ptr_->getRoute(from_lanelet_id, to_lanelet_id);
}

double LaneletUtils::getLaneletLength(int64_t lanelet_id)
double LaneletUtils::getLaneletLength(int64_t lanelet_id) const
{
return hdmap_utils_ptr_->getLaneletLength(lanelet_id);
}

double LaneletUtils::computeDistance(
const traffic_simulator_msgs::msg::LaneletPose & p1,
const traffic_simulator_msgs::msg::LaneletPose & p2)
const traffic_simulator_msgs::msg::LaneletPose & p2) const
{
auto p1_g = hdmap_utils_ptr_->toMapPose(p1).pose.position;
auto p2_g = hdmap_utils_ptr_->toMapPose(p2).pose.position;
Expand All @@ -78,7 +81,7 @@ double LaneletUtils::computeDistance(
return std::sqrt(d.x * d.x + d.y * d.y + d.z * d.z);
}

bool LaneletUtils::isInLanelet(int64_t lanelet_id, double s)
bool LaneletUtils::isInLanelet(int64_t lanelet_id, double s) const
{
return hdmap_utils_ptr_->isInLanelet(lanelet_id, s);
}
Expand Down
Loading