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

Refactor/simple sensor simulator/noise #1506

Merged
merged 18 commits into from
Feb 18, 2025

Conversation

yamacir-kit
Copy link
Collaborator

@yamacir-kit yamacir-kit commented Jan 14, 2025

Description

Abstract

Refactored the function to add noise to messages published by DetectionSensor in simple_sensor_simulator.

Background

DetectionSensor currently provides a simple noise application. The feature can be configured in the items listed in LINK whose names begin with detectedObject.

However, since this feature is only a simple noise application, a more practical noise model will be designed by Autoware's planner development team. The classes DefaultNoiseApplicator and CustomNoiseApplicator have been prepared as a testing ground for the planner development team to test and validate the model.

Details

The two refactorings we have done this time are as follows:

Delete DefaultNoiseApplicator and CustomNoiseApplicator and replace them with closure

These two classes were provided for ease and simplicity of test implementation.
In reality, however, these classes served neither purpose. As evidenced by the fact that DefaultNoiseApplicator's class members are raw references, this class is effectively no different than a closure that reference-captures the required object.
Although the member function DetectionSensor<>::update has the disadvantage of being larger in definition, I thought it would be more beneficial to reduce the total amount of code, so I removed those classes and replaced them with closures that do the equivalent work.

Change the argument type of the noise application function

Previously, the noise application function (CustomNoiseApplicator::operator ()) was passed the DetectedObjects type, which is the message type that will eventually be published.
However, each object stored in the DetectedObjects type does not have an identifier that can be used to identify the individual object, which makes it difficult to implement a specific noise model.
Therefore, the data type given to the noise application function was changed to traffic_simulator_msgs::EntityStatus, which holds the name of each entity.

References

None.

Destructive Changes

None.

Known Limitations

None.

Signed-off-by: yamacir-kit <httperror@404-notfound.jp>
Signed-off-by: yamacir-kit <httperror@404-notfound.jp>
@yamacir-kit yamacir-kit added refactor bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 labels Jan 14, 2025
@yamacir-kit yamacir-kit self-assigned this Jan 14, 2025
Copy link

github-actions bot commented Jan 14, 2025

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.

@yamacir-kit yamacir-kit requested a review from HansRobo February 17, 2025 06:06
@yamacir-kit yamacir-kit marked this pull request as ready for review February 17, 2025 08:55
@yamacir-kit yamacir-kit merged commit 6f1f103 into master Feb 18, 2025
13 checks passed
@github-actions github-actions bot deleted the refactor/simple_sensor_simulator/noise branch February 18, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants