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

RJD 782 Fixes necessary to run Odaiba scenario #1196

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions mock/cpp_mock_scenarios/src/cpp_scenario_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void CppScenarioNode::spawnEgoEntity(
api_.updateFrame();
std::this_thread::sleep_for(std::chrono::duration<double>(1.0 / 20.0));
api_.spawn("ego", spawn_lanelet_pose, parameters, traffic_simulator::VehicleBehavior::autoware());
api_.asFieldOperatorApplication("ego").declare_parameter<bool>("allow_goal_modification", true);
api_.attachLidarSensor("ego", 0.0);

api_.attachDetectionSensor("ego", 200.0, true, 0.0, 0, 0.0, 0.0);
Expand All @@ -112,30 +113,12 @@ void CppScenarioNode::spawnEgoEntity(
return configuration;
}());
api_.requestAssignRoute("ego", goal_lanelet_poses);
using namespace std::chrono_literals;
std::atomic<bool> initialized(false);
auto initialize_thread = std::thread([&]() {
while (!api_.asFieldOperatorApplication("ego").engaged()) {
api_.updateFrame();
std::this_thread::sleep_for(std::chrono::duration<double>(1.0 / 20.0));
}
initialized.store(true);
});
std::atomic<bool> engaged(false);
auto engage_thread = std::thread([&]() {
while (!api_.asFieldOperatorApplication("ego").engaged()) {
while (!api_.asFieldOperatorApplication("ego").engaged()) {
if (api_.asFieldOperatorApplication("ego").engageable())
api_.asFieldOperatorApplication("ego").engage();
std::this_thread::sleep_for(1000ms);
}
engaged.store(true);
});
while (!api_.asFieldOperatorApplication("ego").engaged() &&
!(initialized.load() && engaged.load())) {
// RCLCPP_INFO_STREAM(get_logger(), "Waiting for Autoware initialization...");
api_.updateFrame();
std::this_thread::sleep_for(std::chrono::duration<double>(1.0 / 20.0));
}
initialize_thread.join();
engage_thread.join();
}

void CppScenarioNode::checkConfiguration(const traffic_simulator::Configuration & configuration)
Expand Down
3 changes: 2 additions & 1 deletion mock/cpp_mock_scenarios/src/random_scenario/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
)

ament_auto_add_executable(random001
random001.cpp
# random001.cpp
random002-odaiba.cpp

Check warning on line 8 in mock/cpp_mock_scenarios/src/random_scenario/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (odaiba)

Check warning on line 8 in mock/cpp_mock_scenarios/src/random_scenario/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (odaiba)
)
target_link_libraries(random001
cpp_scenario_node
Expand Down
Loading
Loading