1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

自動運転AIチャレンジでローカルプランニングを自作する 3

Posted at

今回の概要

前回の続きです.

今回は,前回実装したFrenet Frameをaichallenge2023-simに組み込んでみた結果を見せたいと思います!

結果

調子が良いときは,障害物が避けられます.

実際にコードを提出してみると,結果はこんな感じでした.
Screenshot from 2023-08-31 21-01-37.png

試行によってかなりばらつきが大きく,手元で実行しても,この点数に行くことは少ないため,ちょっと運が良かったのかなと思います😅

ちょっとした工夫点

車が障害物に近づきすぎると,障害物が見えなくなってしまうという問題がありました.Lidarの取り付け位置の関係から,近すぎると見えないのかもしれません.そこで,工夫として,前回観測したオブジェクトが,現在の自己位置に近すぎる場合,現在の障害物に,前回の障害物を加える処理をしました.

def update_object(prev_objs, cur_objs, cur_pos):
    prev_obj_xs, prev_obj_ys = prev_objs
    cur_obj_xs, cur_obj_ys = cur_objs
    cur_pos_x, cur_pos_y = cur_pos

    for prev_obj_x, prev_obj_y in zip(prev_obj_xs, prev_obj_ys):
        if np.hypot(cur_pos_x - prev_obj_x, cur_pos_y - prev_obj_y) < 5.0:
            print("update object")
            cur_obj_xs.append(prev_obj_x)
            cur_obj_ys.append(prev_obj_y)
    

    return cur_obj_xs, cur_obj_ys

また,障害物リストの中に,同じ障害物が入っている場合は,それを取り除く処理を実装しました.

def remove_duplicate_objects(obj_xs: List[float], obj_ys: List[float]):
    # Initialize lists to store unique object coordinates
    unique_xs = []
    unique_ys = []
    
    for x, y in zip(obj_xs, obj_ys):
        is_unique = True
        # Calculate distances using numpy hypot function
        distances = np.hypot(np.array(unique_xs) - x, np.array(unique_ys) - y)
        
        # Check if the object is close to an existing unique object
        if np.any(distances < 1.0):
            is_unique = False

        if is_unique:
            unique_xs.append(x)
            unique_ys.append(y)
    
    return unique_xs, unique_ys

あとは,地道なパラメータチューニングです!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?