From 7c16cb0c7109453b353af321d02d4cd651163478 Mon Sep 17 00:00:00 2001 From: taikitanaka3 Date: Tue, 10 Oct 2023 15:40:05 +0900 Subject: [PATCH] chore: change to ObjectClassification Class --- ...Classification.cs => ObjectClassification.cs} | 2 +- ...tion.cs.meta => ObjectClassification.cs.meta} | 0 .../PerceptionResultRos2Publisher.cs | 16 ++++++++-------- .../PerceptionResultSensor.cs | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) rename Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/{Classification.cs => ObjectClassification.cs} (86%) rename Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/{Classification.cs.meta => ObjectClassification.cs.meta} (100%) diff --git a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/Classification.cs b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/ObjectClassification.cs similarity index 86% rename from Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/Classification.cs rename to Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/ObjectClassification.cs index faaef56c2..0d42019b6 100644 --- a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/Classification.cs +++ b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/ObjectClassification.cs @@ -2,7 +2,7 @@ namespace AWSIM { -public class Classification : MonoBehaviour +public class ObjectClassification : MonoBehaviour { // Attach this script to target object to enable perception result sensor public enum ObjectType diff --git a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/Classification.cs.meta b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/ObjectClassification.cs.meta similarity index 100% rename from Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/Classification.cs.meta rename to Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/ObjectClassification.cs.meta diff --git a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultRos2Publisher.cs b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultRos2Publisher.cs index 7cc55e258..c30221269 100644 --- a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultRos2Publisher.cs +++ b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultRos2Publisher.cs @@ -79,28 +79,28 @@ void Publish(PerceptionResultSensor.OutputData outputData) { switch (detectedObject.classification) { - case Classification.ObjectType.UNKNOWN: + case ObjectClassification.ObjectType.UNKNOWN: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.UNKNOWN; break; - case Classification.ObjectType.CAR: + case ObjectClassification.ObjectType.CAR: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.CAR; break; - case Classification.ObjectType.TRUCK: + case ObjectClassification.ObjectType.TRUCK: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.TRUCK; break; - case Classification.ObjectType.BUS: + case ObjectClassification.ObjectType.BUS: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.BUS; break; - case Classification.ObjectType.TRAILER: + case ObjectClassification.ObjectType.TRAILER: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.TRAILER; break; - case Classification.ObjectType.MOTORCYCLE: + case ObjectClassification.ObjectType.MOTORCYCLE: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.MOTORCYCLE; break; - case Classification.ObjectType.BICYCLE: + case ObjectClassification.ObjectType.BICYCLE: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.BICYCLE; break; - case Classification.ObjectType.PEDESTRIAN: + case ObjectClassification.ObjectType.PEDESTRIAN: classification.Label = autoware_auto_perception_msgs.msg.ObjectClassification.PEDESTRIAN; break; default: diff --git a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultSensor.cs b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultSensor.cs index cd017f679..989ef50ec 100644 --- a/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultSensor.cs +++ b/Assets/AWSIM/Scripts/Sensors/PerceptionResultSensor/PerceptionResultSensor.cs @@ -23,7 +23,7 @@ public class DetectedObject public Rigidbody rigidBody; public Vector3 dimension; public Vector2[] bounds; - public Classification.ObjectType classification; + public ObjectClassification.ObjectType classification; } public class OutputData @@ -52,11 +52,11 @@ public class OutputData public OnOutputDataDelegate OnOutputData; float timer = 0; public OutputData outputData = new OutputData(); - private List filteredObjects = new List(); + private List filteredObjects = new List(); [Header("Hint: Manually attaching classification objects is quicker.")] [Header("Warning: Objects without a rigidbody are not supported for classification.")] - public Classification[] cachedObjectsWithClassification; + public ObjectClassification[] cachedObjectsWithClassification; private bool manuallyCached = true; // This method generates a footprint for the vehicle based on its dimensions, position, and rotation. @@ -92,7 +92,7 @@ Vector2[] GenerateFootprint(Vector3 dimensions, Rigidbody vehicleRb) void CreateDetectedObjectData(){ outputData.objects = new DetectedObject[cachedObjectsWithClassification.Length]; for (int i = 0; i < cachedObjectsWithClassification.Length; i++) { - Classification obj = cachedObjectsWithClassification[i]; + ObjectClassification obj = cachedObjectsWithClassification[i]; outputData.objects[i] = new DetectedObject(); // add classification outputData.objects[i].classification = obj.objectType; @@ -129,7 +129,7 @@ void Start() // Check if cachedObjectsWithClassification is empty if(cachedObjectsWithClassification == null || cachedObjectsWithClassification.Length == 0) { - cachedObjectsWithClassification = FindObjectsOfType(); + cachedObjectsWithClassification = FindObjectsOfType(); manuallyCached = false; } CreateDetectedObjectData(); @@ -146,7 +146,7 @@ void FixedUpdate() timer = 0; outputData.origin = this.transform; if(!manuallyCached){ - var currentObjectsWithClassification = FindObjectsOfType(); + var currentObjectsWithClassification = FindObjectsOfType(); if (!Enumerable.SequenceEqual(cachedObjectsWithClassification, currentObjectsWithClassification)) { cachedObjectsWithClassification = currentObjectsWithClassification; CreateDetectedObjectData();