提交 60116165 编写于 作者: X Xiangquan Xiao 提交者: Jiangtao Hu

Common: Migrate MakeSLPoint to PointFactory.

上级 af76fe2e
......@@ -32,6 +32,7 @@ cc_library(
hdrs = ["point_factory.h"],
deps = [
"//modules/common/math:geometry",
"//modules/common/proto:pnc_point_proto",
],
)
......
......@@ -17,6 +17,7 @@
#pragma once
#include "modules/common/math/vec2d.h"
#include "modules/common/proto/pnc_point.pb.h"
namespace apollo {
namespace common {
......@@ -28,6 +29,13 @@ class PointFactory {
static inline math::Vec2d ToVec2d(const XY& xy) {
return math::Vec2d(xy.x(), xy.y());
}
static inline SLPoint ToSLPoint(const double s, const double l) {
SLPoint sl;
sl.set_s(s);
sl.set_l(l);
return sl;
}
};
} // namespace util
......
......@@ -23,13 +23,6 @@ namespace apollo {
namespace common {
namespace util {
SLPoint MakeSLPoint(const double s, const double l) {
SLPoint sl;
sl.set_s(s);
sl.set_l(l);
return sl;
}
PointENU MakePointENU(const double x, const double y, const double z) {
PointENU point_enu;
point_enu.set_x(x);
......
......@@ -30,8 +30,6 @@
#include <vector>
#include "absl/memory/memory.h"
#include "google/protobuf/util/message_differencer.h"
#include "cyber/common/log.h"
#include "cyber/common/types.h"
#include "modules/common/math/vec2d.h"
......@@ -76,14 +74,6 @@ bool WithinBound(T start, T end, T value) {
return value >= start && value <= end;
}
/**
* @brief create a SL point
* @param s the s value
* @param l the l value
* @return a SLPoint instance
*/
SLPoint MakeSLPoint(const double s, const double l);
PointENU MakePointENU(const double x, const double y, const double z);
PointENU operator+(const PointENU enu, const math::Vec2d& xy);
......
......@@ -27,7 +27,7 @@
#include "modules/common/configs/vehicle_config_helper.h"
#include "modules/common/math/vec2d.h"
#include "modules/common/util/util.h"
#include "modules/common/util/point_factory.h"
#include "modules/planning/common/planning_gflags.h"
namespace apollo {
......@@ -227,7 +227,7 @@ ComparableCost TrajectoryCost::CalculateDynamicObstacleCost(
const double l = curve.Evaluate(0, s);
const double dl = curve.Evaluate(1, s);
const common::SLPoint sl = common::util::MakeSLPoint(ref_s, l);
const common::SLPoint sl = common::util::PointFactory::ToSLPoint(ref_s, l);
const Box2d ego_box = GetBoxFromSLPoint(sl, dl);
for (const auto &obstacle_trajectory : dynamic_obstacle_boxes_) {
obstacle_cost +=
......
......@@ -25,6 +25,7 @@
#include "cyber/common/log.h"
#include "modules/common/configs/vehicle_config_helper.h"
#include "modules/common/math/cartesian_frenet_conversion.h"
#include "modules/common/util/point_factory.h"
#include "modules/common/util/util.h"
#include "modules/map/hdmap/hdmap_util.h"
#include "modules/planning/common/ego_info.h"
......@@ -141,7 +142,8 @@ bool WaypointSampler::SamplePathWaypoints(
std::vector<common::SLPoint> level_points;
planning_internal::SampleLayerDebug sample_layer_debug;
for (size_t j = 0; j < sample_l.size(); ++j) {
common::SLPoint sl = common::util::MakeSLPoint(s, sample_l[j]);
common::SLPoint sl =
common::util::PointFactory::ToSLPoint(s, sample_l[j]);
sample_layer_debug.add_sl_point()->CopyFrom(sl);
level_points.push_back(std::move(sl));
}
......
......@@ -22,7 +22,7 @@
#include <algorithm>
#include "modules/common/util/util.h"
#include "modules/common/util/point_factory.h"
namespace apollo {
namespace planning {
......@@ -107,8 +107,9 @@ bool ChangeLane::CreateGuardObstacle(
auto ref_point = reference_line.GetNearestReferencePoint(ref_s);
Vec2d xy_point;
if (!reference_line.SLToXY(common::util::MakeSLPoint(ref_s, sl_point.l()),
&xy_point)) {
if (!reference_line.SLToXY(
common::util::PointFactory::ToSLPoint(ref_s, sl_point.l()),
&xy_point)) {
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册