-
Notifications
You must be signed in to change notification settings - Fork 658
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
feat(pid_longitudinal_controller): improve delay and slope compensation #4712
feat(pid_longitudinal_controller): improve delay and slope compensation #4712
Conversation
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]>
07c2737
to
8c60c02
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]>
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]>
8c60c02
to
00b96cc
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]>
00b96cc
to
8e53dba
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]>
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d
8e53dba
to
4e1a86a
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped
4e1a86a
to
a487f48
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix
499467f
to
e7e9f48
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign
e7e9f48
to
98751cd
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign denem
98751cd
to
78c2c93
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign denem style(pre-commit): autofix
bcda784
to
55c30d5
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign denem style(pre-commit): autofix
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign denem style(pre-commit): autofix
55c30d5
to
ab174e3
Compare
…mpensation autowarefoundation#4712 Signed-off-by: Berkay Karaman <[email protected]> update d not sure stopped style(pre-commit): autofix add copysign denem style(pre-commit): autofix ufak düzenleme
e00b520
to
5bcff34
Compare
@brkay54 Thank you for addressing my comments.
This is only in the ideal case. We need to care about users who can not use an accurate map or rich sensor for pitch estimation. Trajectory-only option is necessary for users with poor sensors. The pitch angle of the vehicle does not accurately represent the road surface gradient. Larger vehicles, such as buses, also have the ability to adjust air pressure to keep their posture as parallel as possible on a slope. With such functions, we can not use the pitch angle for the slope compensation. The parameters should be determined with an understanding of such pros/cons. |
5bcff34
to
4842216
Compare
Hi @TakaHoribe -san, sorry to be late I couldn't find time to update the PR in the last weeks. I updated the slope source option as you said above. You can find the changes in the launch file here. It is ready for review, please let me know if any issue exists. Also, after this PR, the following PRs should be merged by order here: |
4842216
to
75bca30
Compare
WalkthroughThe changes aim to improve the delay and slope compensation in the Changes
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (5)
- control/pid_longitudinal_controller/include/pid_longitudinal_controller/longitudinal_controller_utils.hpp (6)
- control/pid_longitudinal_controller/include/pid_longitudinal_controller/pid_longitudinal_controller.hpp (7)
- control/pid_longitudinal_controller/src/longitudinal_controller_utils.cpp (2)
- control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp (16)
- control/pid_longitudinal_controller/test/test_longitudinal_controller_utils.cpp (3)
Files ignored due to filter (1)
- control/pid_longitudinal_controller/param/longitudinal_controller_defaults.param.yaml
Files not summarized due to errors (2)
- control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp (diff tokens exceeds limit)
- control/pid_longitudinal_controller/test/test_longitudinal_controller_utils.cpp (diff tokens exceeds limit)
Files skipped from review due to trivial changes (1)
- control/pid_longitudinal_controller/src/longitudinal_controller_utils.cpp
Review comments generated (5)
- Review: 2
- LGTM: 3
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
point.pose.position.x = 0.6; | ||
point.pose.position.y = 0.0; | ||
point.pose.position.z = 1.0; | ||
point.pose.position.z = 0.8; | ||
traj.points.push_back(point); | ||
point.pose.position.x = 2.0; | ||
point.pose.position.x = 1.2; | ||
point.pose.position.y = 0.0; | ||
point.pose.position.z = 0.0; | ||
traj.points.push_back(point); | ||
point.pose.position.x = 3.0; | ||
point.pose.position.x = 1.8; | ||
point.pose.position.y = 0.0; | ||
point.pose.position.z = 0.5; | ||
point.pose.position.z = 0.8; | ||
traj.points.push_back(point); | ||
size_t closest_idx = 0; | ||
EXPECT_DOUBLE_EQ( | ||
std::abs(longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base)), M_PI_4); | ||
longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base), std::atan2(-0.8, 0.6)); | ||
closest_idx = 1; | ||
EXPECT_DOUBLE_EQ( | ||
std::abs(longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base)), M_PI_4); | ||
longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base), std::atan2(0.8, 0.6)); | ||
closest_idx = 2; | ||
EXPECT_DOUBLE_EQ( | ||
std::abs(longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base)), | ||
std::atan2(0.5, 1)); | ||
longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base), std::atan2(-0.8, 0.6)); | ||
closest_idx = 3; | ||
EXPECT_DOUBLE_EQ( | ||
std::abs(longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base)), | ||
std::atan2(0.5, 1)); | ||
longitudinal_utils::getPitchByTraj(traj, closest_idx, wheel_base), std::atan2(-0.8, 0.6)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case TEST(TestLongitudinalControllerUtils, calcPoseAfterTimeDelay)
has been modified. The trajectory points and expected pitch values have changed. Please review these changes to ensure they are correct and aligned with the intended behavior. If the changes are intentional, no further action is needed. Otherwise, consider reverting this test case to its original state or updating it accordingly.
...ongitudinal_controller/include/pid_longitudinal_controller/longitudinal_controller_utils.hpp
Show resolved
Hide resolved
65c1762
to
f65ced5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brkay54 LGTM and almost ready to merge.
Would you address the followings?
- Fix test code. This seems to fail due to the pos/neg definition mismatch.
- Make a PR to the autoware_launch for new parameters.
- Make sure unrelated parameters are not changed in this PR: parameters attached in the screenshot should not change.
control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp
Outdated
Show resolved
Hide resolved
f65ced5
to
870fc09
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4712 +/- ##
==========================================
+ Coverage 14.90% 14.92% +0.02%
==========================================
Files 1817 1817
Lines 125466 125585 +119
Branches 37706 37788 +82
==========================================
+ Hits 18697 18742 +45
- Misses 85752 85768 +16
- Partials 21017 21075 +58
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
870fc09
to
d6ce419
Compare
Signed-off-by: Berkay Karaman <[email protected]>
9ebc3ab
to
27d25df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I think it is fine. I'll talk with @takayuki5168 |
…on (autowarefoundation#4712) Signed-off-by: Berkay Karaman <[email protected]>
…on (autowarefoundation#4712) Signed-off-by: Berkay Karaman <[email protected]>
Description
In the current implementation on Autoware, while calculating the output command, we are compensating for the slope and delay in
pid_longitudinal_controller
.We are doing the delay compensation by using the estimation of the drive distance of the vehicle after
delay_compensation_time
and we are looking at the futureTrajectoryPoint
and calculating the output command with respect to this future point.However, before sending the output command, we are also doing slope compensation with respect to Current
TrajectoryPoint
. However, in some scenarios on hilly roads, this way is causing some conflicts because of the time like below.As you can see in this scenario, there is a conflict between slope and delay compensation because they are using different reference times. In this scenario, the node will send FF with respect to the target point however it sums negative slope compensation value because of the current position of the vehicle and it causes undesired behavior. To avoid this behavior, I made some changes to delay and slope compensation in this package to sum compensations at the same time.
Also, after this PR, the following PRs should be merged by order here:
1- #5077
2- #5079
3- #5080
4- #5081
Related links
Tests performed
I tested on the real vehicle and also on the planning simulator. It solves our problems in the real environment and there is no behavioral change in the planning simulator.
Notes for reviewers
Interface changes
Effects on system behavior
The only effect is that we will use the raw pitch info at only starting (while not moving), if the vehicle is moving, it needs the future pitch info, to achieve this, it depends on the pitch values of the trajectory points.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.
Summary by CodeRabbit
pid_longitudinal_controller
package, resulting in more accurate output commands. The changes include updates to thegetPitchByTraj
function, introduction of thefindTrajectoryPoseAfterDistance
function, and modification of the return type of thelerpTrajectoryPoint
function. These enhancements may impact the behavior of the code.PidLongitudinalController
class of Autoware. The modifications involve using drive distance estimation after a specified delay time for delay compensation and adjusting slope compensation to avoid conflicts. The changes also introduce theStateAfterDelay
struct and a newSlopeSource
enum.