提交 1c5b179d 编写于 作者: J Jiangtao Hu 提交者: lianglia-apollo

moving SpeedPoint to common/path_point.proto

上级 247f5308
......@@ -14,8 +14,15 @@ message FrenetFramePoint {
optional double ddl = 4;
}
message EStop {
optional bool is_estop = 1;
message SpeedPoint {
optional double s = 1;
optional double t = 2;
// speed (m/s)
optional double v = 3;
// acceleration (m/s^2)
optional double a = 4;
// jerk (m/s^3)
optional double da = 5;
}
message PathPoint {
......
......@@ -81,7 +81,7 @@ bool PlanningData::aggregate(const double time_resolution,
for (double cur_rel_time = 0.0; cur_rel_time < speed_data_.total_time();
cur_rel_time += time_resolution) {
SpeedPoint speed_point;
common::SpeedPoint speed_point;
QUIT_IF(!speed_data_.get_speed_point_with_time(cur_rel_time, &speed_point),
false, ERROR, "Fail to get speed point with relative time %f",
cur_rel_time);
......
......@@ -30,6 +30,7 @@ namespace planning {
namespace util {
using common::PathPoint;
using common::SpeedPoint;
using common::TrajectoryPoint;
SpeedPoint MakeSpeedPoint(const double s, const double t, double v, double a,
......
......@@ -34,30 +34,29 @@ namespace apollo {
namespace planning {
namespace util {
SpeedPoint MakeSpeedPoint(const double s, const double t, double v, double a,
common::SpeedPoint MakeSpeedPoint(const double s, const double t, double v, double a,
double da);
common::SLPoint interpolate(const common::SLPoint &start,
const common::SLPoint &end, const double weight);
apollo::common::PathPoint interpolate(const apollo::common::PathPoint &p0,
const apollo::common::PathPoint &p1,
const double s);
SpeedPoint interpolate(const SpeedPoint& start, const SpeedPoint& end,
const double weight);
common::PathPoint interpolate(const common::PathPoint &p0,
const common::PathPoint &p1, const double s);
common::SpeedPoint interpolate(const common::SpeedPoint &start, const common::SpeedPoint &end,
const double weight);
// @ weight shall between 1 and 0
apollo::common::PathPoint interpolate_linear_approximation(
const apollo::common::PathPoint &p0, const apollo::common::PathPoint &p1,
common::PathPoint interpolate_linear_approximation(
const common::PathPoint &p0, const common::PathPoint &p1,
const double s);
apollo::common::TrajectoryPoint interpolate(
const apollo::common::TrajectoryPoint &tp0,
const apollo::common::TrajectoryPoint &tp1, const double t);
common::TrajectoryPoint interpolate(
const common::TrajectoryPoint &tp0,
const common::TrajectoryPoint &tp1, const double t);
apollo::common::TrajectoryPoint interpolate_linear_approximation(
const apollo::common::TrajectoryPoint &tp0,
const apollo::common::TrajectoryPoint &tp1, const double t);
common::TrajectoryPoint interpolate_linear_approximation(
const common::TrajectoryPoint &tp0,
const common::TrajectoryPoint &tp1, const double t);
} // namespace util
} // namespace planning
} // namespace apollo
......
......@@ -33,7 +33,7 @@ namespace planning {
namespace {
bool speed_time_comp(const double t, const SpeedPoint& speed_point) {
bool speed_time_comp(const double t, const common::SpeedPoint& speed_point) {
return t < speed_point.t();
}
......@@ -45,20 +45,20 @@ void SpeedData::add_speed_point(const double s, const double time,
speed_vector_.push_back(util::MakeSpeedPoint(s, time, v, a, da));
}
SpeedData::SpeedData(const std::vector<SpeedPoint>& speed_points)
SpeedData::SpeedData(const std::vector<common::SpeedPoint>& speed_points)
: speed_vector_(speed_points) {
}
const std::vector<SpeedPoint>& SpeedData::speed_vector() const {
const std::vector<common::SpeedPoint>& SpeedData::speed_vector() const {
return speed_vector_;
}
void SpeedData::set_speed_vector(const std::vector<SpeedPoint>& speed_points) {
void SpeedData::set_speed_vector(const std::vector<common::SpeedPoint>& speed_points) {
speed_vector_ = std::move(speed_points);
}
bool SpeedData::get_speed_point_with_time(const double t,
SpeedPoint* const speed_point) const {
common::SpeedPoint* const speed_point) const {
if (speed_vector_.size() < 2) {
return false;
}
......@@ -112,15 +112,15 @@ std::uint32_t SpeedData::find_index(const double t) const {
1;
}
SpeedPoint SpeedData::interpolate(const SpeedPoint& left,
const SpeedPoint& right,
common::SpeedPoint SpeedData::interpolate(const common::SpeedPoint& left,
const common::SpeedPoint& right,
const double weight) const {
double s = (1 - weight) * left.s() + weight * right.s();
double t = (1 - weight) * left.t() + weight * right.t();
double v = (1 - weight) * left.v() + weight * right.v();
double a = (1 - weight) * left.a() + weight * right.a();
double da = (1 - weight) * left.da() + weight * right.da();
SpeedPoint speed_point;
common::SpeedPoint speed_point;
speed_point.set_s(s);
speed_point.set_t(t);
speed_point.set_v(v);
......
......@@ -23,7 +23,7 @@
#include <string>
#include <vector>
#include "modules/planning/proto/planning.pb.h"
#include "modules/common/proto/path_point.pb.h"
namespace apollo {
namespace planning {
......@@ -32,11 +32,11 @@ class SpeedData {
public:
SpeedData() = default;
explicit SpeedData(const std::vector<SpeedPoint>& speed_points);
explicit SpeedData(const std::vector<common::SpeedPoint>& speed_points);
const std::vector<SpeedPoint>& speed_vector() const;
const std::vector<common::SpeedPoint>& speed_vector() const;
void set_speed_vector(const std::vector<SpeedPoint>& speed_points);
void set_speed_vector(const std::vector<common::SpeedPoint>& speed_points);
virtual std::string DebugString() const;
......@@ -44,17 +44,18 @@ class SpeedData {
const double a, const double da);
bool get_speed_point_with_time(const double time,
SpeedPoint* const speed_point) const;
common::SpeedPoint* const speed_point) const;
double total_time() const;
void Clear();
private:
SpeedPoint interpolate(const SpeedPoint& left, const SpeedPoint& right,
const double weight) const;
common::SpeedPoint interpolate(const common::SpeedPoint& left,
const common::SpeedPoint& right,
const double weight) const;
std::uint32_t find_index(const double s) const;
std::vector<SpeedPoint> speed_vector_;
std::vector<common::SpeedPoint> speed_vector_;
};
} // namespace planning
......
......@@ -25,6 +25,8 @@
namespace apollo {
namespace planning {
using common::SpeedPoint;
void SpeedLimit::add_speed_limit(const SpeedPoint& speed_point) {
_speed_point.push_back(speed_point);
}
......
......@@ -20,7 +20,7 @@
#include <vector>
#include "modules/planning/proto/planning.pb.h"
#include "modules/common/proto/path_point.pb.h"
#ifndef MODULES_PLANNING_COMMON_SPEED_LIMIT_H_
#define MODULES_PLANNING_COMMON_SPEED_LIMIT_H_
......@@ -31,13 +31,13 @@ namespace planning {
class SpeedLimit {
public:
SpeedLimit() = default;
void add_speed_limit(const SpeedPoint& speed_point);
void add_speed_limit(const common::SpeedPoint& speed_point);
void add_speed_limit(const double s, const double t, const double v,
const double a, const double da);
const std::vector<SpeedPoint>& speed_limits() const;
const std::vector<common::SpeedPoint>& speed_limits() const;
double get_speed_limit(const double s) const;
private:
std::vector<SpeedPoint> _speed_point;
std::vector<common::SpeedPoint> _speed_point;
};
} // namespace planning
......
......@@ -48,6 +48,7 @@ cc_library(
":dp_st_cost",
"//modules/common/configs/proto:vehicle_config_proto",
"//modules/common/proto:common_proto",
"//modules/common/proto:path_point_proto",
"//modules/planning/common:data_center",
"//modules/planning/common:decision_data",
"//modules/planning/common/speed:speed_data",
......
......@@ -25,6 +25,7 @@
#include <string>
#include "modules/common/log.h"
#include "modules/common/proto/path_point.pb.h"
#include "modules/planning/common/data_center.h"
#include "modules/planning/math/double.h"
......@@ -32,6 +33,7 @@ namespace apollo {
namespace planning {
using apollo::common::ErrorCode;
using apollo::common::SpeedPoint;
using apollo::common::Status;
DpStGraph::DpStGraph(const DpStSpeedConfig& dp_config)
......
......@@ -20,6 +20,7 @@ cc_library(
"//modules/common/configs:vehicle_config_helper",
"//modules/common/math",
"//modules/common/math/qp_solver",
"//modules/common/proto:path_point_proto",
"//modules/common/util",
"//modules/map/proto:map_proto",
"//modules/planning/common:data_center",
......
......@@ -24,6 +24,7 @@
#include "modules/common/configs/vehicle_config_helper.h"
#include "modules/common/macro.h"
#include "modules/common/proto/path_point.pb.h"
#include "modules/common/util/util.h"
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/common/planning_util.h"
......@@ -33,6 +34,8 @@
namespace apollo {
namespace planning {
using common::SpeedPoint;
constexpr double kEpsilontol = 1e-6;
bool QpFrenetFrame::Init(const ReferenceLine& reference_line,
......
......@@ -66,7 +66,7 @@ class QpFrenetFrame {
private:
bool find_longitudinal_distance(const double time,
SpeedPoint* const speed_point);
common::SpeedPoint* const speed_point);
bool calcualate_discretized_veh_loc();
......@@ -123,7 +123,7 @@ class QpFrenetFrame {
double _time_resolution = 0.1;
std::vector<double> _evaluated_knots;
std::vector<SpeedPoint> _discretized_veh_loc;
std::vector<common::SpeedPoint> _discretized_veh_loc;
std::vector<std::pair<double, double>> _hdmap_bound;
std::vector<std::pair<double, double>> _static_obstacle_bound;
std::vector<std::pair<double, double>> _dynamic_obstacle_bound;
......
......@@ -35,6 +35,7 @@ namespace planning {
using apollo::common::ErrorCode;
using apollo::common::PathPoint;
using apollo::common::SpeedPoint;
using apollo::common::Status;
using apollo::hdmap::HDMap;
using apollo::localization::Pose;
......
......@@ -44,6 +44,7 @@ using common::Status;
using common::adapter::AdapterManager;
using common::time::Clock;
using common::ErrorCode;
using common::SpeedPoint;
using common::TrajectoryPoint;
using common::VehicleState;
......
......@@ -71,7 +71,7 @@ class EMPlanner : public Planner {
private:
void RegisterOptimizers();
std::vector<SpeedPoint> GenerateInitSpeedProfile(const double init_v,
std::vector<common::SpeedPoint> GenerateInitSpeedProfile(const double init_v,
const double init_a);
private:
......
......@@ -9,17 +9,6 @@ import "modules/canbus/proto/chassis.proto";
import "modules/planning/proto/decision.proto";
import "modules/planning/proto/planning_internal.proto";
message SpeedPoint {
optional double s = 1;
optional double t = 2;
// speed (m/s)
optional double v = 3;
// acceleration (m/s^2)
optional double a = 4;
// jerk (m/s^3)
optional double da = 5;
}
// Deprecated: replaced by apollo.common.TrajectoryPoint
message ADCTrajectoryPoint {
optional double x = 1; // in meters.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册