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

EntityBase “requestSpeedChangeWithConstantAcceleration” and “requestSpeedChange” sometimes will not throw an error #1393

Open
gmajrobotec opened this issue Sep 25, 2024 · 1 comment
Assignees

Comments

@gmajrobotec
Copy link
Contributor

Description

Location: enetity_base.cpp: 305, 394, 457

Function isTargetSpeedReached throws an error from speed_change.cpp:47 if it is provided with an invalid entity name in the speed_change::RelativeTargetSpeed argument.
There are several places in requestSpeedChange functions where isTargetSpeedReached is invoked if-and-only-if continuous == false (early return). This means that an invalid speed_change::RelativeTargetSpeed argument will sometimes result in an error immediately, but sometimes will not.
Note that the error will be thrown eventually anyway (might remove this, as it is not technically an issue).

Solution
This could be changed by inverting the order of statements in the if (!continuous && isTargetSpeedReached(target_speed)) statement. However as noted above, this is only a suggestion and can be removed.

@hakuturu583
Copy link
Collaborator

Invalid operation should not be permitted, so if the speed_change::RelativeTargetSpeed called with invalid name, it should throw exception.

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

No branches or pull requests

3 participants