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: mock test launch #1368

Merged
merged 6 commits into from
Sep 11, 2024
Merged

fix: mock test launch #1368

merged 6 commits into from
Sep 11, 2024

Conversation

satoshi-ota
Copy link
Contributor

@satoshi-ota satoshi-ota commented Sep 10, 2024

Description

  • pass necessary parameters to cpp_scenario_node properly.
  • make it possible to change frame rate and real time factor by parameter.

Abstract

  • update mock_test.launch.py in order to pass necessary parameters.
  • fix cpp_scenario_node implementation to use parameter.

Background

I found cpp_scenario_node didn't use proper vehicle model type which was definded in simulator_model.param.yaml when I used mock_test.launch.py.

Additionally, I think it is better to remove hard-coded variable so that we can change the configuration flexibly.

Details

With this PR, I confirmed cpp_scenario_node works with expecrted vehicle model type and calculates vehicle state with expected step time defined by global_frame_rate.

Used command:

ros2 launch cpp_mock_scenarios mock_test.launch.py scenario:=random001 global_frame_rate:=30.0 vehicle_model:=lexus sensor_model:=aip_xx1

Used vehicle model: DELAY_STEER_ACC_GEARED

Insert debug snipet:

--- a/simulation/simple_sensor_simulator/src/vehicle_simulation/ego_entity_simulation.cpp
+++ b/simulation/simple_sensor_simulator/src/vehicle_simulation/ego_entity_simulation.cpp
@@ -79,6 +79,7 @@ auto EgoEntitySimulation::getVehicleModelType() -> VehicleModelType
 {
   const auto vehicle_model_type =
     getParameter<std::string>("vehicle_model_type", "IDEAL_STEER_VEL");
+  std::cout << "vehicle_model_type:" << vehicle_model_type << std::endl;
 
   static const std::unordered_map<std::string, VehicleModelType> table{
     {"DELAY_STEER_ACC", VehicleModelType::DELAY_STEER_ACC},
@@ -106,6 +107,7 @@ auto EgoEntitySimulation::makeSimulationModel(
 {
   auto node = rclcpp::Node("get_parameter", "simulation");
 
+  std::cout << "step_time" << step_time << std::endl;
   auto get_parameter = [&](const std::string & name, auto value = {}) {
     node.declare_parameter<decltype(value)>(name, value);
     node.get_parameter<decltype(value)>(name, value);

Screen output:

[INFO] [launch]: All log files can be found below /home/satoshi/.ros/log/2024-09-11-08-24-44-066448-dpc2406501-5612                                                                                                                                                                                                                                                                                                              
[INFO] [launch]: Default logging verbosity is set to INFO                                                                                                                                                                                                                                                                                                                                                                        
architecture_type                   := awf/universe/20230906                                                                                                                                                                                                                                                                                                                                                                     
autoware_launch_file                := planning_simulator.launch.xml                                                                                                                                                                                                                                                                                                                                                             
autoware_launch_package             := autoware_launch                                                                                                                                                                                                                                                                                                                                                                           
consider_acceleration_by_road_slope := False                                                                                                                                                                                                                                                                                                                                                                                     
consider_pose_by_road_slope         := True                                                                                                                                                                                                                                                                                                                                                                                      
global_frame_rate                   := 30.0                                                                                                                                                                                                                                                                                                                                                                                      
global_real_time_factor             := 1.0                                                                                                                                                                                                                                                                                                                                                                                       
global_timeout                      := 180                                                                                                                                                                                                                                                                                                                                                                                       
initialize_duration                 := 300                                                                                                                                                                                                                                                                                                                                                                                       
launch_autoware                     := True                                                                                                                                                                                                                                                                                                                                                                                      
launch_rviz                         := False                                                                                                                                                                                                                                                                                                                                                                                     
output_directory                    := /tmp                                                                                                                                                                                                                                                                                                                                                                                      
port                                := 5555                                                                                                                                                                                                                                                                                                                                                                                      
publish_empty_context               := False                                                                                                                                                                                                                                                                                                                                                                                     
record                              := False                                                                                                                                                                                                                                                                                                                                                                                     
rviz_config                         := /home/satoshi/pilot-auto/install/traffic_simulator/share/traffic_simulator/config/scenario_simulator_v2.rviz                                                                                                                                                                                                                                                                              
scenario                            := random001                                                                                                                                                                                                                                                                                                                                                                                 
sensor_model                        := aip_xx1                                                                                                                                                                                                                                                                                                                                                                                   
sigterm_timeout                     := 8                                                                                                                                                                                                                                                                                                                                                                                         
use_sim_time                        := False                                                                                                                                                                                                                                                                                                                                                                                     
vehicle_model                       := lexus                                                                                                                                                                                                                                                                                                                                                                                     
scenario_package                    := cpp_mock_scenarios                                                                                                                                                                                                                                                                                                                                                                        
junit_path                          := /tmp/output.xunit.xml                                                                                                                                                                                                                                                                                                                                                                     
[INFO] [random001-1]: process started with pid [5613]                                                                                                                                                                                                                                                                                                                                                                            
[INFO] [simple_sensor_simulator_node-2]: process started with pid [5615]                                                                                                                                                                                                                                                                                                                                                         
[INFO] [visualization_node-3]: process started with pid [5617]                                                                                                                                                                                                                                                                                                                                                                   
[random001-1] [INFO] [launch]: All log files can be found below /home/satoshi/.ros/log/2024-09-11-08-24-44-614686-dpc2406501-5661                                                                                                                                                                                                                                                                                                
[random001-1] [INFO] [launch]: Default logging verbosity is set to INFO                                                                                                                                                                                                                                                                                                                                                          
[simple_sensor_simulator_node-2] vehicle_model_type:DELAY_STEER_ACC_GEARED                                                                                                                                                                                                                                                                                                                                                       
[simple_sensor_simulator_node-2] step_time0.0333333 

References

N.A

Destructive Changes

N.A

Known Limitations

N.A

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
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.

@hakuturu583 hakuturu583 self-requested a review September 10, 2024 04:43
@hakuturu583 hakuturu583 added the bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 label Sep 10, 2024
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
@satoshi-ota satoshi-ota changed the title Fix/mock test launch test fix: mock test launch Sep 10, 2024
@hakuturu583 hakuturu583 merged commit 3f25017 into master Sep 11, 2024
10 checks passed
@github-actions github-actions bot deleted the fix/mock-test-launch-test branch September 11, 2024 02:50
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants