71 std::vector<Obstacle*> dynamic_env) {
72 return Evaluate(obstacle, obstacles_container);
84 return Evaluate(obstacle, obstacles_container);
95 std::pair<double, double> input_world_coord,
96 std::pair<double, double> obj_world_coord,
double obj_world_angle) {
97 double x_diff = input_world_coord.first - obj_world_coord.first;
98 double y_diff = input_world_coord.second - obj_world_coord.second;
99 double rho = std::sqrt(x_diff * x_diff + y_diff * y_diff);
100 double theta = std::atan2(y_diff, x_diff) - obj_world_angle;
102 return std::make_pair(std::cos(theta) * rho, std::sin(theta) * rho);
106 std::pair<double, double> input_world_coord,
107 std::pair<double, double> obj_world_coord,
double obj_world_angle) {
108 double x_diff = input_world_coord.first - obj_world_coord.first;
109 double y_diff = input_world_coord.second - obj_world_coord.second;
110 double theta = M_PI / 2 - obj_world_angle;
111 double x = std::cos(theta) * x_diff - std::sin(theta) * y_diff;
112 double y = std::sin(theta) * x_diff + std::cos(theta) * y_diff;
113 return std::make_pair(x, y);
117 double obj_world_angle) {
122 const int start_index,
const int end_index) {
123 CHECK_LT(start_index, end_index);
124 CHECK_GE(start_index, 0);
125 CHECK_LE(end_index,
static_cast<int>(nums.size()));
126 Eigen::MatrixXf output_matrix;
127 output_matrix.resize(1, end_index - start_index);
128 for (
int i = start_index; i < end_index; ++i) {
129 output_matrix(0, i - start_index) =
static_cast<float>(nums[i]);
131 return output_matrix;
135 const int start_index,
const int end_index,
136 const int output_num_row,
137 const int output_num_col) {
138 CHECK_LT(start_index, end_index);
139 CHECK_GE(start_index, 0);
140 CHECK_LE(end_index,
static_cast<int>(nums.size()));
141 CHECK_EQ(end_index - start_index, output_num_row * output_num_col);
142 Eigen::MatrixXf output_matrix;
143 output_matrix.resize(output_num_row, output_num_col);
144 int input_index = start_index;
145 for (
int i = 0; i < output_num_row; ++i) {
146 for (
int j = 0; j < output_num_col; ++j) {
147 output_matrix(i, j) =
static_cast<float>(nums[input_index]);
151 CHECK_EQ(input_index, end_index);
152 return output_matrix;
double WorldAngleToObjAngle(double input_world_angle, double obj_world_angle)
virtual bool Evaluate(Obstacle *obstacle, ObstaclesContainer *obstacles_container, std::vector< Obstacle * > dynamic_env)
Evaluate an obstacle
virtual bool Evaluate(Obstacle *obstacle, ObstaclesContainer *obstacles_container)=0
Evaluate an obstacle
Eigen::MatrixXf VectorToMatrixXf(const std::vector< double > &nums, const int start_index, const int end_index)
virtual bool Evaluate(const ADCTrajectoryContainer *adc_trajectory_container, Obstacle *obstacle, ObstaclesContainer *obstacles_container)
Evaluate an obstacle
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)
std::pair< double, double > WorldCoordToObjCoord(std::pair< double, double > input_world_coord, std::pair< double, double > obj_world_coord, double obj_world_angle)
Evaluator()=default
Constructor
ObstacleConf::EvaluatorType evaluator_type_
std::pair< double, double > WorldCoordToObjCoordNorth(std::pair< double, double > input_world_coord, std::pair< double, double > obj_world_coord, double obj_world_angle)
virtual ~Evaluator()=default
Destructor
virtual std::string GetName()=0
Get the name of evaluator
double NormalizeAngle(const double angle)
Normalize angle to [-PI, PI).