Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
finished except for one
Browse files Browse the repository at this point in the history
Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed Jan 12, 2024
1 parent dd79772 commit 880dc3a
Showing 1 changed file with 95 additions and 28 deletions.
123 changes: 95 additions & 28 deletions tmp/lanelet2_extension_python/src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,68 @@ double getLateralDistanceToClosestLanelet(
return lanelet::utils::getLateralDistanceToClosestLanelet(lanelet_sequence, pose);
}

Check warning on line 147 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L144-L147

Added lines #L144 - L147 were not covered by tests

lanelet::Optional<lanelet::ConstLanelet> getLinkedLanelet(

Check warning on line 149 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L149

Added line #L149 was not covered by tests
const lanelet::ConstLineString3d & parking_space,
const lanelet::ConstLanelets & all_road_lanelets,
const lanelet::ConstPolygons3d & all_parking_lots)
{
lanelet::ConstLanelet linked_lanelet;
if (lanelet::utils::query::getLinkedLanelet(

Check warning on line 155 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L154-L155

Added lines #L154 - L155 were not covered by tests
parking_space, all_road_lanelets, all_parking_lots, &linked_lanelet)) {
return linked_lanelet;
} else {
return {};
}
}

lanelet::Optional<lanelet::ConstLanelet> getLinkedLanelet(

Check warning on line 163 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L163

Added line #L163 was not covered by tests
const lanelet::ConstLineString3d & parking_space,
const lanelet::LaneletMapConstPtr & lanelet_map_ptr)
{
lanelet::ConstLanelet linked_lanelet;
if (lanelet::utils::query::getLinkedLanelet(parking_space, lanelet_map_ptr, &linked_lanelet)) {

Check warning on line 168 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L167-L168

Added lines #L167 - L168 were not covered by tests
return linked_lanelet;
} else {
return {};
}
}

lanelet::Optional<lanelet::ConstPolygon3d> getLinkedParkingLot(

Check warning on line 175 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L175

Added line #L175 was not covered by tests
const lanelet::ConstLanelet & lanelet, const lanelet::ConstPolygons3d & all_parking_lots)
{
lanelet::ConstPolygon3d linked_parking_lot;
if (lanelet::utils::query::getLinkedParkingLot(lanelet, all_parking_lots, &linked_parking_lot)) {

Check warning on line 179 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L178-L179

Added lines #L178 - L179 were not covered by tests
return linked_parking_lot;
} else {
return {};
}
}

lanelet::Optional<lanelet::ConstPolygon3d> getLinkedParkingLot(

Check warning on line 186 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L186

Added line #L186 was not covered by tests
const lanelet::BasicPoint2d & current_position, const lanelet::ConstPolygons3d & all_parking_lots)
{
lanelet::ConstPolygon3d linked_parking_lot;
if (lanelet::utils::query::getLinkedParkingLot(

Check warning on line 190 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L189-L190

Added lines #L189 - L190 were not covered by tests
current_position, all_parking_lots, &linked_parking_lot)) {
return linked_parking_lot;
} else {
return {};
}
}

lanelet::Optional<lanelet::ConstPolygon3d> getLinkedParkingLot(

Check warning on line 198 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L198

Added line #L198 was not covered by tests
const lanelet::ConstLineString3d & parking_space,
const lanelet::ConstPolygons3d & all_parking_lots)
{
lanelet::ConstPolygon3d linked_parking_lot;
if (lanelet::utils::query::getLinkedParkingLot(

Check warning on line 203 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L202-L203

Added lines #L202 - L203 were not covered by tests
parking_space, all_parking_lots, &linked_parking_lot)) {
return linked_parking_lot;
} else {
return {};
}
}

lanelet::ConstLanelets getLaneletsWithinRange_point(

Check warning on line 211 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L211

Added line #L211 was not covered by tests
const lanelet::ConstLanelets & lanelets, const std::string & point_byte, const double range)
{
Expand Down Expand Up @@ -196,9 +258,8 @@ lanelet::ConstLanelets getAllNeighbors_point(
return lanelet::utils::query::getAllNeighbors(graph, road_lanelets, point);
}

Check warning on line 259 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L256-L259

Added lines #L256 - L259 were not covered by tests

bool getClosestLaneletWithConstrains(
lanelet::Optional<lanelet::ConstLanelet> getClosestLaneletWithConstrains(

Check warning on line 261 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L261

Added line #L261 was not covered by tests
const lanelet::ConstLanelets & lanelets, const std::string & pose_byte,
lanelet::ConstLanelet * closest_lanelet_ptr,
const double dist_threshold = std::numeric_limits<double>::max(),
const double yaw_threshold = std::numeric_limits<double>::max())
{
Expand All @@ -212,13 +273,17 @@ bool getClosestLaneletWithConstrains(
geometry_msgs::msg::Pose pose;
static rclcpp::Serialization<geometry_msgs::msg::Pose> serializer;
serializer.deserialize_message(&serialized_msg, &pose);
return lanelet::utils::query::getClosestLaneletWithConstrains(
lanelets, pose, closest_lanelet_ptr, dist_threshold, yaw_threshold);
lanelet::ConstLanelet closest_lanelet;
if (lanelet::utils::query::getClosestLaneletWithConstrains(

Check warning on line 277 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L274-L277

Added lines #L274 - L277 were not covered by tests
lanelets, pose, &closest_lanelet, dist_threshold, yaw_threshold)) {
return closest_lanelet;
} else {
return {};
}
}

Check warning on line 283 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L283

Added line #L283 was not covered by tests

bool getCurrentLanelets_point(
const lanelet::ConstLanelets & lanelets, const std::string & point_byte,
lanelet::ConstLanelets * current_lanelets_ptr)
lanelet::ConstLanelets getCurrentLanelets_point(

Check warning on line 285 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L285

Added line #L285 was not covered by tests
const lanelet::ConstLanelets & lanelets, const std::string & point_byte)
{
rclcpp::SerializedMessage serialized_msg;

Check warning on line 288 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L288

Added line #L288 was not covered by tests
static constexpr size_t message_header_length = 8u;
Expand All @@ -230,12 +295,13 @@ bool getCurrentLanelets_point(
geometry_msgs::msg::Point point;
static rclcpp::Serialization<geometry_msgs::msg::Point> serializer;
serializer.deserialize_message(&serialized_msg, &point);

Check warning on line 297 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L296-L297

Added lines #L296 - L297 were not covered by tests
return lanelet::utils::query::getCurrentLanelets(lanelets, point, current_lanelets_ptr);
lanelet::ConstLanelets current_lanelets;
lanelet::utils::query::getCurrentLanelets(lanelets, point, &current_lanelets);
return current_lanelets;
}

Check warning on line 301 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L299-L301

Added lines #L299 - L301 were not covered by tests

bool getCurrentLanelets_pose(
const lanelet::ConstLanelets & lanelets, const std::string & pose_byte,
lanelet::ConstLanelets * current_lanelets_ptr)
lanelet::ConstLanelets getCurrentLanelets_pose(

Check warning on line 303 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L303

Added line #L303 was not covered by tests
const lanelet::ConstLanelets & lanelets, const std::string & pose_byte)
{
rclcpp::SerializedMessage serialized_msg;

Check warning on line 306 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L306

Added line #L306 was not covered by tests
static constexpr size_t message_header_length = 8u;
Expand All @@ -247,7 +313,9 @@ bool getCurrentLanelets_pose(
geometry_msgs::msg::Pose pose;
static rclcpp::Serialization<geometry_msgs::msg::Pose> serializer;
serializer.deserialize_message(&serialized_msg, &pose);

Check warning on line 315 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L314-L315

Added lines #L314 - L315 were not covered by tests
return lanelet::utils::query::getCurrentLanelets(lanelets, pose, current_lanelets_ptr);
lanelet::ConstLanelets current_lanelets;
lanelet::utils::query::getCurrentLanelets(lanelets, pose, &current_lanelets);
return current_lanelets;
}

Check warning on line 319 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L317-L319

Added lines #L317 - L319 were not covered by tests

lanelet::ConstLanelets subtypeLanelets(

Check warning on line 321 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L321

Added line #L321 was not covered by tests
Expand All @@ -263,7 +331,7 @@ lanelet::ConstLanelets subtypeLanelets(
BOOST_PYTHON_FUNCTION_OVERLOADS(

Check warning on line 331 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L331

Added line #L331 was not covered by tests
stopSignStopLines_overload, lanelet::utils::query::stopSignStopLines, 1, 2)
BOOST_PYTHON_FUNCTION_OVERLOADS(

Check warning on line 333 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L333

Added line #L333 was not covered by tests
getClosestLaneletWithConstrains_overload, ::getClosestLaneletWithConstrains, 3, 5)
getClosestLaneletWithConstrains_overload, ::getClosestLaneletWithConstrains, 2, 4)
BOOST_PYTHON_FUNCTION_OVERLOADS(

Check warning on line 335 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L335

Added line #L335 was not covered by tests
getPrecedingLaneletSequences_overload, lanelet::utils::query::getPrecedingLaneletSequences, 3, 4)

Expand Down Expand Up @@ -369,29 +437,28 @@ BOOST_PYTHON_MODULE(_lanelet2_extension_python_boost_python_utility)
bp::class_<lanelet::ConstPolygons3d>("lanelet::ConstPolygons3d")
.def(bp::vector_indexing_suite<lanelet::ConstPolygons3d>());

Check warning on line 438 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L435-L438

Added lines #L435 - L438 were not covered by tests

bp::def<bool(
bp::def<lanelet::Optional<lanelet::ConstLanelet>(
const lanelet::ConstLineString3d &, const lanelet::ConstLanelets &,
const lanelet::ConstPolygons3d &, lanelet::ConstLanelet *)>(
"getLinkedLanelet", lanelet::utils::query::getLinkedLanelet);
bp::def<bool(
const lanelet::ConstLineString3d &, const lanelet::LaneletMapConstPtr &,
lanelet::ConstLanelet *)>("getLinkedLanelet", lanelet::utils::query::getLinkedLanelet);
const lanelet::ConstPolygons3d &)>("getLinkedLanelet", ::getLinkedLanelet);

Check warning on line 442 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L442

Added line #L442 was not covered by tests
bp::def<lanelet::Optional<lanelet::ConstLanelet>(
const lanelet::ConstLineString3d &, const lanelet::LaneletMapConstPtr &)>(

Check warning on line 444 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L444

Added line #L444 was not covered by tests
"getLinkedLanelet", ::getLinkedLanelet);
bp::def<lanelet::ConstLanelets(
const lanelet::ConstLineString3d &, const lanelet::ConstLanelets &,
const lanelet::ConstPolygons3d &)>(

Check warning on line 448 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L448

Added line #L448 was not covered by tests
"getLinkedLanelets", lanelet::utils::query::getLinkedLanelets);
bp::def<lanelet::ConstLanelets(
const lanelet::ConstLineString3d &, const lanelet::LaneletMapConstPtr &)>(

Check warning on line 451 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L451

Added line #L451 was not covered by tests
"getLinkedLanelets", lanelet::utils::query::getLinkedLanelets);
bp::def<bool(
const lanelet::ConstLanelet &, const lanelet::ConstPolygons3d &, lanelet::ConstPolygon3d *)>(
"getLinkedParkingLot", lanelet::utils::query::getLinkedParkingLot);
bp::def<bool(
const lanelet::BasicPoint2d &, const lanelet::ConstPolygons3d &, lanelet::ConstPolygon3d *)>(
"getLinkedParkingLot", lanelet::utils::query::getLinkedParkingLot);
bp::def<bool(
const lanelet::ConstLineString3d &, const lanelet::ConstPolygons3d &,
lanelet::ConstPolygon3d *)>("getLinkedParkingLot", lanelet::utils::query::getLinkedParkingLot);
bp::def<lanelet::Optional<lanelet::ConstPolygon3d>(
const lanelet::ConstLanelet &, const lanelet::ConstPolygons3d &)>(

Check warning on line 454 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L454

Added line #L454 was not covered by tests
"getLinkedParkingLot", ::getLinkedParkingLot);
bp::def<lanelet::Optional<lanelet::ConstPolygon3d>(
const lanelet::BasicPoint2d &, const lanelet::ConstPolygons3d &)>(

Check warning on line 457 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L457

Added line #L457 was not covered by tests
"getLinkedParkingLot", ::getLinkedParkingLot);
bp::def<lanelet::Optional<lanelet::ConstPolygon3d>(
const lanelet::ConstLineString3d &, const lanelet::ConstPolygons3d &)>(

Check warning on line 460 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L460

Added line #L460 was not covered by tests
"getLinkedParkingLot", ::getLinkedParkingLot);
bp::def("stopLinesLanelets", lanelet::utils::query::stopLinesLanelets);
bp::def("stopLinesLanelet", lanelet::utils::query::stopLinesLanelet);

Check warning on line 463 in tmp/lanelet2_extension_python/src/utility.cpp

View check run for this annotation

Codecov / codecov/patch

tmp/lanelet2_extension_python/src/utility.cpp#L462-L463

Added lines #L462 - L463 were not covered by tests
bp::def(
Expand Down

0 comments on commit 880dc3a

Please sign in to comment.