@@ -406,7 +406,28 @@ auto WorldModelWrapper::getMinMaxSlackInterceptPointAndSlackTime(
406
406
const double max_acc, const double max_vel, double distance_horizon)
407
407
-> std::pair<std::optional<std::pair<Point, double>>, std::optional<std ::pair<Point, double>>>
408
408
{
409
- auto ball_sequence = getBallSequence (t_horizon, t_step, ball.pos , ball.vel );
409
+ std::vector<double > t_ball_sequence = generateSequence (0.0 , t_horizon, t_step);
410
+ std::vector<std::pair<Point, double >> ball_sequence;
411
+ {
412
+ std::optional<Point> intercepted_point = std::nullopt;
413
+ for (auto t_ball : t_ball_sequence) {
414
+ if (auto p_ball = getFutureBallPosition (ball.pos , ball.vel , t_ball); p_ball.has_value ()) {
415
+ auto [nearest_friend, friend_dist] =
416
+ getNearestRobotWithDistanceFromPoint (p_ball.value (), ours.getAvailableRobots ());
417
+ auto [nearest_enemy, enemy_dist] =
418
+ getNearestRobotWithDistanceFromPoint (p_ball.value (), theirs.getAvailableRobots ());
419
+ if (not intercepted_point and (friend_dist < 0.2 or enemy_dist < 0.2 )) {
420
+ intercepted_point = p_ball.value ();
421
+ }
422
+
423
+ if (intercepted_point) {
424
+ ball_sequence.push_back ({intercepted_point.value (), t_ball});
425
+ } else {
426
+ ball_sequence.push_back ({p_ball.value (), t_ball});
427
+ }
428
+ }
429
+ }
430
+ }
410
431
// ボールの位置とスラックタイムをペアにして計算
411
432
auto slack_times = ball_sequence
412
433
// distance_horizon以内のボールのみを抽出
0 commit comments