Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/lane pose calculation #1192

Merged
merged 293 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
293 commits
Select commit Hold shift + click to select a range
69a6110
Merge pull request #11 from hakuturu583/test/release-action
hakuturu583 Dec 5, 2023
88bf7a7
bump version of scenario_simulator_v2.
actions-user Dec 5, 2023
aacece8
enable testing new release action
hakuturu583 Dec 8, 2023
5c9a05e
Merge remote-tracking branch 'test/master' into feature/new_release
hakuturu583 Dec 8, 2023
f547c89
remove unused function
hakuturu583 Dec 8, 2023
f6d5295
Merge pull request #1 from merge-queue-testing/feature/new_release
hakuturu583 Dec 8, 2023
e399681
Merge remote-tracking branch 'test/master' into feature/new_release
hakuturu583 Dec 8, 2023
05d0cc6
modify release
hakuturu583 Dec 8, 2023
df30739
Merge pull request #2 from merge-queue-testing/feature/new_release
hakuturu583 Dec 8, 2023
3e969cd
modify trigger
hakuturu583 Dec 8, 2023
b8f61b6
Merge pull request #3 from merge-queue-testing/feature/new_release
hakuturu583 Dec 8, 2023
095e4fd
add workflow dispatch event
hakuturu583 Dec 12, 2023
0f03934
Merge pull request #5 from merge-queue-testing/feature/new_release
hakuturu583 Dec 12, 2023
a7771a2
remove workflow-dispatch
hakuturu583 Dec 12, 2023
da5b42c
Merge pull request #6 from hakuturu583/feature/new_release
hakuturu583 Dec 12, 2023
d180af6
add empty file (test commit)
hakuturu583 Dec 12, 2023
f7bc0a6
Merge pull request #7 from hakuturu583/feature/new_release
hakuturu583 Dec 12, 2023
83fcfe8
update CHANGELOG
hakuturu583 Dec 14, 2023
d7c93ba
add save labels as cache action
hakuturu583 Jan 18, 2024
f4b3afe
remove hoge.txt
hakuturu583 Jan 18, 2024
3c75bbf
Merge pull request #9 from merge-queue-testing/feature/bump_version_a…
hakuturu583 Jan 18, 2024
ca5f548
add trigger
hakuturu583 Jan 18, 2024
3087380
empty commit
hakuturu583 Jan 18, 2024
7a39b9e
configure trigger
hakuturu583 Jan 18, 2024
aaa4726
Update SaveLabelAsCache.yaml
hakuturu583 Jan 18, 2024
9cbb065
empty commit
hakuturu583 Jan 18, 2024
b728068
use sha hash
hakuturu583 Jan 18, 2024
11278f2
use git command
hakuturu583 Jan 18, 2024
63f0a93
add get restore key step
hakuturu583 Jan 18, 2024
ed4c0fd
use GITHUB_OUTPUT
hakuturu583 Jan 18, 2024
20296e3
remove ref in checkout
hakuturu583 Jan 18, 2024
f6ca358
use head commit
hakuturu583 Jan 18, 2024
98bcabd
fix workflow
hakuturu583 Jan 18, 2024
78be9be
add debug step
hakuturu583 Jan 18, 2024
06c8c35
update release action
hakuturu583 Jan 18, 2024
00f112d
fix input text
hakuturu583 Jan 18, 2024
59f5eb1
add debug step
hakuturu583 Jan 18, 2024
90139d7
add debug
hakuturu583 Jan 18, 2024
80ee6ee
update debug step
hakuturu583 Jan 18, 2024
a8371a5
update Release workflow
hakuturu583 Jan 18, 2024
f12546e
fix workflow
hakuturu583 Jan 18, 2024
1220a31
add debug line
hakuturu583 Jan 18, 2024
d1693a5
configure cache step
hakuturu583 Jan 18, 2024
1e553f3
save-always
hakuturu583 Jan 18, 2024
9b39982
add clear step
hakuturu583 Jan 18, 2024
9bb5e60
add env
hakuturu583 Jan 18, 2024
92252a0
add checkout step
hakuturu583 Jan 18, 2024
50541fc
change token
hakuturu583 Jan 18, 2024
198a353
update release action
hakuturu583 Jan 18, 2024
0f1a87a
modify trigger
hakuturu583 Jan 18, 2024
0d1fbbb
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 18, 2024
cba41eb
remove origin
hakuturu583 Jan 18, 2024
8a40408
add tmate
hakuturu583 Jan 18, 2024
59050fa
add if
hakuturu583 Jan 18, 2024
87734b6
use pull
hakuturu583 Jan 18, 2024
a779512
comment out tmate
hakuturu583 Jan 18, 2024
201f802
add checkout step
hakuturu583 Jan 19, 2024
eac6eb1
update Release action
hakuturu583 Jan 19, 2024
4e4b94e
specify version
hakuturu583 Jan 19, 2024
1b93053
fix typo
hakuturu583 Jan 19, 2024
e8d285d
fix changelog
hakuturu583 Jan 19, 2024
6c4d42f
add debug line
hakuturu583 Jan 19, 2024
ed4f8c1
add if
hakuturu583 Jan 19, 2024
f9a3538
fix typo
hakuturu583 Jan 19, 2024
421a3b4
remove debug step
hakuturu583 Jan 19, 2024
16a6e9b
add push step
hakuturu583 Jan 19, 2024
d36b4c1
specify version
hakuturu583 Jan 19, 2024
790715c
add merge step
hakuturu583 Jan 19, 2024
92c2139
modify branch
hakuturu583 Jan 19, 2024
c5e6c87
add token
hakuturu583 Jan 19, 2024
d817f0e
use action
hakuturu583 Jan 19, 2024
d9563dc
modify permission
hakuturu583 Jan 19, 2024
9286a83
modify commit changes step
hakuturu583 Jan 19, 2024
c425215
change version
hakuturu583 Jan 19, 2024
65c86eb
add if step
hakuturu583 Jan 19, 2024
406aff0
modifty checkout branch
hakuturu583 Jan 19, 2024
cf36574
modify release trigger
hakuturu583 Jan 22, 2024
721c281
add CheckBranchUpToDate action
hakuturu583 Jan 22, 2024
55d6aa1
fix action
hakuturu583 Jan 22, 2024
84eb94e
update actions for release
hakuturu583 Jan 22, 2024
6b20e4d
use bash action
hakuturu583 Jan 22, 2024
9491881
add checkout step
hakuturu583 Jan 22, 2024
20062f6
Merge pull request #10 from merge-queue-testing/feature/bump_version_…
hakuturu583 Jan 22, 2024
3dccb94
use force push
hakuturu583 Jan 22, 2024
0aaa0e6
update commit message
hakuturu583 Jan 22, 2024
5979afe
Merge branch 'master' of https://github.com/hakuturu583/scenario_simu…
hakuturu583 Jan 22, 2024
c043088
Merge pull request #11 from merge-queue-testing/feature/bump_version_…
hakuturu583 Jan 22, 2024
f29ed2e
use CasperWA/push-protected@v2
hakuturu583 Jan 22, 2024
5b66472
add white line at EoF
hakuturu583 Jan 22, 2024
2c85a35
Merge pull request #12 from merge-queue-testing/feature/bump_version_…
hakuturu583 Jan 22, 2024
77d26ed
[Bot] Bump version of scenario_simulator_v2 to version 0.8.1
hakuturu583 Jan 22, 2024
798b55a
update Release Action
hakuturu583 Jan 22, 2024
e46b369
add if
hakuturu583 Jan 22, 2024
93d5abf
Merge pull request #13 from merge-queue-testing/feature/bump_version_…
hakuturu583 Jan 22, 2024
b403b04
fix version
hakuturu583 Jan 22, 2024
836f00e
change push target branch
hakuturu583 Jan 22, 2024
2bec457
fix release action
hakuturu583 Jan 23, 2024
377605b
fix release action
hakuturu583 Jan 23, 2024
3700e86
Merge pull request #15 from merge-queue-testing/fix/release
hakuturu583 Jan 23, 2024
7349744
configure trigger
hakuturu583 Jan 23, 2024
4c41d73
empty commit
hakuturu583 Jan 23, 2024
4a3a555
Merge pull request #16 from merge-queue-testing/fix/release
hakuturu583 Jan 23, 2024
7e92f3d
Bump version of scenario_simulator_v2 to version 0.8.1
actions-user Jan 23, 2024
7a45217
add conculency and modify commit message
hakuturu583 Jan 23, 2024
d894d59
fix trigger
hakuturu583 Jan 23, 2024
67decd9
modify trigger
hakuturu583 Jan 23, 2024
e3db5d2
fix trigger
hakuturu583 Jan 23, 2024
881140c
empty commit
hakuturu583 Jan 23, 2024
27c4aa0
fix git setting
hakuturu583 Jan 23, 2024
ed86728
Merge remote-tracking branch 'test/master' into fix/release
hakuturu583 Jan 23, 2024
a79be9f
fix version
hakuturu583 Jan 23, 2024
4a6cbff
Merge pull request #17 from merge-queue-testing/fix/release
hakuturu583 Jan 23, 2024
6ba93dc
Bump version of scenario_simulator_v2 from version 0.8.0 to version 0…
actions-user Jan 23, 2024
04f0211
simplify action
hakuturu583 Jan 23, 2024
db01356
Merge remote-tracking branch 'test/master' into feature/simplify_action
hakuturu583 Jan 23, 2024
afe840b
fix changelog
hakuturu583 Jan 23, 2024
f3d2fe1
fix CHANGELOG
hakuturu583 Jan 23, 2024
51d7343
fix working directory
hakuturu583 Jan 23, 2024
e8caaf8
Merge pull request #18 from merge-queue-testing/feature/simplify_action
hakuturu583 Jan 23, 2024
b65be98
fix release action
hakuturu583 Jan 23, 2024
29032f9
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 23, 2024
75c9c2e
enable delete automatically
hakuturu583 Jan 23, 2024
68c5e7b
add restore branch step
hakuturu583 Jan 23, 2024
ed5f335
Merge pull request #19 from merge-queue-testing/feature/delete_branch
hakuturu583 Jan 23, 2024
014afbf
add force = true
hakuturu583 Jan 23, 2024
1022bd3
Merge pull request #20 from merge-queue-testing/fix/push_action
hakuturu583 Jan 23, 2024
dedbc6b
add delete step
hakuturu583 Jan 23, 2024
c0b3db2
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 23, 2024
af009f5
fix action
hakuturu583 Jan 23, 2024
84ea75a
Merge pull request #21 from merge-queue-testing/fix/push_action
hakuturu583 Jan 24, 2024
dde8c62
use admin token in push
hakuturu583 Jan 24, 2024
f3d8e45
Merge pull request #22 from merge-queue-testing/feature/use_admin_token
hakuturu583 Jan 24, 2024
92e50ed
Bump version of scenario_simulator_v2 from version 0.8.0 to version 0…
actions-user Jan 24, 2024
dcea219
restore branch
hakuturu583 Jan 24, 2024
730fe36
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 24, 2024
618eee9
Merge pull request #23 from merge-queue-testing/feature/restore_barnch
hakuturu583 Jan 24, 2024
c9f197d
Bump version of scenario_simulator_v2 from version 0.8.1 to version 0…
actions-user Jan 24, 2024
3be7055
enable create release
hakuturu583 Jan 24, 2024
0bb6e0d
Merge pull request #24 from merge-queue-testing/feature/create_release
hakuturu583 Jan 24, 2024
a1aa2d2
Bump version of scenario_simulator_v2 from version 0.8.2 to version 0…
actions-user Jan 24, 2024
13d1209
add debug step
hakuturu583 Jan 24, 2024
2fe0deb
update pluu request template
hakuturu583 Jan 24, 2024
6e53b38
add post check list action
hakuturu583 Jan 24, 2024
4ab47bf
modify action
hakuturu583 Jan 24, 2024
d03a358
fix typo
hakuturu583 Jan 24, 2024
3d01a94
fix debug
hakuturu583 Jan 24, 2024
ff6a353
modify permission
hakuturu583 Jan 24, 2024
ece4574
add permission
hakuturu583 Jan 24, 2024
c21ad94
change action
hakuturu583 Jan 24, 2024
5f0460b
add body
hakuturu583 Jan 24, 2024
683078c
update debug
hakuturu583 Jan 24, 2024
2eb6590
use ExternalIssueRef:
hakuturu583 Jan 24, 2024
7e0c9f7
change action
hakuturu583 Jan 24, 2024
7d67389
use combile action
hakuturu583 Jan 24, 2024
e71e8a2
fix separator
hakuturu583 Jan 24, 2024
9ca3c58
change action version
hakuturu583 Jan 24, 2024
7f3d463
add ${{ }}
hakuturu583 Jan 24, 2024
61985b2
change var name
hakuturu583 Jan 24, 2024
25fa55b
modify debug
hakuturu583 Jan 24, 2024
69649fa
fix release action
hakuturu583 Jan 24, 2024
a7a7b8e
remove last section
hakuturu583 Jan 24, 2024
aa8f595
Merge pull request #25 from merge-queue-testing/feature/create_release
hakuturu583 Jan 24, 2024
2dc9d4b
Bump version of scenario_simulator_v2 from version 0.8.3 to version 0…
actions-user Jan 24, 2024
bad703d
update workflow
hakuturu583 Jan 24, 2024
a7dd103
Merge pull request #27 from merge-queue-testing/fix/release_text
hakuturu583 Jan 24, 2024
350342d
Bump version of scenario_simulator_v2 from version 0.8.4 to version 0…
actions-user Jan 24, 2024
4883f26
fix release workflow
hakuturu583 Jan 24, 2024
40e25ef
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 24, 2024
80d9798
Merge pull request #28 from merge-queue-testing/fix/release_text
hakuturu583 Jan 24, 2024
cdcac59
Bump version of scenario_simulator_v2 from version 0.8.5 to version 0…
actions-user Jan 24, 2024
b72a911
change separator
hakuturu583 Jan 24, 2024
d5ded27
Merge branch 'master' of https://github.com/merge-queue-testing/scena…
hakuturu583 Jan 24, 2024
b6e2b25
Merge pull request #29 from merge-queue-testing/fix/release_text
hakuturu583 Jan 24, 2024
7568c95
Bump version of scenario_simulator_v2 from version 0.8.6 to version 0…
actions-user Jan 24, 2024
ee02aab
update release action
hakuturu583 Jan 24, 2024
fa061a1
use single quatation
hakuturu583 Jan 24, 2024
396478d
update release action
hakuturu583 Jan 24, 2024
5db90b4
remove ${{ }}
hakuturu583 Jan 24, 2024
a80099c
update release action
hakuturu583 Jan 24, 2024
42fee1d
change action
hakuturu583 Jan 24, 2024
5fc67e2
save as text
hakuturu583 Jan 24, 2024
a36808e
add echo
hakuturu583 Jan 24, 2024
21f7f77
modify linked issue section
hakuturu583 Jan 24, 2024
842afda
use echo command
hakuturu583 Jan 24, 2024
4ab0d19
fix description
hakuturu583 Jan 24, 2024
4961af2
add output
hakuturu583 Jan 24, 2024
0b320c8
remove some description
hakuturu583 Jan 24, 2024
6a7aaef
remove cat step
hakuturu583 Jan 24, 2024
e5b50b5
remove output step
hakuturu583 Jan 24, 2024
a830f84
use command output action
hakuturu583 Jan 24, 2024
68d453d
add white line
hakuturu583 Jan 24, 2024
7be74b4
change action order
hakuturu583 Jan 24, 2024
56d7ce2
empty commit
hakuturu583 Jan 24, 2024
917d7b5
change link issue action
hakuturu583 Jan 24, 2024
34ef059
simplify code
hakuturu583 Jan 24, 2024
0bb7029
Merge pull request #30 from merge-queue-testing/fix/release_text
hakuturu583 Jan 24, 2024
06c9ae5
Bump version of scenario_simulator_v2 from version 0.8.7 to version 0…
actions-user Jan 24, 2024
b3cb8f9
update pull request template
hakuturu583 Jan 25, 2024
7f5f956
update issue template
hakuturu583 Jan 25, 2024
b1550f2
fix pull request template
hakuturu583 Jan 25, 2024
6661a8a
remove "please"
hakuturu583 Jan 25, 2024
2cb8135
add continue-on-error: true
hakuturu583 Jan 25, 2024
da9d0d2
Merge pull request #32 from merge-queue-testing/fix/release_text
hakuturu583 Jan 25, 2024
cbec872
Bump version of scenario_simulator_v2 from version 0.8.8 to version 0…
actions-user Jan 25, 2024
29c6c26
add example
hakuturu583 Jan 25, 2024
e0024b9
update template
hakuturu583 Jan 25, 2024
f3b0771
update release note
hakuturu583 Jan 25, 2024
ddcc5be
Merge pull request #33 from merge-queue-testing/fix/release_text
hakuturu583 Jan 25, 2024
320e867
Bump version of scenario_simulator_v2 from version 0.8.9 to version 0…
actions-user Jan 25, 2024
c856590
add auto generate release note
hakuturu583 Jan 25, 2024
4bc9c14
Merge pull request #36 from merge-queue-testing/feature/autogen_relea…
hakuturu583 Jan 25, 2024
05c769f
Bump version of scenario_simulator_v2 from version 0.8.10 to version …
actions-user Jan 25, 2024
1f29cac
remove related pull request field
hakuturu583 Jan 25, 2024
ceb0bc1
add issue section
hakuturu583 Jan 25, 2024
e0d4743
Merge pull request #37 from merge-queue-testing/fix/remove_related_pr
hakuturu583 Jan 25, 2024
b79f89d
Bump version of scenario_simulator_v2 from version 0.8.11 to version …
actions-user Jan 25, 2024
901a792
add docs
hakuturu583 Feb 14, 2024
71c8e3f
Merge remote-tracking branch 'origin/master' into doc/lane_pose_calcu…
hakuturu583 Feb 15, 2024
02ec0ee
remove conflict
hakuturu583 Feb 15, 2024
d913c31
update docs
hakuturu583 Feb 15, 2024
ea9b839
add docs
hakuturu583 Feb 15, 2024
128666d
update document
hakuturu583 Feb 16, 2024
e8a2116
update document
hakuturu583 Feb 16, 2024
26cd60b
update document
hakuturu583 Feb 16, 2024
c74f839
fix to pose
hakuturu583 Feb 16, 2024
4907472
add new document
hakuturu583 Feb 16, 2024
8a28ece
fix typo
hakuturu583 Feb 16, 2024
2600468
fix typo
hakuturu583 Feb 16, 2024
461c5ed
Merge remote-tracking branch 'origin/master' into doc/lane_pose_calcu…
hakuturu583 Feb 16, 2024
b2eba2e
modify link
hakuturu583 Feb 16, 2024
9f43e39
fix CHANGELOG
hakuturu583 Feb 16, 2024
6f0efbc
fix CHANGELOG
hakuturu583 Feb 16, 2024
dc13a09
change example
hakuturu583 Feb 16, 2024
f0de17d
change link
hakuturu583 Feb 16, 2024
1079387
remove unused line
hakuturu583 Feb 16, 2024
2be5ad0
Update docs/developer_guide/lane_pose_calculation/LanePoseCalculation.md
hakuturu583 Feb 19, 2024
585d018
Update docs/developer_guide/lane_pose_calculation/LanePoseCalculation.md
hakuturu583 Feb 19, 2024
5e13a36
Update docs/developer_guide/lane_pose_calculation/LanePoseCalculation.md
hakuturu583 Feb 19, 2024
9a12977
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
435e2ca
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
7264a07
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
df64a91
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
b6cef6d
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
a83d801
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 19, 2024
a182bfe
update document
hakuturu583 Feb 19, 2024
466aedf
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 21, 2024
7da8c25
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 21, 2024
93c0982
Update docs/developer_guide/lane_pose_calculation/Spawn.md
hakuturu583 Feb 21, 2024
929775a
fix docs
hakuturu583 Feb 21, 2024
424c229
Merge branch 'doc/lane_pose_calculation' of https://github.com/tier4/…
hakuturu583 Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_samples/example_detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ This PR fixes how the length of the curve is computed

## References

- [determine-arc-length-of-a-catmull-rom-spline-to-move-at-a-constant-speed](https://gamedev.stackexchange.com/questions/14985/determine-arc-length-of-a-catmull-rom-spline-to-move-at-a-constant-speed)
- This link is an example and is not directly related to this sample.
See also [this document.](https://tier4.github.io/scenario_simulator_v2-docs/)
This link is an example and is not directly related to this sample.

# Destructive Changes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Lane pose calculation when getting longitudinal distance

Attempts to calculate the pose for adjacent lane coordinate systems when measuring longitudinal distance.
The length of the horizontal bar must intersect with the adjacent lanelet, [so it is always 10 m regardless of the entity type.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/entity_manager.cpp#L375C21-L442)

![Get longitudinal distance](../../image/longitudinal_distance.png "Getting longitudinal distance.")

The shorter of the two blue arrows shown in the figure above is the longitudinal distance between entities.
83 changes: 83 additions & 0 deletions docs/developer_guide/lane_pose_calculation/LanePoseCalculation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Lane pose calculation

The calculation method of the lane coordinate system differs from Entity to Entity, and the process of determining which lane to match is complex, including fallback.
In this document, we will show how the pose calculation of the lane coordinate system is performed for each Entity.

There are 3 possible timings when the lane coordinate system is computed for all Entities.
These are the [timing immediately after the spawn of the Entity](Spawn.md), the [timing of the frame update](UpdateFrame.md) and the [timing of the getting longitudinal distance](GetLongitudinalDistance.md)

!!! Note
It is sufficient to check [this document](UpdateFrame.md) and [this section](#lane-coordinate-system-calculation-algorithm-for-a-specific-lane), if you are not a simulator developer but a scenario writer. That is because the distance measurement via condition of the OpenSCENARIO is done after frame update basically.

## Lane coordinate system calculation algorithm for a specific lane

!!! summary
- The calculation of the pose in the lane coordinate system involves two steps: first, filtering by "which lanes can be matched," and then "calculating the pose in the specific lane coordinate system.
- The parameter that most affects the matching results is the length of the horizontal bar. This length depends on the type of entity and the timing of the calculation. If you want to check the length quickly, please check [this section](#quick-guide-to-horizontal-bar-lengths).

### Quick guide to horizontal bar lengths

The unit of the table is meter.

| EntityType \ Timing of calculation | [Spawn](Spawn.md) | [UpdateFrame](UpdateFrame.md) | [Getting longitudinal distance](GetLongitudinalDistance.md) |
| ---------------------------------- | ----------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| EgoEntity | 2.0 | [(tread of the entity) + 2.0](UpdateFrame.md#calculate-pose-in-lane-coordinate-system) | 10 |
| VehicleEntity | 2.0 | N/A | 10 |
| PedestrianEntity | 2.0 | [2.0 or 4.0](UpdateFrame.md#pedestrian-entity-with-behavior-tree) | 10 |
| MiscObject | 2.0 | N/A | 10 |

### Detail of the lane coordinate system calculation algorithm for a specific lane

After the lanes to be matched have been determined, the calculation of the specific lane coordinate system to be performed is always based on a per spline curve and line segment determination.

![Lane pose calculation](../../image/lane_pose_calculation.png "Lane pose calculation.")

The centerline of a lane is expressed by the cubic equation [Catmull-Rom spline.](https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline)
Catmull-Rom spline and line segment are implemented by finding the multiple solution of one cubic equation.
A specific implementation can be found [here](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/common/math/geometry/src/solver/polynomial_solver.cpp#L98-L131) and [here.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/common/math/geometry/src/spline/hermite_curve.cpp#L124-L187)

Let $a_i,b_i,c_i,d_i (i = x, y, z)$ $s = [0,1]$ is a coefficient of the spline.
Then, the spline is a described like below.

$$x(s) = a_xs^3 + b_xs^2 + c_xs + d_x $$

$$y(s) = a_ys^3 + b_ys^2 + c_ys + d_y $$

$$z(s) = a_zs^3 + b_ys^2 + c_zs + d_z $$

When a hit decision with a line segment is performed, only $x(s),y(s)$ of the above equations are considered, since they are performed in two dimensions.

The equation of the line segment is expressed as.
Let $e_i,f_i (i = x, y, z)$ $u = [0,1]$ is a coefficient of the line segment.

$$x(u) = e_xu + f_x $$

$$y(u) = e_yu + f_y $$

$$z(u) = e_zu + f_z $$

When a hit decision with a spline is performed, only $x(u),y(u)$ of the above equations are considered, since they are performed in two dimensions.

To determine the pertinence of a line segment and a spline, find the values of s and u that satisfy the following equations.

$$x(s) = x(u) = a_xs^3 + b_xs^2 + c_xs + d_x = e_xu + f_x$$

$$y(s) = y(u) = a_ys^3 + b_ys^2 + c_ys + d_y = e_yu + f_y$$

If $e_x\neq0$
Perform the equation transformation and eliminate the variable $u$.

$$x(u)\frac{e_f}{e_x} = (e_xu + f_x)\frac{e_f}{e_x} = e_fu +\frac{f_xe_f}{e_x} = x(s)\frac{e_f}{e_x} = (a_xs^3 + b_xs^2 + c_xs + d_x)\frac{e_f}{e_x}$$

$$y(s) - x(u)\frac{e_f}{e_x} = a_ys^3 + b_ys^2 + c_ys + d_y - (a_xs^3 + b_xs^2 + c_xs + d_x)\frac{e_f}{e_x} = e_yu + f_y - (e_xu + f_x)\frac{e_f}{e_x} = f_y - \frac{f_xe_f}{e_x}$$

Therefore, we can perform a hit decision between the Spline curve and the line segment by finding a rational solution of the following cubic equation.

$$(a_y - a_x\frac{e_f}{e_x})s^3 + (b_y - b_x\frac{e_f}{e_x})s^2 + (c_y - c_x\frac{e_f}{e_x})s + d_y - d_x\frac{e_f}{e_x} - f_y + \frac{f_xe_f}{e_x} = 0$$

After getting rational solution $s$, calculate $u$ from the linear function.
If the $s$ and $u$ is in $[0,1]$, Catmull-Rom spline and the line segment are determined to be in conflict.

The value of $S$ obtained in this case is the coordinate $S$ in the lane coordinate system.
Next, the value of $s$ is substituted into the Catmull-Rom spline equation, and the tangent direction at that point is calculated.
The Euler angle is calculated from the difference in orientation between the obtained tangent direction and Entity.
33 changes: 33 additions & 0 deletions docs/developer_guide/lane_pose_calculation/Spawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Lane pose calculation when spawning

If you spawn entities by specifying in the lane coordinate system, lane pose calculation is skipped.
Internally, spawning entities by specifying in the lane coordinate system means specifying LaneletPose as the argument pose of the [API::spawn function](https://tier4.github.io/scenario_simulator_v2-api-docs/classtraffic__simulator_1_1API.html).
In the OpenSCENARIO, it is to execute a TeleportAction by specifying the LanePosition. ([e.g](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/test_runner/scenario_test_runner/))

If you spawn entities by specifying in the map coordinate system, [lane pose calculation](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp#L521-L529) is performed.

There are several internal implementations of pose calculation in the lane coordinate system implemented in the [HDmapUtils class](https://tier4.github.io/scenario_simulator_v2-api-docs/classhdmap__utils_1_1HdMapUtils.html).
The one used in this case is [here](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/src/hdmap_utils/hdmap_utils.cpp#L602-L630).

In this function, the following procedure is used to calculate the pose in the lane coordinate system.

## Search for matching lanes

This procedure falls back to 2 if 1 fails.
If 2 also fails, fallback is performed to 3.
If 3 also fails, fallback is performed to 4.

1. [Obtain candidate lanes for matching considering the bounding box.](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/src/hdmap_utils/hdmap_utils.cpp#L607)
1. [Obtain lanes in the neighborhood of the Entity as matching candidates without considering the bounding box.](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/src/hdmap_utils/hdmap_utils.cpp#L608-L610)
1. [Obtain matching candidates before and after the lane matched by considering the bounding box.](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/src/hdmap_utils/hdmap_utils.cpp#L611-L628)
1. [Obtain matching candidates that exist in close proximity (0.1m) to the Entity.](https://github.com/tier4/scenario_simulator_v2/blob/9f03394f80e5de05cf087db3d00c7be73d27e963/simulation/traffic_simulator/src/hdmap_utils/hdmap_utils.cpp#L629C10-L629C23)

If all cases from 1~4 fail, the pose in the lane coordinate system will be a calculation failure.

## Calculate pose in lane coordinate system

After narrowing down the candidate lanes by the above procedure, the pose of the lane coordinate system is calculated from the coordinates of the intersection of the horizontal bar extended from the Entity and the Catmull-Rom Spline curve constructed from the center line of the lane for each candidate lane.

![Lane pose calculation](../../image/lane_pose_calculation.png "Lane pose calculation.")

In this case, the length of the horizontal bar is `2.0`m.
69 changes: 69 additions & 0 deletions docs/developer_guide/lane_pose_calculation/UpdateFrame.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Lane pose calculation when updating frames

If the entity's behavioral logic is planned in the lane coordinate system, skip this process.

## Ego Entity

Since EgoEntity is controlled in map coordinates by Autoware rather than in lane coordinates using a motion plugin, this process is performed at each frame update.
This process is implemented [here](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/api/api.cpp#L240C9-L240C19) and [here](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L276-L312).

### Search for matching lanes
This process branches off into 2 or 3 depending on the outcome of 1.
If 3 is executed and fails, fallbacks to 4.

1. [Obtain a candidate lane for matching from Autoware planner output.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L276)
2. [If Autoware has no planner output, try obtaining candidate lanes for matching considering the bounding box.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L286-L287)
3. [If Autoware has planner output, try matching considering the Autoware planner output.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L289-L290)
4. [If the step 3 failed, try obtaining candidate lanes for matching considering the bounding box.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L292-L293)

### Calculate pose in lane coordinate system

Let $L_m$ be the length of the horizontal bar used in the lane coordinate system calculation and the tread of the front wheels be $t_f$ and the tread of the rear wheels be $t_r$.
See also [here.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/entity/ego_entity.cpp#L278-L284)

$$L_m = max(t_r, t_f) + 2.0$$

![Lane pose calculation](../../image/lane_pose_calculation.png "Lane pose calculation.")

## Non-Ego Entity

For non-EgoEntity, the process diverges depending on whether planning is done in the lane coordinate system inside BehaviorPlugin.
If planning is done in the lane coordinate system, there is no need to convert from the map coordinate system to the lane coordinate system after update frame function is executed.

### VehicleEntity (with Behavior-Tree)

Only during `follow_polyline_trajectory` execution is planning performed in map coordinate system, but [lane coordinate system calculations are not performed](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/behavior/follow_trajectory.cpp#L546)

### Vehicle Entity (with Do-Nothing)

While the do-nothing behavior plugin is running, Entity does not move, so the lane coordinate system is calculated when spawning entity and is not recalculated thereafter.

### Pedestrian Entity (with Behavior-Tree)

Planning is done in map coordinates in the `walk_straight` and `follow_polyline_trajectory` actions.

In the `walk_straight` Action, [the pose in the lane coordinate system is calculated.](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L56)
The procedure for calculating the pose in the lane coordinate system at this time is as follows.

If lane matching was successful in the previous frame, do 1, otherwise do 2

1.[Set the length of the horizontal bar to 2.0 and calculate the pose in the lane coordinate system](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c 27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L72-L77)
2.[Calculate the pose in the lane coordinate system considering the size of the BoundingBox of the Entity](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0 c27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L79-L83)

If calculation 1 or 2 fails,
3.[Set the length of the horizontal bar to 4.0 and calculate the pose in the lane coordinate system](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c 27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L86-L91)
If 1 or 2 are successful, then 3 is skipped.

If the pose could not be calculated in the lane coordinate system by considering up to the result of 3, [the pose calculation in the lane coordinate system is a failure](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L125).

[Canonicalize pose in lane coordinate system](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/behavior_tree_plugin/src/pedestrian/pedestrian_action_node.cpp#L94) to determine the final pose in the lane coordinate system.

In the `follow_polyline_trajectory` Action, [lane coordinate system calculations are not performed](https://github.com/tier4/scenario_simulator_v2/blob/5f19d39ef29243396f26225976975f0c27914c12/simulation/traffic_simulator/src/behavior/follow_trajectory.cpp#L546)

### Pedestrian Entity (with Do-Nothing)

While the do-nothing behavior plugin is running, Entity does not move, so the lane coordinate system is calculated when spawning entity and is not recalculated thereafter.

### MiscObjectEntity

Misc object entity does not move, so the lane coordinate system is calculated when spawning entity and is not recalculated thereafter.
Binary file added docs/image/lane_pose_calculation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/image/longitudinal_distance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,20 @@ nav:
- developer_guide/AutowareAPI.md
- developer_guide/NPCBehavior.md
- developer_guide/BehaviorPlugin.md
# - developer_guide/ErrorCategories.md
# - developer_guide/ErrorCategories.md
- developer_guide/OpenSCENARIOSupport.md
- developer_guide/SimpleSensorSimulator.md
- developer_guide/SystemArchitecture.md
- developer_guide/TrafficSimulator.md
- developer_guide/ZeroMQ.md
- developer_guide/VehicleDynamics.md
- developer_guide/SimulationResultFormat.md
# cspell: ignore TIERIV
- Lane Pose Calculation:
Timing of lane pose calculation: developer_guide/lane_pose_calculation/LanePoseCalculation.md
Process of lane pose calculation when spawning entity: developer_guide/lane_pose_calculation/Spawn.md
Process of lane pose calculation when updating frame: developer_guide/lane_pose_calculation/UpdateFrame.md
Process of lane pose calculation when getting longitudinal distance: developer_guide/lane_pose_calculation/GetLongitudinalDistance.md
# cspell: ignore TIERIV
- developer_guide/TIERIVScenarioFormatVersion2.md
- developer_guide/CONTRIBUTING.md
- developer_guide/Communication.md
Expand Down
Loading