37 namespace prediction {
70 std::vector<Obstacle*> dynamic_env) {
71 return Evaluate(obstacle, obstacles_container);
77 virtual std::string
GetName() = 0;
83 std::pair<double, double> input_world_coord,
84 std::pair<double, double> obj_world_coord,
double obj_world_angle) {
85 double x_diff = input_world_coord.first - obj_world_coord.first;
86 double y_diff = input_world_coord.second - obj_world_coord.second;
87 double rho = std::sqrt(x_diff * x_diff + y_diff * y_diff);
88 double theta = std::atan2(y_diff, x_diff) - obj_world_angle;
94 double obj_world_angle) {
99 const int start_index,
const int end_index) {
100 CHECK_LT(start_index, end_index);
101 CHECK_GE(start_index, 0);
102 CHECK_LE(end_index, static_cast<int>(nums.size()));
103 Eigen::MatrixXf output_matrix;
104 output_matrix.resize(1, end_index - start_index);
105 for (
int i = start_index; i < end_index; ++i) {
106 output_matrix(0, i - start_index) =
static_cast<float>(nums[i]);
108 return output_matrix;
112 const int start_index,
const int end_index,
113 const int output_num_row,
114 const int output_num_col) {
115 CHECK_LT(start_index, end_index);
116 CHECK_GE(start_index, 0);
117 CHECK_LE(end_index, static_cast<int>(nums.size()));
118 CHECK_EQ(end_index - start_index, output_num_row * output_num_col);
119 Eigen::MatrixXf output_matrix;
120 output_matrix.resize(output_num_row, output_num_col);
121 int input_index = start_index;
122 for (
int i = 0; i < output_num_row; ++i) {
123 for (
int j = 0; j < output_num_col; ++j) {
124 output_matrix(i, j) =
static_cast<float>(nums[input_index]);
128 CHECK_EQ(input_index, end_index);
129 return output_matrix;
Prediction obstacle.
Definition: obstacle.h:52
ObstacleConf::EvaluatorType evaluator_type_
Definition: evaluator.h:133
Definition: obstacles_container.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
double NormalizeAngle(const double angle)
Normalize angle to [-PI, PI).
Eigen::MatrixXf VectorToMatrixXf(const std::vector< double > &nums, const int start_index, const int end_index, const int output_num_row, const int output_num_col)
Definition: evaluator.h:111
Evaluator()=default
Constructor.
virtual std::string GetName()=0
Get the name of evaluator.
virtual bool Evaluate(Obstacle *obstacle, ObstaclesContainer *obstacles_container)=0
Evaluate an obstacle.
virtual ~Evaluator()=default
Destructor.
double WorldAngleToObjAngle(double input_world_angle, double obj_world_angle)
Definition: evaluator.h:93
virtual bool Evaluate(Obstacle *obstacle, ObstaclesContainer *obstacles_container, std::vector< Obstacle *> dynamic_env)
Evaluate an obstacle.
Definition: evaluator.h:68
Eigen::MatrixXf VectorToMatrixXf(const std::vector< double > &nums, const int start_index, const int end_index)
Definition: evaluator.h:98
Definition: evaluator.h:39
std::pair< double, double > WorldCoordToObjCoord(std::pair< double, double > input_world_coord, std::pair< double, double > obj_world_coord, double obj_world_angle)
Definition: evaluator.h:82