LiJiangnanBit / path_optimizer

Optimization-based real-time path planning for vehicles.
MIT License
503 stars 138 forks source link

为什么用用作者你的算法,进行优化以后,曲率变化和横摆角角度变化不一致。 #30

Open james1kobby opened 2 weeks ago

james1kobby commented 2 weeks ago

FRENET

而且横摆角变化不应该会有毛刺呀,

注意:这里的横摆角度是指的车辆的朝向角

james1kobby commented 2 weeks ago
const double weight_l =      0.00002;
const double weight_kappa =  370000;
const double weight_dkappa = 860000000;
const double weight_slack = 150; 

并且是采用 DEFINE_double(output_spacing, 0.5, "output interval");

DEFINE_double(epsilon, 1e-6, "use this when comparing double");

DEFINE_bool(enable_dynamic_segmentation, false, "dense segmentation when the curvature is large.");

DEFINE_bool(rough_constraints_far_away, true, "Use rough collision constraints after some distance, controlled by precise_planning_length");

DEFINE_double(precise_planning_length, 50, "More strict collision constraint.");

还请大佬告知,应该怎么调整参数才能将横摆角度的毛刺去掉

LiJiangnanBit commented 1 week ago

这个横摆角是度的path点的角度,画图的吗?可以贴一下相关代码不,另外优化的结果可视化也贴一下吧

james1kobby commented 1 week ago

捕获1 捕获2 捕获3

1.这是主要的优化程序,然后我没有用B样条进行拟合, TensionSmoother::osqpSmooth这个优化也没有进行,主要是起到一个赋值和数据传递的作用。

bool TensionSmoother::osqpSmooth(const std::vector &x_list, const std::vector &y_list, const std::vector &angle_list, const std::vector &k_list, const std::vector &s_list, std::vector result_x_list, std::vector result_y_list, std::vector *result_s_list) { auto point_num = x_list.size();

//直接在这里给输入赋值给输出
    // Ensure the result vectors have the correct size
result_x_list->resize(x_list.size());
result_y_list->resize(y_list.size());
result_s_list->resize(s_list.size());

// Use std::copy for high-performance assignment
std::copy(x_list.begin(), x_list.end(), result_x_list->begin());
std::copy(y_list.begin(), y_list.end(), result_y_list->begin());
std::copy(s_list.begin(), s_list.end(), result_s_list->begin());

// Return true to indicate success (assuming that is the intended behavior)
return true;

}

2.并且getSoftBounds()这里我是直接用的固定值

std::pair<double, double> BaseSolver::getSoftBounds() const { // const auto clearance = ub - lb; // static const auto min_clearance = 0.1; // auto remain_clearance = std::max(min_clearance, clearance - 2 * safety_margin); // auto shrink = std::max(0.0, (clearance - remain_clearance) / 2.0); // return std::make_pair(lb + shrink, ub - shrink); double tem1 =-0.7; double tem2 = 0.7; return std::make_pair(tem1, tem2); } 3.最后,其他的函数都没进行改动,相关参数,上面已经给出了

james1kobby commented 1 week ago

这个横摆角是度的path点的角度,画图的吗?可以贴一下相关代码不,另外优化的结果可视化也贴一下吧

是的,这个是横摆角是按照度来画图的

james1kobby commented 1 week ago

这个横摆角是度的path点的角度,画图的吗?可以贴一下相关代码不,另外优化的结果可视化也贴一下吧

是不是,这个代码最后优化完成以后,要进行插值处理

LiJiangnanBit commented 2 days ago

@james1kobby 看看能不能把修改后的代码直接发一份过来,因为得需要复现这个问题,才能找到原因,可以邮件联系lijiangnan_bit@163.com

james1kobby commented 2 days ago

@james1kobby 看看能不能把修改后的代码直接发一份过来,因为得需要复现这个问题,才能找到原因,可以邮件联系lijiangnan_bit@163.com

可以呀,马上把代码发给你。