提交 139830ad 编写于 作者: C Calvin Miao 提交者: Aaron Xiao

Prediction: updated function declaration

上级 2414634c
......@@ -169,20 +169,20 @@ double PredictionMap::PathHeading(
return HeadingOnLane(lane_info, s);
}
int PredictionMap::SmoothPointFromLane(
bool PredictionMap::SmoothPointFromLane(
const std::string& id,
const double s, const double l,
Eigen::Vector2d* point,
double* heading) {
if (point == nullptr || heading == nullptr) {
return -1;
return false;
}
std::shared_ptr<const LaneInfo> lane = LaneById(id);
apollo::common::PointENU hdmap_point = lane->get_smooth_point(s);
*heading = PathHeading(lane, hdmap_point);
point->operator[](0) = hdmap_point.x() - std::sin(*heading) * l;
point->operator[](1) = hdmap_point.y() + std::cos(*heading) * l;
return 0;
return true;
}
void PredictionMap::NearbyLanesByCurrentLanes(
......
......@@ -68,7 +68,7 @@ class PredictionMap {
* @param id The ID of the target lane ID in the form of string.
* @return A shared pointer to the lane with the input lane ID.
*/
std::shared_ptr<const apollo::hdmap::LaneInfo> LaneById(
static std::shared_ptr<const apollo::hdmap::LaneInfo> LaneById(
const std::string& id);
/**
......@@ -128,9 +128,9 @@ class PredictionMap {
* @param l The lateral coordinate of the position.
* @param point The point corresponding to the s,l-value coordinate.
* @param heading The lane heading on the point.
* @return If the process is successful. 0: success, -1: failure.
* @return If the process is successful.
*/
int SmoothPointFromLane(
bool SmoothPointFromLane(
const std::string& id, const double s,
const double l, Eigen::Vector2d* point,
double* heading);
......@@ -256,7 +256,7 @@ class PredictionMap {
* @param lane_id The lane ID.
* @return Integer corresponding to the lane turn type.
*/
int LaneTurnType(const std::string& lane_id);
static int LaneTurnType(const std::string& lane_id);
private:
DECLARE_SINGLETON(PredictionMap);
......
......@@ -165,7 +165,7 @@ TEST_F(PredictionMapTest, get_smooth_point_from_lane) {
double heading = M_PI;
Eigen::Vector2d point;
EXPECT_EQ(0, map_->SmoothPointFromLane(id, s, l, &point, &heading));
EXPECT_TRUE(map_->SmoothPointFromLane(id, s, l, &point, &heading));
EXPECT_DOUBLE_EQ(124.85930930657942, point.x());
EXPECT_DOUBLE_EQ(348.52732962417451, point.y());
EXPECT_DOUBLE_EQ(-0.061427808505166936, heading);
......
......@@ -180,8 +180,7 @@ void LaneSequencePredictor::DrawLaneSequenceTrajectoryPoints(
for (size_t i = 0; i < static_cast<size_t>(total_time / freq); ++i) {
Eigen::Vector2d point;
double theta = M_PI;
if (map->SmoothPointFromLane(lane_id,
lane_s, lane_l, &point, &theta) != 0) {
if (!map->SmoothPointFromLane(lane_id, lane_s, lane_l, &point, &theta)) {
AERROR << "Unable to get smooth point from lane [" << lane_id
<< "] with s [" << lane_s << "] and l [" << lane_l
<< "]";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册