Skip to content

add support for parsing parameters with scientific notation for OpenSCENARI…#1023

Merged
glopezdiest merged 2 commits intocarla-simulator:masterfrom
golnazraja:master
May 3, 2024
Merged

add support for parsing parameters with scientific notation for OpenSCENARI…#1023
glopezdiest merged 2 commits intocarla-simulator:masterfrom
golnazraja:master

Conversation

@golnazraja
Copy link
Copy Markdown
Contributor

@golnazraja golnazraja commented Sep 7, 2023

Description

Line number 105 in openscenario_parser.py has been changed.
This change will add support of parsing parameters with scientific notation for OpenSCENARIO files.

Fixes #927

Where has this been tested?

  • Platform(s): Ubuntu 20.04
  • Python version(s): 3.8.10
  • Unreal Engine version(s): 4.26
  • CARLA version: 0.9.13

This change is Reviewable

@fabianoboril
Copy link
Copy Markdown
Collaborator

Can you please rebase your commits. Thank you.

@golnazraja
Copy link
Copy Markdown
Contributor Author

Can you please rebase your commits. Thank you.

yes, I rebased my commits.

@haabe
Copy link
Copy Markdown
Contributor

haabe commented Nov 30, 2023

I believe this is fixed with this merge

@glopezdiest
Copy link
Copy Markdown
Contributor

Approved, but a couple of comments about the pattern.
First of all, while the one added by @haabe already implemented the scientific notation, this only worked for lower case e.
Secondly, this pattern does not accept any symbols between the number and the e / E (which is the example provided by the issue #927.

In summary, the accepted types are, for example,

  • 17254
  • 3583E+6
  • 3583E-6
  • 476e+5
  • 476e-5

Copy link
Copy Markdown
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @golnazraja)

@glopezdiest glopezdiest merged commit 40b38fc into carla-simulator:master May 3, 2024
Daraan added a commit to Daraan/scenario_runner that referenced this pull request Mar 27, 2025
remove extra lines (carla-simulator#1074)

Add misc type default blueprint (carla-simulator#1064)

Co-authored-by: Pablo Villanueva-Domingo <pablo.villanueva.domingo@gmail.com>

Fix: wrong initial transform when using request_new_batch_actors (carla-simulator#1068) (carla-simulator#1075)

See: carla-simulator#1068

Co-authored-by: Daraan <github.blurry@9ox.net>

Update atomic_trigger_conditions.py (carla-simulator#946)

In the StandStill() class, change the EPSILON, 0.001

Implement variable frame rate (carla-simulator#1005)

Replaced class variable frame_rate with an argument provided on the CLI.

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Workflow improvements and code quality passing (carla-simulator#1052)

* CI: Checkout v4 and unit tests name correction

* Small tweaks to ensure Code Quality passes

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Fixed metrics wheel parser (carla-simulator#1076)

Co-authored-by: glopezdiest <glopez@cvc.uab.cat>

[Feature] Blueprint-based spawn_actor function for CarlaDataProvider (carla-simulator#1071)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Hotfix: missing AttachmentType in the carla mock module for unittest (carla-simulator#1077)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

* Added missing AttachmentType for carla mock

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Backward compatible upgrade to fix deprecation warnings concerning LooseVersion and pkg_resources for Python3.8+ (carla-simulator#1058)

* upgraded version checking to fix deprecation warnings

Removed usage of pgk_resources and distutils.version.LooseVersion

* < python3.8 backward compatible version checking

* Compacter version checking.

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Replace deprecated python 3.8 code and add missing __init__.py files for proper python module recognition (carla-simulator#1053)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

add support for scientific notation parsing while running OpenSCENARIO files (carla-simulator#1023)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Update osc2_scenario_configuration.py (carla-simulator#1040)

Add super.__init__() to class OSC2ScenarioConfiguration to prevent error "AttributeError: 'OSC2ScenarioConfiguration' object has no attribute 'route'" when running scenario_runner.py with --openscenario2 parameter

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Remove version redundancy (carla-simulator#1081)

Update minimum CARLA version to 0.9.14 (carla-simulator#1082)

* Remove version redundancy

* Merge branch 'master' of https://github.com/carla-simulator/scenario_runner

* Update minimum CARLA version

Type-hint comments for CarlaDataProvider (carla-simulator#1066)

* Type-hint comments for CarlaDataProvider

* Suppress Any import warning

* Removed None values, increased type-coverage

Added log agent

[fix]rename compound_symbol.py (carla-simulator#1089)

Fixed a typo in openscenario_parser.py (carla-simulator#1118)

* Fixed a typo

There was a typo in function "get_traffic_light_from_osc_name", which was accessing "CCarlaDataProvider" insted of "CarlaDataProvider".

* Delete the unneeded file

Fix: Remove duplicate clean method calls (carla-simulator#1096)

* [fix]rename compound_symbol.py

* [fix]Remove duplicate clean method calls

* Fix Atomic_behaviors AddActor Func

No return status

Link documentation in README (carla-simulator#1129)

Include 0.9.14 carla release as compatible with scenario runner 0.9.13 (carla-simulator#1130)

* Link documentation in README

* Include 0.9.14 carla release as compatible with scenario runner 0.9.13

* Merge branch 'master' into docs_in_readme

Added a missing element to the blackboard (carla-simulator#1141)

Co-authored-by: glopezdiest <glopez@cvc.uab.cat>

Replaced deprecated is_intersection with is_junction (carla-simulator#1114)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

CDP request_new_actor new optional argument. (carla-simulator#1113)

spawn_point can be ommited when random_location=True

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Faster information retrieval if actor key is present (carla-simulator#1098)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Don't depend on distutils (carla-simulator#1121)

distutils are no longer available in Python 3.12. Therefore, we copy
the strtobool function from distutils to our own module. This is in
line with https://peps.python.org/pep-0632/#migration-advice.

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Fix dead actor accumulation in CDP (carla-simulator#1091)

* Slightly more informative function

Returns bool if actor was in the pool, else otherwise

* Fix accumulation of dead actors in CDP actor pool

* Dead actor cleaning in CDP._actor_*_maps

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>
glopezdiest added a commit that referenced this pull request Mar 31, 2025
* upgraded version checking to fix deprecation warnings

Removed usage of pgk_resources and distutils.version.LooseVersion

* Code cleanup 1

Ruff E,W, defalts

* Check return statement

--ignore F405,F403,F401,RET504,RET505 --exclude tests/ --select E,W,R,PIE,R

* flake8-bugbear

* remove full width comma

* Simplify code with SIM

* remove double defined function

* fix too long lines

* Unnecessary lambda and unnecessary else if

* parameterless super()

minor changes

* Whitespace and other E,W fixes

* Add docstring to CDP methods

- minor lint fixes

* Avoid unbound Name Error

* Solve most atomic behavior warnings

* further formatting

remove extra lines (#1074)

Add misc type default blueprint (#1064)

Co-authored-by: Pablo Villanueva-Domingo <pablo.villanueva.domingo@gmail.com>

Fix: wrong initial transform when using request_new_batch_actors (#1068) (#1075)

See: #1068

Co-authored-by: Daraan <github.blurry@9ox.net>

Update atomic_trigger_conditions.py (#946)

In the StandStill() class, change the EPSILON, 0.001

Implement variable frame rate (#1005)

Replaced class variable frame_rate with an argument provided on the CLI.

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Workflow improvements and code quality passing (#1052)

* CI: Checkout v4 and unit tests name correction

* Small tweaks to ensure Code Quality passes

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Fixed metrics wheel parser (#1076)

Co-authored-by: glopezdiest <glopez@cvc.uab.cat>

[Feature] Blueprint-based spawn_actor function for CarlaDataProvider (#1071)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Hotfix: missing AttachmentType in the carla mock module for unittest (#1077)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

* Added missing AttachmentType for carla mock

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Backward compatible upgrade to fix deprecation warnings concerning LooseVersion and pkg_resources for Python3.8+ (#1058)

* upgraded version checking to fix deprecation warnings

Removed usage of pgk_resources and distutils.version.LooseVersion

* < python3.8 backward compatible version checking

* Compacter version checking.

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Replace deprecated python 3.8 code and add missing __init__.py files for proper python module recognition (#1053)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

add support for scientific notation parsing while running OpenSCENARIO files (#1023)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Update osc2_scenario_configuration.py (#1040)

Add super.__init__() to class OSC2ScenarioConfiguration to prevent error "AttributeError: 'OSC2ScenarioConfiguration' object has no attribute 'route'" when running scenario_runner.py with --openscenario2 parameter

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Remove version redundancy (#1081)

Update minimum CARLA version to 0.9.14 (#1082)

* Remove version redundancy

* Merge branch 'master' of https://github.com/carla-simulator/scenario_runner

* Update minimum CARLA version

Type-hint comments for CarlaDataProvider (#1066)

* Type-hint comments for CarlaDataProvider

* Suppress Any import warning

* Removed None values, increased type-coverage

Added log agent

[fix]rename compound_symbol.py (#1089)

Fixed a typo in openscenario_parser.py (#1118)

* Fixed a typo

There was a typo in function "get_traffic_light_from_osc_name", which was accessing "CCarlaDataProvider" insted of "CarlaDataProvider".

* Delete the unneeded file

Fix: Remove duplicate clean method calls (#1096)

* [fix]rename compound_symbol.py

* [fix]Remove duplicate clean method calls

* Fix Atomic_behaviors AddActor Func

No return status

Link documentation in README (#1129)

Include 0.9.14 carla release as compatible with scenario runner 0.9.13 (#1130)

* Link documentation in README

* Include 0.9.14 carla release as compatible with scenario runner 0.9.13

* Merge branch 'master' into docs_in_readme

Added a missing element to the blackboard (#1141)

Co-authored-by: glopezdiest <glopez@cvc.uab.cat>

Replaced deprecated is_intersection with is_junction (#1114)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

CDP request_new_actor new optional argument. (#1113)

spawn_point can be ommited when random_location=True

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Faster information retrieval if actor key is present (#1098)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Don't depend on distutils (#1121)

distutils are no longer available in Python 3.12. Therefore, we copy
the strtobool function from distutils to our own module. This is in
line with https://peps.python.org/pep-0632/#migration-advice.

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

Fix dead actor accumulation in CDP (#1091)

* Slightly more informative function

Returns bool if actor was in the pool, else otherwise

* Fix accumulation of dead actors in CDP actor pool

* Dead actor cleaning in CDP._actor_*_maps

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

* osc2_scenario: Fix SyntaxWarnings (#1122)

This fixes warnings like the one below:

    .../srunner/scenarios/osc2_scenario.py:515: SyntaxWarning: invalid escape sequence '\W'
    expression_value = re.split("\W+", option)

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>

* formatting

* Return iterable

* fix: missing import, docstring, explicit return

* style: unnecessary super

* style: import order

* fix | ignore further infractions

* some more formatting

* define method in init

* less general Exception
also formatting

---------

Co-authored-by: glopezdiest <58212725+glopezdiest@users.noreply.github.com>
Co-authored-by: Michal Sojka <michal.sojka@cvut.cz>
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.

openscenario_parse.py don't supports parameter which is scientific notation (for example, 1.234+e+01)

4 participants