本文整理汇总了C++中Trajectory::EditStation方法的典型用法代码示例。如果您正苦于以下问题:C++ Trajectory::EditStation方法的具体用法?C++ Trajectory::EditStation怎么用?C++ Trajectory::EditStation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trajectory
的用法示例。
在下文中一共展示了Trajectory::EditStation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeCost
void PlanningProblem::computeCost(Trajectory &plan_)
{
if(!this->checkPlanValidity(plan_)) {
plan_.cost.safety = INFINITY;
plan_.cost.smoothness = INFINITY;
plan_.cost.length = INFINITY;
}
else {
plan_.computeCost();
plan_.cost.safety = 0;
ObstacleSet desired_ob_set = stat_obstacles;
for(int i=0; i< plan_.length(); i++) {
Station st = plan_.getStation(i);
float min_dist = INFINITY;
b2Vec2 tmpv1, tmpv2;
for(int j=0; j<desired_ob_set.size(); j++) {
Obstacle* ob = desired_ob_set[j];
float dist_ = distToObstacle(st, *ob, tmpv1, tmpv2);
min_dist = min(min_dist, dist_);
}
st.cost.min_dist_to_obs = min_dist;
plan_.EditStation(i, st);
plan_.cost.safety += plan_.getStation(i).cost.safety_penalty() / plan_.length();
}
}
}
示例2: replan
bool PlanningProblem::replan(const ObstacleSet &ob_set, Trajectory &trajec)
{
if(trajec.length() < 2)
return false;
Vector2D goals_diff = (goal.goal_point.getPosition() - trajec.getLastStation().getPosition()).to2D();
if(goals_diff.lenght() > agent->radius())
return false;
Vector2D inits_dist = (initialState.getPosition() - trajec.getFirstStation().getPosition()).to2D();
if(inits_dist.lenght() > agent->radius())
return false;
trajec.EditStation(0, initialState);
trajec.EditStation(trajec.length() -1, goal.goal_point);
return true;
}