From 73efee4e326a52757ccbf82f628f6256a1578302 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 16:51:29 +0900 Subject: [PATCH 01/16] Revert "chore: update author of sample scenario" This reverts commit 604127d61e0a3014e36f8b05af2c52ab44cd99ea. --- test_runner/scenario_test_runner/scenario/delete.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_runner/scenario_test_runner/scenario/delete.yaml b/test_runner/scenario_test_runner/scenario/delete.yaml index 8d798ce824b..4b29e9b32fe 100644 --- a/test_runner/scenario_test_runner/scenario/delete.yaml +++ b/test_runner/scenario_test_runner/scenario/delete.yaml @@ -1,8 +1,8 @@ OpenSCENARIO: FileHeader: - author: "Kotaro Yoshimoto" - date: "2022-12-09T18:16:53+09:00" - description: "Scenario with DeleteEntityAction" + author: "Tatsuya Yamasaki" + date: "2022-03-04T18:06:53+09:00" + description: "Sample scenario (with Autoware)" revMajor: 1 revMinor: 0 ParameterDeclarations: From d77f1912b7b932e973e22b15df84f228701c648d Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 16:51:43 +0900 Subject: [PATCH 02/16] Revert "feat: invalidate status in deleted entity" This reverts commit b35981583909f9ddfe9587a6ea92239a7324418e. --- .../traffic_simulator/src/entity/deleted_entity.cpp | 5 ----- .../traffic_simulator/src/entity/entity_manager.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/simulation/traffic_simulator/src/entity/deleted_entity.cpp b/simulation/traffic_simulator/src/entity/deleted_entity.cpp index 9c2290cb108..df255c58781 100644 --- a/simulation/traffic_simulator/src/entity/deleted_entity.cpp +++ b/simulation/traffic_simulator/src/entity/deleted_entity.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include namespace traffic_simulator @@ -32,10 +31,6 @@ DeletedEntity::DeletedEntity( status.bounding_box.dimensions.x = 0; status.bounding_box.dimensions.y = 0; status.bounding_box.dimensions.z = 0; - status.pose.position.x = std::numeric_limits::infinity(); - status.pose.position.y = std::numeric_limits::infinity(); - status.pose.position.z = std::numeric_limits::infinity(); - status.lanelet_pose_valid = false; status_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); status_before_update_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); } diff --git a/simulation/traffic_simulator/src/entity/entity_manager.cpp b/simulation/traffic_simulator/src/entity/entity_manager.cpp index baf99026b2e..e90414dd64d 100644 --- a/simulation/traffic_simulator/src/entity/entity_manager.cpp +++ b/simulation/traffic_simulator/src/entity/entity_manager.cpp @@ -141,11 +141,7 @@ auto EntityManager::getEntityNames() const -> const std::vector { std::vector names{}; for (const auto & each : entities_) { - // Add filter for DeletedEntity because this list is used on SimpleSensorSimulator which do not - // know DeletedEntity. - if (each.second->getEntityType().type != DeletedEntity::ENTITY_TYPE_ID) { - names.push_back(each.first); - } + names.push_back(each.first); } return names; } @@ -168,7 +164,11 @@ auto EntityManager::getEntityTypeList() const { std::unordered_map ret; for (auto && [name, entity] : entities_) { - ret.emplace(name, getEntityType(name)); + auto type = getEntityType(name); + if (type.type == DeletedEntity::ENTITY_TYPE_ID) { + continue; + } + ret.emplace(name, type); } return ret; } From e091d064bb0a68ca95acd86573fd50f94d7c310c Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 16:51:49 +0900 Subject: [PATCH 03/16] Revert "feat: remove DELETED entity type by using internal id" This reverts commit a15268f290e4957fbcfce1e3c52c37de23852a4c. --- .../include/traffic_simulator/entity/deleted_entity.hpp | 5 +---- simulation/traffic_simulator/src/entity/entity_manager.cpp | 6 +----- simulation/traffic_simulator_msgs/msg/EntityType.msg | 1 + 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp index d2290469cd7..20e1286a85e 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp @@ -26,9 +26,6 @@ namespace entity class DeletedEntity : public EntityBase { public: - // Dummy ID for internal use - static constexpr uint8_t ENTITY_TYPE_ID = 0xFF; - explicit DeletedEntity( const std::string & name, const CanonicalizedEntityStatus &, const std::shared_ptr &); @@ -43,7 +40,7 @@ class DeletedEntity : public EntityBase auto getEntityType() const -> const traffic_simulator_msgs::msg::EntityType & override { static traffic_simulator_msgs::msg::EntityType type; - type.type = ENTITY_TYPE_ID; // Dummy ID for internal use + type.type = traffic_simulator_msgs::msg::EntityType::DELETED; return type; } diff --git a/simulation/traffic_simulator/src/entity/entity_manager.cpp b/simulation/traffic_simulator/src/entity/entity_manager.cpp index e90414dd64d..10c405333de 100644 --- a/simulation/traffic_simulator/src/entity/entity_manager.cpp +++ b/simulation/traffic_simulator/src/entity/entity_manager.cpp @@ -164,11 +164,7 @@ auto EntityManager::getEntityTypeList() const { std::unordered_map ret; for (auto && [name, entity] : entities_) { - auto type = getEntityType(name); - if (type.type == DeletedEntity::ENTITY_TYPE_ID) { - continue; - } - ret.emplace(name, type); + ret.emplace(name, getEntityType(name)); } return ret; } diff --git a/simulation/traffic_simulator_msgs/msg/EntityType.msg b/simulation/traffic_simulator_msgs/msg/EntityType.msg index 3713f3efec9..e3489e0977d 100644 --- a/simulation/traffic_simulator_msgs/msg/EntityType.msg +++ b/simulation/traffic_simulator_msgs/msg/EntityType.msg @@ -2,4 +2,5 @@ uint8 EGO = 0 uint8 VEHICLE = 1 uint8 PEDESTRIAN = 2 uint8 MISC_OBJECT = 3 +uint8 DELETED = 255 uint8 type From 0866d548714761f8f137d48afb39e8247f8785a7 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 16:51:56 +0900 Subject: [PATCH 04/16] Revert "chore: add example scenario of DeleteEntityAction" This reverts commit 8c6f8a498a226c2c35a9bedc18c90a95b5888f2b. --- .../scenario_test_runner/scenario/delete.yaml | 350 ------------------ 1 file changed, 350 deletions(-) delete mode 100644 test_runner/scenario_test_runner/scenario/delete.yaml diff --git a/test_runner/scenario_test_runner/scenario/delete.yaml b/test_runner/scenario_test_runner/scenario/delete.yaml deleted file mode 100644 index 4b29e9b32fe..00000000000 --- a/test_runner/scenario_test_runner/scenario/delete.yaml +++ /dev/null @@ -1,350 +0,0 @@ -OpenSCENARIO: - FileHeader: - author: "Tatsuya Yamasaki" - date: "2022-03-04T18:06:53+09:00" - description: "Sample scenario (with Autoware)" - revMajor: 1 - revMinor: 0 - ParameterDeclarations: - ParameterDeclaration: - - name: random_offset - parameterType: double - value: 0 - ConstraintGroup: - - ValueConstraint: - - rule: lessOrEqual - value: 1.0 - - rule: greaterOrEqual - value: -1.0 - - CatalogLocations: - CatalogLocation: [] - RoadNetwork: - LogicFile: - filepath: $(ros2 pkg prefix --share kashiwanoha_map)/map - Entities: - ScenarioObject: - - name: ego - Vehicle: - name: "" - vehicleCategory: car - ParameterDeclarations: - ParameterDeclaration: - # https://github.com/autowarefoundation/sample_vehicle_launch/blob/main/sample_vehicle_description/config/simulator_model.param.yaml - - { name: vel_lim, parameterType: double, value: 50.0 } - - { name: vel_rate_lim, parameterType: double, value: 7.0 } - - { name: steer_lim, parameterType: double, value: 1.0 } - # https://github.com/autowarefoundation/sample_vehicle_launch/blob/main/sample_vehicle_description/config/vehicle_info.param.yaml - - { name: wheel_radius, parameterType: double, value: 0.39 } - - { name: wheel_width, parameterType: double, value: 0.42 } - - { name: wheel_base, parameterType: double, value: 2.74 } - - { name: wheel_tread, parameterType: double, value: 1.63 } - - { name: front_overhang, parameterType: double, value: 1.0 } - - { name: rear_overhang, parameterType: double, value: 1.03 } - - { name: left_overhang, parameterType: double, value: 0.1 } - - { name: right_overhang, parameterType: double, value: 0.1 } - - { name: vehicle_height, parameterType: double, value: 2.5 } - BoundingBox: - Center: - x: ${ ($front_overhang + $wheel_base + $rear_overhang) / 2 - $rear_overhang } - y: 0 - z: ${ $vehicle_height / 2 } - Dimensions: - width: ${ $left_overhang + $wheel_tread + $right_overhang } - length: ${ $front_overhang + $wheel_base + $rear_overhang } - height: $vehicle_height - Performance: - maxSpeed: $vel_lim - maxAcceleration: $vel_rate_lim - maxDeceleration: $vel_rate_lim - Axles: - FrontAxle: - maxSteering: $steer_lim - wheelDiameter: ${ 2 * $wheel_radius } - trackWidth: $wheel_tread - positionX: $wheel_base - positionZ: $wheel_radius - RearAxle: - maxSteering: 0 - wheelDiameter: ${ 2 * $wheel_radius } - trackWidth: $wheel_tread - positionX: 0 - positionZ: $wheel_radius - Properties: - Property: [] - ObjectController: - Controller: - name: "" - Properties: - Property: - - { name: isEgo, value: true } - - { name: maxJerk, value: 1.5 } - - { name: minJerk, value: -1.5 } - - name: Npc1 - Vehicle: - name: "" - vehicleCategory: car - BoundingBox: - Center: - x: 0 - y: 0 - z: 0 - Dimensions: - width: 1.8 - length: 4 - height: 2.5 - Performance: - maxSpeed: 30 - maxAcceleration: INF - maxDeceleration: INF - Axles: - FrontAxle: - maxSteering: 3.1415 - wheelDiameter: 0.6 - trackWidth: 4 - positionX: 1 - positionZ: 0.3 - RearAxle: - maxSteering: 3.1415 - wheelDiameter: 0.6 - trackWidth: 4 - positionX: -1 - positionZ: 0.3 - Properties: - Property: [] - - name: Npc2 - Vehicle: - name: "" - vehicleCategory: car - BoundingBox: - Center: - x: 0 - y: 0 - z: 0 - Dimensions: - width: 1.8 - length: 4 - height: 2.5 - Performance: - maxSpeed: 30 - maxAcceleration: INF - maxDeceleration: INF - Axles: - FrontAxle: - maxSteering: 3.1415 - wheelDiameter: 0.6 - trackWidth: 4 - positionX: 1 - positionZ: 0.3 - RearAxle: - maxSteering: 3.1415 - wheelDiameter: 0.6 - trackWidth: 4 - positionX: -1 - positionZ: 0.3 - Properties: - Property: [] - Storyboard: - Init: - Actions: - Private: - - entityRef: ego - PrivateAction: - - TeleportAction: - Position: - LanePosition: - roadId: "" - laneId: 34513 - s: 1 - offset: 0 - Orientation: - type: relative - h: 0 - p: 0 - r: 0 - - RoutingAction: - AcquirePositionAction: - Position: - LanePosition: - roadId: "" - laneId: "34507" - s: 50 - offset: 0 - Orientation: - type: relative - h: 0 - p: 0 - r: 0 - - LongitudinalAction: - SpeedAction: - SpeedActionDynamics: - dynamicsDimension: time - value: 0 - dynamicsShape: step - SpeedActionTarget: - AbsoluteTargetSpeed: - value: 2.778 - - entityRef: Npc1 - PrivateAction: - - TeleportAction: - Position: - LanePosition: - roadId: "" - laneId: 34462 - s: 1 - offset: 0 - Orientation: - type: relative - h: 0 - p: 0 - r: 0 - Story: - - name: "" - Act: - - name: _EndCondition - ManeuverGroup: - - maximumExecutionCount: 1 - name: "" - Actors: - selectTriggeringEntities: false - EntityRef: - - entityRef: ego - Maneuver: - - name: "" - Event: - - name: "" - priority: parallel - StartTrigger: - ConditionGroup: - - Condition: - - name: "" - delay: 0 - conditionEdge: none - ByEntityCondition: - TriggeringEntities: - triggeringEntitiesRule: any - EntityRef: - - entityRef: ego - EntityCondition: - ReachPositionCondition: - Position: - LanePosition: - roadId: "" - laneId: "34507" - s: 50 - offset: 0 - Orientation: - type: relative - h: 0 - p: 0 - r: 0 - tolerance: 0.5 - - name: "" - delay: 0 - conditionEdge: none - ByValueCondition: - UserDefinedValueCondition: - name: RelativeHeadingCondition(ego, 34507, 50) - rule: lessThan - value: 0.1 - - name: "" - delay: 0 - conditionEdge: none - ByValueCondition: - UserDefinedValueCondition: - name: ego.currentState - rule: equalTo - value: ARRIVED_GOAL - Action: - - name: "" - UserDefinedAction: - CustomCommandAction: - type: exitSuccess - StartTrigger: - ConditionGroup: - - Condition: - - name: "" - delay: 0 - conditionEdge: none - ByValueCondition: - SimulationTimeCondition: - value: 0 - rule: greaterThan - - name: "spawn" - ManeuverGroup: - - maximumExecutionCount: 1 - name: "" - Actors: - selectTriggeringEntities: false - Maneuver: - - name: "" - Event: - - name: "spawn" - priority: parallel - Action: - - name: "" - GlobalAction: - - EntityAction: - entityRef: Npc2 - AddEntityAction: - Position: - LanePosition: - roadId: "" - laneId: 34462 - s: 5 - offset: 0 - Orientation: - type: relative - h: 0 - p: 0 - r: 0 - StartTrigger: - ConditionGroup: - - Condition: - - name: "" - delay: 0 - conditionEdge: none - ByValueCondition: - SimulationTimeCondition: - value: 5 - rule: greaterThan - - name: "despawn" - ManeuverGroup: - - maximumExecutionCount: 1 - name: "" - Actors: - selectTriggeringEntities: false - Maneuver: - - name: "" - Event: - - name: "despawn" - priority: parallel - Action: - - name: "" - GlobalAction: - - EntityAction: - entityRef: Npc2 - DeleteEntityAction: - StartTrigger: - ConditionGroup: - - Condition: - - name: "" - delay: 0 - conditionEdge: none - ByValueCondition: - SimulationTimeCondition: - value: 7 - rule: greaterThan - StopTrigger: - ConditionGroup: - - Condition: - - name: (when (collide? ego npc) ...) - delay: 15 - conditionEdge: none - ByEntityCondition: - TriggeringEntities: - triggeringEntitiesRule: any - EntityRef: [entityRef: ego] - EntityCondition: - CollisionCondition: - EntityRef: { entityRef: Npc2 } From 6997ef6d1cf8de285731eed5160e92ffc3816f01 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 16:52:04 +0900 Subject: [PATCH 05/16] Revert "feat: add deleted entity to traffic simulator" This reverts commit ba2abf393757a53e266476fc7f4184cf495837af. --- simulation/traffic_simulator/CMakeLists.txt | 1 - .../entity/deleted_entity.hpp | 104 ------------------ .../entity/entity_manager.hpp | 1 - .../src/entity/deleted_entity.cpp | 64 ----------- .../src/entity/entity_manager.cpp | 8 +- .../traffic_simulator_msgs/msg/EntityType.msg | 1 - 6 files changed, 1 insertion(+), 178 deletions(-) delete mode 100644 simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp delete mode 100644 simulation/traffic_simulator/src/entity/deleted_entity.cpp diff --git a/simulation/traffic_simulator/CMakeLists.txt b/simulation/traffic_simulator/CMakeLists.txt index b5dce931492..122d3bd60a9 100644 --- a/simulation/traffic_simulator/CMakeLists.txt +++ b/simulation/traffic_simulator/CMakeLists.txt @@ -38,7 +38,6 @@ ament_auto_add_library(traffic_simulator SHARED src/data_type/lane_change.cpp src/data_type/lanelet_pose.cpp src/data_type/speed_change.cpp - src/entity/deleted_entity.cpp src/entity/ego_entity.cpp src/entity/entity_base.cpp src/entity/entity_manager.cpp diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp deleted file mode 100644 index 20e1286a85e..00000000000 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.hpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2015 TIER IV, Inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_HPP_ -#define TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_HPP_ - -#include -#include -#include - -namespace traffic_simulator -{ -namespace entity -{ -class DeletedEntity : public EntityBase -{ -public: - explicit DeletedEntity( - const std::string & name, const CanonicalizedEntityStatus &, - const std::shared_ptr &); - - void onUpdate(double, double) override {} - - auto getCurrentAction() const -> std::string override; - - auto getDefaultDynamicConstraints() const - -> const traffic_simulator_msgs::msg::DynamicConstraints & override; - - auto getEntityType() const -> const traffic_simulator_msgs::msg::EntityType & override - { - static traffic_simulator_msgs::msg::EntityType type; - type.type = traffic_simulator_msgs::msg::EntityType::DELETED; - return type; - } - - auto getEntityTypename() const -> const std::string & override - { - static const std::string result = "DeletedEntity"; - return result; - } - - ~DeletedEntity() override = default; - - auto getGoalPoses() -> std::vector override { return {}; } - - std::optional getObstacle() override - { - return std::nullopt; - } - - auto getRouteLanelets(double) -> lanelet::Ids override { return {}; } - - auto fillLaneletPose(CanonicalizedEntityStatus &) -> void override; - - auto getWaypoints() -> const traffic_simulator_msgs::msg::WaypointsArray override - { - return traffic_simulator_msgs::msg::WaypointsArray(); - } - - void requestSpeedChange(double, bool) override {} - - void requestSpeedChange(const speed_change::RelativeTargetSpeed &, bool) override {} - - void requestAssignRoute(const std::vector &) override {} - - void requestAssignRoute(const std::vector &) override {} - - void requestAcquirePosition(const CanonicalizedLaneletPose &) override {} - - void requestAcquirePosition(const geometry_msgs::msg::Pose &) override {} - - void requestSpeedChange( - const double, const speed_change::Transition, const speed_change::Constraint, - const bool) override - { - } - - auto getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter override; - - void setBehaviorParameter(const traffic_simulator_msgs::msg::BehaviorParameter &) override {} - - void setAccelerationLimit(double) override {} - - void setAccelerationRateLimit(double) override {} - - void setDecelerationLimit(double) override {} - - void setDecelerationRateLimit(double) override {} -}; -} // namespace entity -} // namespace traffic_simulator - -#endif // TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_HPP_ diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp index aa1b4becaff..f9516e14c47 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/simulation/traffic_simulator/src/entity/deleted_entity.cpp b/simulation/traffic_simulator/src/entity/deleted_entity.cpp deleted file mode 100644 index df255c58781..00000000000 --- a/simulation/traffic_simulator/src/entity/deleted_entity.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 TIER IV, Inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -namespace traffic_simulator -{ -namespace entity -{ -DeletedEntity::DeletedEntity( - const std::string & name, const CanonicalizedEntityStatus & entity_status, - const std::shared_ptr & hdmap_utils_ptr) -: EntityBase(name, entity_status, hdmap_utils_ptr) -{ - auto status = static_cast(status_); - status.action_status.twist = geometry_msgs::msg::Twist(); - status.action_status.accel = geometry_msgs::msg::Accel(); - status.action_status.linear_jerk = 0; - status.action_status.current_action = "static"; - status.bounding_box.dimensions.x = 0; - status.bounding_box.dimensions.y = 0; - status.bounding_box.dimensions.z = 0; - status_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); - status_before_update_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); -} - -auto DeletedEntity::getCurrentAction() const -> std::string { return "static"; } - -auto DeletedEntity::getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter -{ - return traffic_simulator_msgs::msg::BehaviorParameter(); -} - -auto DeletedEntity::getDefaultDynamicConstraints() const - -> const traffic_simulator_msgs::msg::DynamicConstraints & -{ - static const auto default_dynamic_constraints = []() { - auto dynamic_constraints = traffic_simulator_msgs::msg::DynamicConstraints(); - dynamic_constraints.max_speed = 0.0; - dynamic_constraints.max_acceleration = 0.0; - dynamic_constraints.max_acceleration_rate = 0.0; - dynamic_constraints.max_deceleration = 0.0; - dynamic_constraints.max_deceleration_rate = 0.0; - return dynamic_constraints; - }(); - - return default_dynamic_constraints; -} - -auto DeletedEntity::fillLaneletPose(CanonicalizedEntityStatus &) -> void {} - -} // namespace entity -} // namespace traffic_simulator diff --git a/simulation/traffic_simulator/src/entity/entity_manager.cpp b/simulation/traffic_simulator/src/entity/entity_manager.cpp index 10c405333de..0be94cd49a4 100644 --- a/simulation/traffic_simulator/src/entity/entity_manager.cpp +++ b/simulation/traffic_simulator/src/entity/entity_manager.cpp @@ -86,13 +86,7 @@ visualization_msgs::msg::MarkerArray EntityManager::makeDebugMarker() const bool EntityManager::despawnEntity(const std::string & name) { - if (!entityExists(name)) { - return false; - } - - entities_[name].reset(new DeletedEntity(name, getEntityStatus(name), hdmap_utils_ptr_)); - - return true; + return entityExists(name) && entities_.erase(name); } bool EntityManager::entityExists(const std::string & name) diff --git a/simulation/traffic_simulator_msgs/msg/EntityType.msg b/simulation/traffic_simulator_msgs/msg/EntityType.msg index e3489e0977d..3713f3efec9 100644 --- a/simulation/traffic_simulator_msgs/msg/EntityType.msg +++ b/simulation/traffic_simulator_msgs/msg/EntityType.msg @@ -2,5 +2,4 @@ uint8 EGO = 0 uint8 VEHICLE = 1 uint8 PEDESTRIAN = 2 uint8 MISC_OBJECT = 3 -uint8 DELETED = 255 uint8 type From 7854aa4565c1ac7ab8c574c3f011f7f984a4615c Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 17:04:39 +0900 Subject: [PATCH 06/16] doc: update ReleaseNotes.md --- docs/ReleaseNotes.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 113bfbe98a3..5db627e496f 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -9,8 +9,9 @@ Major Changes :race_car: :red_car: :blue_car: Bug Fixes:bug: -| Feature | Brief summary | Category | Pull request | Contributor | -| ------- | ------------- | -------- | ------------ | ----------- | +| Feature | Brief summary | Category | Pull request | Contributor | +| ------------ | -------------------------------------------- | ------------------- | ----------------------------------------------------------------- | --------------------------------------- | +| Revert #1096 | Revert incomplete fix for de-spawned entity. | `traffic_simulator` | [#1159](https://github.com/tier4/scenario_simulator_v2/pull/1159) | [HansRobo](https://github.com/HansRobo) | Minor Tweaks :oncoming_police_car: From 5cbb721f87b5f06bcf132199a4e697836e3338d7 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 21 Dec 2023 17:09:05 +0900 Subject: [PATCH 07/16] chore: fix linelint errors --- test_runner/random_test_runner/test/CMakeLists.txt | 1 - test_runner/random_test_runner/test/test_utils.hpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test_runner/random_test_runner/test/CMakeLists.txt b/test_runner/random_test_runner/test/CMakeLists.txt index 7ccd5ee44c0..7e8f497dd36 100644 --- a/test_runner/random_test_runner/test/CMakeLists.txt +++ b/test_runner/random_test_runner/test/CMakeLists.txt @@ -36,4 +36,3 @@ target_link_libraries(test_test_randomizer ${PROJECT_NAME}) target_link_libraries(test_junit_xml_reporter ${PROJECT_NAME}) target_link_libraries(test_yaml_test_params_saver ${PROJECT_NAME}) target_link_libraries(test_test_executor ${PROJECT_NAME}) - diff --git a/test_runner/random_test_runner/test/test_utils.hpp b/test_runner/random_test_runner/test/test_utils.hpp index e996904d49e..deadfd0053b 100644 --- a/test_runner/random_test_runner/test/test_utils.hpp +++ b/test_runner/random_test_runner/test/test_utils.hpp @@ -84,4 +84,4 @@ NPCDescription makeNPCDescription( description.speed = speed; description.start_position = lanelet_pose; return description; -} \ No newline at end of file +} From 57b71c950e979e7e64565652b192276f47508003 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 18 Jan 2024 15:04:51 +0900 Subject: [PATCH 08/16] Add repository `RobotecAI/scenario_simulator_v2_scenarios` to dependency Signed-off-by: yamacir-kit --- dependency_humble.repos | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dependency_humble.repos b/dependency_humble.repos index 831241efebb..6de497406c0 100644 --- a/dependency_humble.repos +++ b/dependency_humble.repos @@ -19,6 +19,10 @@ repositories: type: git url: https://github.com/OUXT-Polaris/color_names.git version: master + scenario_simulator_v2_scenarios: + type: git + url: https://github.com/RobotecAI/scenario_simulator_v2_scenarios.git + version: main tier4_msgs: type: git url: https://github.com/tier4/tier4_autoware_msgs.git From 20cfee16f2e0d11c90d7d80413fbcf83513cccf4 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 18 Jan 2024 15:07:19 +0900 Subject: [PATCH 09/16] Add new step `Basic test` to workflow `BuildAndRun` Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 72cc378c8a5..0f1d351e2ee 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -100,3 +100,9 @@ jobs: ros2 launch scenario_test_runner scenario_test_runner.launch.py workflow:='$(find-pkg-share scenario_test_runner)/config/workflow_example.yaml' global_frame_rate:=20 ros2 run scenario_test_runner result_checker.py /tmp/scenario_test_runner/result.junit.xml shell: bash + + - name: Basic test + run: | + ros2 launch scenario_test_runner scenario_test_runner.launch.py workflow:='$(find-pkg-share scenario_simulator_v2_scenarios)/workflow/basic.yaml' + ros2 run scenario_test_runner result_checker.py /tmp/scenario_test_runner/result.junit.xml + shell: bash From 1928f0d2e15cf77b77625be50fa1a3144e2ac02b Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 18 Jan 2024 16:25:34 +0900 Subject: [PATCH 10/16] Fix step `Basic test` to source setup scripts Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 0f1d351e2ee..9e858e70976 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -103,6 +103,8 @@ jobs: - name: Basic test run: | + source ~/ros2_ws/install/setup.bash + source ~/ros2_ws/install/local_setup.bash ros2 launch scenario_test_runner scenario_test_runner.launch.py workflow:='$(find-pkg-share scenario_simulator_v2_scenarios)/workflow/basic.yaml' ros2 run scenario_test_runner result_checker.py /tmp/scenario_test_runner/result.junit.xml shell: bash From 8810199c9fc0b30a3f47d320d1b579bfb9b0759c Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 18 Jan 2024 18:20:22 +0900 Subject: [PATCH 11/16] Update workflow `BuildAndRun` to clone test scenario repository Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 5 +++-- dependency_humble.repos | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 9e858e70976..dc7e48da0e6 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -39,10 +39,11 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - run: git clone https://github.com/RobotecAI/scenario_simulator_v2_scenarios.git + - name: Search packages in this repository id: list_packages - run: | - echo package_list=$(colcon list --names-only | sed -e ':loop; N; $!b loop; s/\n/ /g') >> $GITHUB_OUTPUT + run: echo package_list=$(colcon list --names-only | tr '\n' ' ') >> $GITHUB_OUTPUT - name: Show target packages run: | diff --git a/dependency_humble.repos b/dependency_humble.repos index 6de497406c0..831241efebb 100644 --- a/dependency_humble.repos +++ b/dependency_humble.repos @@ -19,10 +19,6 @@ repositories: type: git url: https://github.com/OUXT-Polaris/color_names.git version: master - scenario_simulator_v2_scenarios: - type: git - url: https://github.com/RobotecAI/scenario_simulator_v2_scenarios.git - version: main tier4_msgs: type: git url: https://github.com/tier4/tier4_autoware_msgs.git From 7d1f3c83645ddf935eeadaefd24918b09f3c10b7 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 19 Jan 2024 11:04:09 +0900 Subject: [PATCH 12/16] Update `BuildAndRun` to use `working-directory` instead of `cd` Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index dc7e48da0e6..8599eba170c 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -56,39 +56,39 @@ jobs: shell: bash - name: Install dependencies + working-directory: ~/ros2_ws run: | - cd ~/ros2_ws vcs import src < src/scenario_simulator_v2/dependency_${{ matrix.rosdistro }}.repos - name: Resolve rosdep + working-directory: ~/ros2_ws run: | - cd ~/ros2_ws - apt-get update + apt update apt install -y python3-pip rosdep update --include-eol-distros rosdep install -iy --from-paths src --rosdistro ${{ matrix.rosdistro }} shell: bash - name: Build packages + working-directory: ~/ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash - cd ~/ros2_ws colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_CPP_MOCK_SCENARIOS=ON --packages-up-to ${{ steps.list_packages.outputs.package_list }} shell: bash - name: Colcon test + working-directory: ~/ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash - cd ~/ros2_ws source install/local_setup.bash colcon test --packages-select ${{ steps.list_packages.outputs.package_list }} shell: bash - name: Show test result if: always() + working-directory: ~/ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash - cd ~/ros2_ws source install/local_setup.bash colcon test-result --verbose shell: bash @@ -96,8 +96,7 @@ jobs: - name: Scenario test run: | source ~/ros2_ws/install/setup.bash - cd ~/ros2_ws - source install/local_setup.bash + source ~/ros2_ws/install/local_setup.bash ros2 launch scenario_test_runner scenario_test_runner.launch.py workflow:='$(find-pkg-share scenario_test_runner)/config/workflow_example.yaml' global_frame_rate:=20 ros2 run scenario_test_runner result_checker.py /tmp/scenario_test_runner/result.junit.xml shell: bash From 294808aaabe20541dc9b1ba453b21eae2aeeb34c Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 19 Jan 2024 11:11:00 +0900 Subject: [PATCH 13/16] Fix `BuildAndRun`'s `working-directory` parameter to not include a tilde Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 8599eba170c..1bea82afd63 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -56,12 +56,12 @@ jobs: shell: bash - name: Install dependencies - working-directory: ~/ros2_ws + working-directory: ros2_ws run: | vcs import src < src/scenario_simulator_v2/dependency_${{ matrix.rosdistro }}.repos - name: Resolve rosdep - working-directory: ~/ros2_ws + working-directory: ros2_ws run: | apt update apt install -y python3-pip @@ -70,14 +70,14 @@ jobs: shell: bash - name: Build packages - working-directory: ~/ros2_ws + working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_CPP_MOCK_SCENARIOS=ON --packages-up-to ${{ steps.list_packages.outputs.package_list }} shell: bash - name: Colcon test - working-directory: ~/ros2_ws + working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash source install/local_setup.bash @@ -86,7 +86,7 @@ jobs: - name: Show test result if: always() - working-directory: ~/ros2_ws + working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash source install/local_setup.bash From 01907bda923d42ca671491e50bc612445dfb4bba Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 19 Jan 2024 11:56:49 +0900 Subject: [PATCH 14/16] Revert some changes Signed-off-by: yamacir-kit --- .github/workflows/BuildAndRun.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/BuildAndRun.yaml b/.github/workflows/BuildAndRun.yaml index 1bea82afd63..2f61567a4fa 100644 --- a/.github/workflows/BuildAndRun.yaml +++ b/.github/workflows/BuildAndRun.yaml @@ -43,7 +43,8 @@ jobs: - name: Search packages in this repository id: list_packages - run: echo package_list=$(colcon list --names-only | tr '\n' ' ') >> $GITHUB_OUTPUT + run: | + echo package_list=$(colcon list --names-only | tr '\n' ' ') >> $GITHUB_OUTPUT - name: Show target packages run: | @@ -56,13 +57,13 @@ jobs: shell: bash - name: Install dependencies - working-directory: ros2_ws run: | + cd ~/ros2_ws vcs import src < src/scenario_simulator_v2/dependency_${{ matrix.rosdistro }}.repos - name: Resolve rosdep - working-directory: ros2_ws run: | + cd ~/ros2_ws apt update apt install -y python3-pip rosdep update --include-eol-distros @@ -70,25 +71,25 @@ jobs: shell: bash - name: Build packages - working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash + cd ~/ros2_ws colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_CPP_MOCK_SCENARIOS=ON --packages-up-to ${{ steps.list_packages.outputs.package_list }} shell: bash - name: Colcon test - working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash + cd ~/ros2_ws source install/local_setup.bash colcon test --packages-select ${{ steps.list_packages.outputs.package_list }} shell: bash - name: Show test result if: always() - working-directory: ros2_ws run: | source /opt/ros/${{ matrix.rosdistro }}/setup.bash + cd ~/ros2_ws source install/local_setup.bash colcon test-result --verbose shell: bash From 5beffae6842331516c39677393eb54d230396742 Mon Sep 17 00:00:00 2001 From: Maxime CLEMENT Date: Fri, 26 Jan 2024 15:55:03 +0900 Subject: [PATCH 15/16] Add debug and virtual wall markers for dynamic_obstacle_avoidance Signed-off-by: Maxime CLEMENT --- .../config/scenario_simulator_v2.rviz | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/simulation/traffic_simulator/config/scenario_simulator_v2.rviz b/simulation/traffic_simulator/config/scenario_simulator_v2.rviz index 63651ca708e..c686533cb6d 100644 --- a/simulation/traffic_simulator/config/scenario_simulator_v2.rviz +++ b/simulation/traffic_simulator/config/scenario_simulator_v2.rviz @@ -2098,6 +2098,18 @@ Visualization Manager: Value: true Enabled: true Name: VirtualWall + - Class: rviz_default_plugins/MarkerArray + Enabled: true + Name: VirtualWall (DynamicObstacleStop) + Namespaces: + {} + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/virtual_wall/dynamic_obstacle_stop + Value: true - Class: rviz_common/Group Displays: - Class: rviz_default_plugins/MarkerArray @@ -2380,6 +2392,18 @@ Visualization Manager: Value: false Enabled: false Name: DebugMarker + - Class: rviz_default_plugins/MarkerArray + Enabled: false + Name: DynamicObstacleStop + Namespaces: + {} + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/debug/dynamic_obstacle_stop + Value: false - Class: rviz_common/Group Displays: - Class: rviz_default_plugins/MarkerArray From d43ab714a76077722e776ccc410974133632147e Mon Sep 17 00:00:00 2001 From: Maxime CLEMENT Date: Fri, 26 Jan 2024 16:21:27 +0900 Subject: [PATCH 16/16] fix indent Signed-off-by: Maxime CLEMENT --- .../config/scenario_simulator_v2.rviz | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/simulation/traffic_simulator/config/scenario_simulator_v2.rviz b/simulation/traffic_simulator/config/scenario_simulator_v2.rviz index c686533cb6d..72a64ca063a 100644 --- a/simulation/traffic_simulator/config/scenario_simulator_v2.rviz +++ b/simulation/traffic_simulator/config/scenario_simulator_v2.rviz @@ -2096,9 +2096,7 @@ Visualization Manager: Reliability Policy: Reliable Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/virtual_wall/no_drivable_lane Value: true - Enabled: true - Name: VirtualWall - - Class: rviz_default_plugins/MarkerArray + - Class: rviz_default_plugins/MarkerArray Enabled: true Name: VirtualWall (DynamicObstacleStop) Namespaces: @@ -2110,6 +2108,8 @@ Visualization Manager: Reliability Policy: Reliable Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/virtual_wall/dynamic_obstacle_stop Value: true + Enabled: true + Name: VirtualWall - Class: rviz_common/Group Displays: - Class: rviz_default_plugins/MarkerArray @@ -2390,8 +2390,6 @@ Visualization Manager: Reliability Policy: Reliable Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/debug/no_drivable_lane Value: false - Enabled: false - Name: DebugMarker - Class: rviz_default_plugins/MarkerArray Enabled: false Name: DynamicObstacleStop @@ -2404,6 +2402,8 @@ Visualization Manager: Reliability Policy: Reliable Value: /planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/debug/dynamic_obstacle_stop Value: false + Enabled: false + Name: DebugMarker - Class: rviz_common/Group Displays: - Class: rviz_default_plugins/MarkerArray