Skip to content

Commit 4dca954

Browse files
committed
clean up calculate cost function
1 parent 66b3f26 commit 4dca954

2 files changed

Lines changed: 0 additions & 36 deletions

File tree

src/software/ai/navigator/trajectory/trajectory_planner.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -162,31 +162,3 @@ TrajectoryPathWithCost TrajectoryPlanner::getTrajectoryWithCost(
162162
return traj_with_cost;
163163
}
164164

165-
double TrajectoryPlanner::calculateCost(
166-
const TrajectoryPathWithCost &traj_with_cost) const
167-
{
168-
double total_cost = traj_with_cost.traj_path.getTotalTime();
169-
170-
// Add a large cost if the trajectory collides with an obstacle
171-
// Note that this ignores collisions that may be in at the
172-
// start of the trajectory as those are unavoidable by all trajectories.
173-
if (traj_with_cost.colliding_obstacle != nullptr)
174-
{
175-
total_cost += 6.0;
176-
}
177-
178-
// The closer the collision is to the destination, the lower its cost will be
179-
Point first_collision_position =
180-
traj_with_cost.traj_path.getPosition(traj_with_cost.first_collision_time_s);
181-
Point destination = traj_with_cost.traj_path.getDestination();
182-
total_cost += (first_collision_position - destination).length();
183-
184-
total_cost += std::max(
185-
0.0, (MAX_FUTURE_COLLISION_CHECK_SEC - traj_with_cost.first_collision_time_s));
186-
187-
total_cost += 3 * traj_with_cost.collision_duration_front_s;
188-
189-
total_cost += 1 * traj_with_cost.collision_duration_back_s;
190-
191-
return total_cost;
192-
}

src/software/ai/navigator/trajectory/trajectory_planner.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ class TrajectoryPlanner
3535
const std::optional<Point> &prev_sub_destination = std::nullopt);
3636

3737
private:
38-
/**
39-
* Calculate the cost of the given trajectory path with cost
40-
*
41-
* @param traj_with_cost A complete trajectory path with cost
42-
* @return The cost of the trajectory
43-
*/
44-
double calculateCost(const TrajectoryPathWithCost &traj_with_cost) const;
45-
4638
/**
4739
* Get a single trajectory with cost that goes directly from the start to the
4840
* destination.

0 commit comments

Comments
 (0)