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

Fix requestSpeedChange sets target_speed only when it's reached #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gmajrobotec
Copy link
Collaborator

@gmajrobotec gmajrobotec commented Oct 1, 2024

Description

Abstract

The statement target_speed_ = target_speed.getAbsoluteValue(getCanonicalizedStatus(), other_status_); in firs example sets the target speed only in cases where the target speed has already been reached, which seems counter intuitive. This statement’s position is inconsistent with second example.

[this, target_speed](double) {
if (other_status_.find(target_speed.reference_entity_name) == other_status_.end()) {
return true;
}
if (isTargetSpeedReached(target_speed)) {
target_speed_ = target_speed.getAbsoluteValue(getCanonicalizedStatus(), other_status_);
return true;
}
return false;
},

[this, target_speed](double) {
if (other_status_.find(target_speed.reference_entity_name) == other_status_.end()) {
return true;
}
target_speed_ = target_speed.getAbsoluteValue(getCanonicalizedStatus(), other_status_);
return false;
},

Details

Described statement is moved down, outside of the “if” statement. This way the most up to date target speed will be set on each iteration until the target speed is reached. This is consistent with continuous case.

References

Jira ticket: internal link

Destructive Changes

There are no destructive changes.

Copy link

@robomic robomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use permalinks when referring to code.
Are you able to come up with a test case for this particular change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants