Skip to content

Commit

Permalink
Fix Sonor Cloud Issue: should be declared "const".
Browse files Browse the repository at this point in the history
  • Loading branch information
TakanoTaiga committed Dec 4, 2024
1 parent 06d9815 commit 8c9a809
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
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

0 comments on commit 8c9a809

Please sign in to comment.