CHH3213 / chhRobotics_CPP

自动驾驶规划控制常用算法c++代码实现
657 stars 211 forks source link

Dijkstra #2

Closed kun1224 closed 4 months ago

kun1224 commented 8 months ago
  1. Dijkstra和Astar
    /**
    * 计算栅格索引
    * @param node
    * @return
    */
    double Astar::calIndex(Astar::Node *node)
    {
    // cout<<node->x<<","<<node->y<<endl;
    return (node->y - min_y) * x_width + (node->x - min_x);
    }

    是不是应该修改成 return node->y * x_width + node->x;

CHH3213 commented 8 months ago
  1. Dijkstra和Astar
/**
 * 计算栅格索引
 * @param node
 * @return
 */
double Astar::calIndex(Astar::Node *node)
{
    // cout<<node->x<<","<<node->y<<endl;
    return (node->y - min_y) * x_width + (node->x - min_x);
}

是不是应该修改成 return node->y * x_width + node->x;

maybe it's not necessry? I think the code is ok.. By the way, we just want to transfer node to index, actually we can use any way to make it as long as it works, not just a only way.

kun1224 commented 8 months ago

yeah, I konw this fuction just calculate index as the key of open and closed map . but this way can easily let learner konw its meaning. For example, I try to understand why node->y can minus min_y

CHH3213 commented 8 months ago

yeah, I konw this fuction just calculate index as the key of open and closed map . but this way can easily let learner konw its meaning. For example, I try to understand why node->y can minus min_y

emm, maybe it's not complicated, why here minus min_y is because we always based on the minimum position to define.