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/time contrained acceleration #1359

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

piotr-zyskowski-rai
Copy link
Contributor

@piotr-zyskowski-rai piotr-zyskowski-rai commented Aug 29, 2024

Description

This PR fixes behavior of time-constrained SpeedAction like the one below:

SpeedAction:
 SpeedActionDynamics:
   dynamicsDimension: time
   value: 2.0
   dynamicsShape: linear
 SpeedActionTarget:
   AbsoluteTargetSpeed:
     value: 2.0

Abstract

Time-constrained SpeedAction was not working properly because the conversion from the openscenario_interpreter::syntax::DynamicDimension type was not converted properly to the traffic_simulator::speed_change::Constraint type which is used deeper in the traffic_simulator.

This PR corrects conversion between openscenario_interpreter::syntax::DynamicDimension to traffic_simulator::speed_change::Constraint and solves the issue.

Background

This issue was found during scenario development for the scenario_simulator_v2_scenarios repository. This is one of the failing scenarios.

It was found that the acceleration is incorrect when the vehicle's speed is changed. The scenario expects acceleration of 1m/s^2 but has 2m/s^2.

image

Destructive Changes

The change might change entity behavior if it uses time-based constraints to alter its speed.

SpeedAction:
 SpeedActionDynamics:
   dynamicsDimension: time
   value: 2.0
   dynamicsShape: linear
 SpeedActionTarget:
   AbsoluteTargetSpeed:
     value: 2.0

Before the change, the code would accelerate the entity by 2.0 m/s2 until it reached 2 m/s. After the change, the vehicle would correctly accelerate 1 m/s2 for 2 s to reach 2 m/s.

If the scenario is tuned to work with time-based constrained SpeedAction working incorrectly, when SpeedAction starts working correctly the scenario will behave differently and might fail.

openscenario_interpreter::syntax::DynamicDimension to traffic_simulator::speed_change::Constraint conversion fix

This change fixes time constraied SpeedAction execution
Copy link

Checklist for reviewers ☑️

All references to "You" in the following text refer to the code reviewer.

  • Is this pull request written in a way that is easy to read from a third-party perspective?
  • Is there sufficient information (background, purpose, specification, algorithm description, list of disruptive changes, and migration guide) in the description of this pull request?
  • If this pull request contains a destructive change, does this pull request contain the migration guide?
  • Labels of this pull request are valid?
  • All unit tests/integration tests are included in this pull request? If you think adding test cases is unnecessary, please describe why and cross out this line.
  • The documentation for this pull request is enough? If you think adding documents for this pull request is unnecessary, please describe why and cross out this line.

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.

1 participant