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

Feature/real time factor control #1150

Merged
merged 15 commits into from
Feb 7, 2024
Merged

Conversation

pawellech1
Copy link
Contributor

@pawellech1 pawellech1 commented Dec 13, 2023

Types of PR

  • New Features
  • Upgrade of existing features
  • Bugfix

Link to the issue

https://tier4.atlassian.net/browse/RJD-821
https://tier4.atlassian.net/browse/RJD-822

Description

Enabling using real_time_factor as the launch argument:

  • Fixed usage of real_time_factor inside SimulationClock, which makes the clock work correctly when the real_time_factor is set as the launch argument
  • Inside scenario_test_runner.launch.py both simple_sensor_simulator_node and openscenario_interpreter_node are now started with use_sim_time:=True.
  • The value of use_sim_time parameter for concealer::AutowareUniverse created by EgoEntitySimulation is now based on the global use_sim_time parameter value.

real_time_factor value control during the simulation

  • /real_time_factor topic subscriber is created inside traffic_simulator::API. It is used to control the value of real_time_factor during the simulation runtime.
  • Inside SimulationClock passed time is now stored as a single double value representing seconds. Since the real_time_factor value might change during the simulation simple counting passed frames number would not work properly anymore.
  • New updateStepTimeRequest in zeroMQ communication between traffic_simulator::API and SimpleSensorSimulator is created. The purpose of this request is to allow changing the value of ScenarioSimulator::step_time_ from the traffic_simulator::API when new real_time_factor value is received on the newly defined topic.

GUI plugin controlling the value of real_time_factor

  • The RViz plugin, which uses the slider to control the real_time_factor value, was created.

How to test and review this PR.

To test this PR please use Autoware from this fork branch https://github.com/RobotecAI/autoware-1/tree/autoware-real-time-factor-stable.

The branch linked above uses fork of autoware_launch repository inside autoware.repos file. On this autoware_launch fork, changes to planning_simulator.launch.xml file (from this unmerged PR autowarefoundation/autoware_launch#746) are introduced. These changes are necessary for the changes from this real-time-factor-control PR to work properly. Using the repository linked above ensures building a stable version. Except for the need to checkout different repository and branch, the rest of the Autoware building steps remain unchanged.

This step is necessary since the versions of the repositories which Autoware depends on might differ in time, a simple checkout to the branch from the PR linked above might and probably will cause unexpected trouble.

Others

Copy link
Contributor

@piotr-zyskowski-rai piotr-zyskowski-rai left a comment

Choose a reason for hiding this comment

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

Thank you for the implementation. I noticed several places for improvement. Please address the comments

@pawellech1 pawellech1 force-pushed the feature/real-time-factor-control branch from 82d1c1e to 8265b55 Compare December 19, 2023 12:23
@pawellech1 pawellech1 force-pushed the feature/real-time-factor-control branch from 8265b55 to 0970a4c Compare December 19, 2023 12:45
pawellech1 added a commit to RobotecAI/autoware-1 that referenced this pull request Dec 20, 2023
@yamacir-kit yamacir-kit marked this pull request as ready for review January 9, 2024 09:20
@yamacir-kit yamacir-kit self-requested a review January 9, 2024 09:20
Signed-off-by: Paweł Lech <[email protected]>
Signed-off-by: Paweł Lech <[email protected]>
@pawellech1
Copy link
Contributor Author

@yamacir-kit thank you for your first review, I have implemented the changes you requested.

Copy link
Collaborator

@hakuturu583 hakuturu583 left a comment

Choose a reason for hiding this comment

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

I believe this is likely to include disruptive changes regarding integration with AWSIM.
To prevent accidental merges, we will temporarily set this to Request Changes.

@pawellech1
Copy link
Contributor Author

@hakuturu583 I wanted to verify if this PR impairs the ss2 and AWSIM integration.

In order to do that I tried running sample_awsim.yaml scenario with the scenario_test_runner and AWSIM.

  • I used the Autoware awsim-ss2-stable branch and the branch from this PR for SS2:

    • I was able to successfully run the first test from the sample_awsim.yaml, but running the second test was not successful.
    • During the second attempt the Autoware visualization in RViz was not visible. The RViz screen was completly black except for the steering wheel interface.
  • I tried also running the same scenario without changes from this branch applied and the behavior was the same:

    • the first test was run successfully and the second one failed to run in the same way.

It seems for now that running sample_awsim.yaml scenario with scenario_test_runner and AWSIM is not working correctly neither on the ss2 version from awsim-ss2-stable simulator.repos file nor on the branch from this PR.

I will be trying to identify the root of this issue in order to run the scenario successfully.

@piotr-zyskowski-rai
Copy link
Contributor

@hakuturu583

I've tested the code from the PR and I was able to reproduce the issue mentioned by @pawellech1. Updating the branch to the newest master solved the issue for me and I was able to run AWSIM with code from this PR successfully.

Regarding the potential breaking of the communication with AWSIM - the AWSIM code should be updated to fully support the functionality to change the step time in runtime. I prepared a PR to introduce this in AWSIM: tier4/AWSIM#259
However, the change from the PR above is not necessary, as long as the user does not change the real-time factor on runtime. It would probably be best to wait for PR in AWSIM to be merged. The change is not breaking, however, when using scenario_simulator_v2 and AWSIM connection the way it was used until now.

@hakuturu583
Copy link
Collaborator

I have checked the source code and feel that there are no problems left.
As soon as this matter is fixed, we will approve it.

Signed-off-by: Paweł Lech <[email protected]>
@yamacir-kit yamacir-kit merged commit cd8d686 into master Feb 7, 2024
8 checks passed
@yamacir-kit yamacir-kit deleted the feature/real-time-factor-control branch February 7, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants