fix(crane_geometry): getSeparatedPointsが線分長を無視する不具合を修正 - #1377
Open
HansRobo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
crane_geometryのgetSeparatedPointsが線分の長さを無視して分割点を生成していた不具合を修正します。問題
geometry_operations.hppのgetSeparatedPointsは、線分を等分する内部分割点を返すユーティリティです。しかし方向ベクトルをnormalized()で単位ベクトル化していたため、実際の線分長が失われ、生成される点が始点から最大1m弱の範囲に密集していました。goalie.cpp:272のforward_line(守備位置から前進ラインを20分割する用途)のような長い線分では、本来期待される「線分を区間分割した点列」として機能していませんでした。加えて、除数が
separated_num + 1、反復回数がseparated_num - 1と不整合(off-by-one)であり、分割点の個数も意図と合っていませんでした。原因
線分方向ベクトルを
normalized()で単位化したことにより区間長が消失し、内分計算で線分長が反映されない状態になっていました。また反復範囲と除数が一致していませんでした。修正内容
segment.second - segment.firstを使用するよう変更。first + (second - first) * i / (separated_num + 1)(i = 1 .. separated_num)として生成し、線分を等分する内部分割点が正しい位置・個数で得られるよう修正。normalized()問題も解消されます。検証
colcon build(--no-rdeps)によりコンパイルが成功することを確認(Build complete.、failed/Error なし)。crane_geometryのユニットテストを実行し、全テストが成功(23 tests, 0 errors, 0 failures, 0 skipped)。goalie.cpp:272(getSeparatedPoints(forward_line, 20))は分割点列を始点側から終点側へ走査して到達可能な前進守備位置を選定する用途であり、本修正で線分全長にわたる分割点が得られるようになることで、期待される挙動に整合します。レビュー観点
goalie.cpp:272の前進ライン分割用途における期待と整合しているかをご確認ください。本PRはソースコード監査ワークフローで検出・敵対的検証されたバグに対する単一修正です。