30 const Box2d& bounding_box,
31 const std::vector<std::vector<common::math::LineSegment2d>>
32 obstacles_linesegments_vec) {
33 for (
const auto& obstacle_linesegments : obstacles_linesegments_vec) {
35 obstacle_linesegments) {
37 ADEBUG <<
"collision start at x: " << linesegment.start().x();
38 ADEBUG <<
"collision start at y: " << linesegment.start().y();
39 ADEBUG <<
"collision end at x: " << linesegment.end().x();
40 ADEBUG <<
"collision end at y: " << linesegment.end().y();
49 const std::vector<std::vector<common::math::LineSegment2d>>
50 obstacles_linesegments_vec,
51 const std::vector<std::pair<double, double>>& result,
52 std::vector<std::vector<Vec2d>>& box_vec) {
54 double shift_distance = vehicle_param.
length() / 2.0 -
55 vehicle_param.back_edge_to_center();
56 double init_length = vehicle_param.length();
57 double init_width = vehicle_param.width();
61 for (
int i = 0; i < result.size() - 1; i++) {
62 double x = result[i].first;
63 double y = result[i].second;
64 double x_next = result[i + 1].first;
65 double y_next = result[i + 1].second;
66 double heading = std::atan2(y_next - y, x_next - x);
67 AINFO <<
"init pos: " << x <<
" " << y;
70 Box2d box({x, y}, heading, init_length, init_width);
71 for (
int j = 1; j < 10; j++) {
73 box, obstacles_linesegments_vec))
75 box =
Box2d({x, y}, heading, init_length + j * 0.2, init_width + j * 0.2);
78 box_vec.push_back(corners);
83 ADEBUG <<
"corners 1: " << corners[0].x() <<
" " << corners[0].y();
84 ADEBUG <<
"corners 2: " << corners[1].x() <<
" " << corners[1].y();
85 ADEBUG <<
"corners 3: " << corners[2].x() <<
" " << corners[2].y();
86 ADEBUG <<
"corners 4: " << corners[3].x() <<
" " << corners[3].y();
static void GeneratePointBox(const std::vector< std::vector< common::math::LineSegment2d > > obstacles_linesegments_vec, const std::vector< std::pair< double, double > > &result, std::vector< std::vector< common::math::Vec2d > > &box_vec)
check if box collision with obstacles