Skip to content

Commit

Permalink
fix(cpp_mock_scenarios): merge changes in random001
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoszynski committed Oct 14, 2024
1 parent 4681b25 commit fec8821
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mock/cpp_mock_scenarios/src/random_scenario/random001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,25 @@ class RandomScenario : public cpp_mock_scenarios::CppScenarioNode
34606, 0.0, 0.0, api_.getHdmapUtils());
const auto entity_name = "spawn_nearby_ego";

if (const auto ego = api_.getEntity("ego")) {
if (api_.isInPosition("ego", trigger_position, 20.0) && !api_.isEntitySpawned(entity_name)) {
if (ego_entity) {
if (ego_entity->isInPosition(trigger_position, 20.0) && !api_.isEntitySpawned(entity_name)) {
api_.spawn(
entity_name,
traffic_simulator::pose::transformRelativePoseToGlobal(
ego->getMapPose(),
ego_entity->getMapPose(),
geometry_msgs::build<geometry_msgs::msg::Pose>()
.position(geometry_msgs::build<geometry_msgs::msg::Point>().x(10).y(-5).z(0))
.orientation(geometry_msgs::msg::Quaternion())),
getVehicleParameters(),
traffic_simulator::entity::VehicleEntity::BuiltinBehavior::doNothing());
}

if (!api_.isInPosition("ego", trigger_position, 20.0) && api_.isEntitySpawned(entity_name)) {
if (!ego_entity->isInPosition(trigger_position, 20.0) && api_.isEntitySpawned(entity_name)) {
api_.despawn(entity_name);
}
}

if (api_.isInPosition("ego", ego_goal_position, 1.0)) {
if (ego_entity->isInPosition(ego_goal_position, 1.0)) {
api_.despawn("ego");
stop(cpp_mock_scenarios::Result::SUCCESS);
}
Expand Down

0 comments on commit fec8821

Please sign in to comment.