diff --git a/Assets/Tests/PlayMode/VehicleDynamics.meta b/Assets/Tests/PlayMode/VehicleDynamics.meta new file mode 100644 index 000000000..725ac63d4 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fb6ee2443e776dbda83605ed63d883e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/PlayMode/VehicleDynamics/Settings.meta b/Assets/Tests/PlayMode/VehicleDynamics/Settings.meta new file mode 100644 index 000000000..03372cc30 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a989424583e51a6d393680cb02c4a913 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset b/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset new file mode 100644 index 000000000..ec3ef4116 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset @@ -0,0 +1,370 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3768527809937896628 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d7593b3a9277ac4696b20006c21dde2, type: 3} + m_Name: VisualEnvironment + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + skyType: + m_OverrideState: 1 + m_Value: 1 + skyAmbientMode: + m_OverrideState: 1 + m_Value: 0 + fogType: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: TestVolumeProfile + m_EditorClassIdentifier: + components: + - {fileID: 1062231254598306812} + - {fileID: -3768527809937896628} + - {fileID: 6553751843573519693} + - {fileID: 5701176100694489548} +--- !u!114 &1062231254598306812 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7ddcec8a8eb2d684d833ac8f5d26aebd, type: 3} + m_Name: HDShadowSettings + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + maxShadowDistance: + m_OverrideState: 1 + m_Value: 500 + min: 0 + directionalTransmissionMultiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + max: 1 + cascadeShadowSplitCount: + m_OverrideState: 0 + m_Value: 4 + min: 1 + max: 4 + cascadeShadowSplit0: + m_OverrideState: 0 + m_Value: 0.05 + cascadeShadowSplit1: + m_OverrideState: 0 + m_Value: 0.15 + cascadeShadowSplit2: + m_OverrideState: 0 + m_Value: 0.3 + cascadeShadowBorder0: + m_OverrideState: 0 + m_Value: 0 + cascadeShadowBorder1: + m_OverrideState: 0 + m_Value: 0 + cascadeShadowBorder2: + m_OverrideState: 0 + m_Value: 0 + cascadeShadowBorder3: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &5701176100694489548 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2d08ce26990eb1a4a9177b860541e702, type: 3} + m_Name: Exposure + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + mode: + m_OverrideState: 1 + m_Value: 0 + meteringMode: + m_OverrideState: 0 + m_Value: 2 + luminanceSource: + m_OverrideState: 0 + m_Value: 1 + fixedExposure: + m_OverrideState: 1 + m_Value: 13 + compensation: + m_OverrideState: 1 + m_Value: -0.4 + limitMin: + m_OverrideState: 0 + m_Value: -1 + limitMax: + m_OverrideState: 0 + m_Value: 14 + curveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -10 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 20 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + limitMinCurveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -12 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 18 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + limitMaxCurveMap: + m_OverrideState: 0 + m_Value: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -10 + value: -8 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 20 + value: 22 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + adaptationMode: + m_OverrideState: 0 + m_Value: 1 + adaptationSpeedDarkToLight: + m_OverrideState: 0 + m_Value: 3 + min: 0.001 + adaptationSpeedLightToDark: + m_OverrideState: 0 + m_Value: 1 + min: 0.001 + weightTextureMask: + m_OverrideState: 0 + m_Value: {fileID: 0} + histogramPercentages: + m_OverrideState: 0 + m_Value: {x: 40, y: 90} + min: 0 + max: 100 + histogramUseCurveRemapping: + m_OverrideState: 0 + m_Value: 0 + targetMidGray: + m_OverrideState: 0 + m_Value: 0 + centerAroundExposureTarget: + m_OverrideState: 0 + m_Value: 0 + proceduralCenter: + m_OverrideState: 0 + m_Value: {x: 0.5, y: 0.5} + proceduralRadii: + m_OverrideState: 0 + m_Value: {x: 0.3, y: 0.3} + maskMinIntensity: + m_OverrideState: 0 + m_Value: -30 + maskMaxIntensity: + m_OverrideState: 0 + m_Value: 30 + proceduralSoftness: + m_OverrideState: 0 + m_Value: 0.5 + min: 0 +--- !u!114 &6553751843573519693 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} + m_Name: HDRISky + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 1 + m_Value: 1 + exposure: + m_OverrideState: 0 + m_Value: 0 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxColor: + m_OverrideState: 0 + m_Value: {x: 0, y: 0, z: 0} + desiredLuxValue: + m_OverrideState: 1 + m_Value: 10000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + hdriSky: + m_OverrideState: 0 + m_Value: {fileID: 0} + enableDistortion: + m_OverrideState: 1 + m_Value: 0 + procedural: + m_OverrideState: 0 + m_Value: 1 + flowmap: + m_OverrideState: 0 + m_Value: {fileID: 0} + upperHemisphereOnly: + m_OverrideState: 0 + m_Value: 1 + scrollDirection: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + scrollSpeed: + m_OverrideState: 0 + m_Value: 2 + min: 0 + enableBackplate: + m_OverrideState: 0 + m_Value: 0 + backplateType: + m_OverrideState: 0 + m_Value: 0 + groundLevel: + m_OverrideState: 0 + m_Value: 0 + scale: + m_OverrideState: 0 + m_Value: {x: 32, y: 32} + projectionDistance: + m_OverrideState: 0 + m_Value: 16 + min: 0.0000001 + plateRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexOffset: + m_OverrideState: 0 + m_Value: {x: 0, y: 0} + blendAmount: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 100 + shadowTint: + m_OverrideState: 0 + m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + pointLightShadow: + m_OverrideState: 0 + m_Value: 0 + dirLightShadow: + m_OverrideState: 0 + m_Value: 0 + rectLightShadow: + m_OverrideState: 0 + m_Value: 0 diff --git a/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset.meta b/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset.meta new file mode 100644 index 000000000..cba8045e5 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/Settings/TestVolumeProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f332f61f827568157a12edcab1c726ac +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs new file mode 100644 index 000000000..458245c38 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs @@ -0,0 +1,734 @@ +using NUnit.Framework; +using UnityEngine; +using UnityEngine.TestTools; +using System.Collections; +using UnityEditor.SceneManagement; +using UnityEngine.SceneManagement; +using UnityEngine.TestTools.Utils; +using AWSIM; +using ROS2; + +/// +/// The VehicleDynamicsTest class manages the testing of the ego vehicle dynamics. +/// It handles loading the necessary scenes and executing tests to validate the vehicle's behavior. +/// +public class VehicleDynamicsTest +{ + // Scene handlers + string sceneName = "VehicleDynamicsTest"; + Scene scene; + PhysicsScene physicsScene; + + // Ego handlers + GameObject egoGameObject; + Vehicle egoVehicle; + VehicleRos2Input egoRosInput; + + // ROS publishers + ROS2.IPublisher gearCommandPublisher; + ROS2.IPublisher movementPublisher; + + // Gear commands + autoware_auto_vehicle_msgs.msg.GearCommand parkGearCommand = new autoware_auto_vehicle_msgs.msg.GearCommand() + { + Command = autoware_auto_vehicle_msgs.msg.GearCommand.PARK + }; + autoware_auto_vehicle_msgs.msg.GearCommand driveGearCommand = new autoware_auto_vehicle_msgs.msg.GearCommand() + { + Command = autoware_auto_vehicle_msgs.msg.GearCommand.DRIVE + }; + + // Move commands + autoware_auto_control_msgs.msg.AckermannControlCommand moveCommand = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = 1.0f + } + }; + autoware_auto_control_msgs.msg.AckermannControlCommand breakCommand = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = -2.0f + } + }; + + // Turn commands + autoware_auto_control_msgs.msg.AckermannControlCommand leftCommand = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = 1.0f + }, + Lateral = new autoware_auto_control_msgs.msg.AckermannLateralCommand() { + Steering_tire_angle = 0.6f + } + }; + autoware_auto_control_msgs.msg.AckermannControlCommand rightCommand = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = 1.0f + }, + Lateral = new autoware_auto_control_msgs.msg.AckermannLateralCommand() { + Steering_tire_angle = -0.6f + } + }; + + // Shared settings + QoSSettings qosSettings = new QoSSettings() + { + ReliabilityPolicy = ReliabilityPolicy.QOS_POLICY_RELIABILITY_RELIABLE, + DurabilityPolicy = DurabilityPolicy.QOS_POLICY_DURABILITY_TRANSIENT_LOCAL, + HistoryPolicy = HistoryPolicy.QOS_POLICY_HISTORY_KEEP_LAST + }; + + private float acceptableErrorDistance = 0.01f; + + + // --- TEST LIFE CYCLE ---// + + /// + /// A method called by Unity at the start of each test. + /// + [UnitySetUp] + public IEnumerator Setup() + { + yield return LoadSceneAsync(); + yield return GetEgoComponents(); + yield return CreateEgoCommonPublihers(); + yield return new WaitForFixedUpdate(); + } + + /// + /// A method to load the Unity scene and local physics scene dedicated to the vehicle dynamics test. + /// + private IEnumerator LoadSceneAsync() + { + LoadSceneParameters parameters = new LoadSceneParameters(LoadSceneMode.Single, LocalPhysicsMode.Physics3D); + AsyncOperation aOp = EditorSceneManager.LoadSceneAsync(sceneName, parameters); + + yield return new WaitUntil(() => aOp.isDone); + scene = EditorSceneManager.GetSceneByName(sceneName); + EditorSceneManager.SetActiveScene(scene); + + physicsScene = PhysicsSceneExtensions.GetPhysicsScene(scene); + + Assert.NotNull(scene); + Assert.NotNull(physicsScene); + } + + /// + /// A method collects the required components of the tested vehicle. + /// + private IEnumerator GetEgoComponents() + { + egoVehicle = GameObject.FindObjectOfType(); + egoGameObject = egoVehicle.gameObject; + egoRosInput = egoGameObject.GetComponentInChildren(); + + Assert.NotNull(egoRosInput); + Assert.NotNull(egoVehicle); + + yield return new WaitForFixedUpdate(); + } + + /// + /// A method creates the necessary publishers for the tested vehicle. + /// + private IEnumerator CreateEgoCommonPublihers() + { + string gearChangeTopic = egoRosInput.GetPrivateFieldValue("gearCommandTopic"); + gearCommandPublisher = SimulatorROS2Node.CreatePublisher( + gearChangeTopic, + qosSettings.GetQoSProfile() + ); + + string movementTopic = egoRosInput.GetPrivateFieldValue("ackermannControlCommandTopic"); + movementPublisher = SimulatorROS2Node.CreatePublisher( + movementTopic, + qosSettings.GetQoSProfile() + ); + yield return new WaitForFixedUpdate(); + } + + /// + /// A method called by Unity at the end of each test. + /// + [UnityTearDown] + public IEnumerator TearDown() + { + yield return new WaitForFixedUpdate(); + yield return RemoveEgoCommonPublishers(); + yield return RemoveEgoVehicle(); + } + + /// + /// A method for disposing the tested vehicle. + /// + private IEnumerator RemoveEgoVehicle() + { + Rigidbody rb = egoVehicle.GetComponent(); + rb.isKinematic = true; + + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + + GameObject.DestroyImmediate(egoVehicle.gameObject); + egoVehicle = null; + egoGameObject = null; + egoRosInput = null; + + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + } + + /// + /// A method removes the used publishers for the tested vehicle. + /// + private IEnumerator RemoveEgoCommonPublishers() + { + SimulatorROS2Node.RemovePublisher(movementPublisher); + SimulatorROS2Node.RemovePublisher(gearCommandPublisher); + + yield return new WaitForFixedUpdate(); + } + + + + // --- TEST ROUTINES --- // + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given time when a low acceleration value is applied. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_StraightMove_LowAcceleration() + { + Vector3 expectedEndPosition = new Vector3(0.0005525741f, -0.07694209f, 3.983599f); + float accel = 0.5f; + + autoware_auto_control_msgs.msg.AckermannControlCommand moveCmd = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = accel + } + }; + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle gear to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Apply acceleration + movementPublisher.Publish(moveCmd); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given time when a moderate acceleration value is applied. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_StraightMove_MiddleAcceleration() + { + Vector3 expectedEndPosition = new Vector3(0.003112176f, -0.07788333f, 7.9672f); + float accel = 1.0f; + + autoware_auto_control_msgs.msg.AckermannControlCommand moveCmd = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = accel + } + }; + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Apply acceleration + movementPublisher.Publish(moveCmd); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given time when a high acceleration value is applied. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_StraightMove_HighAcceleration() + { + Vector3 expectedEndPosition = new Vector3(0.01421936f, -0.07976329f, 15.9344f); + float accel = 2.0f; + + autoware_auto_control_msgs.msg.AckermannControlCommand moveCmd = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = accel + } + }; + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Apply acceleration + movementPublisher.Publish(moveCmd); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given commands to perform a left turn manoeuvre. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_TurnLeft() + { + Vector3 expectedEndPosition = new Vector3(-17.19837f, -0.07222256f, 16.39548f); + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 4 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Turn left by 90 deg + movementPublisher.Publish(leftCommand); + for(int i=0; i<262; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 2 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<120; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given commands to perform a right turn manoeuvre. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_TurnRight() + { + Vector3 expectedEndPosition = new Vector3(17.31582f, -0.07222262f, 16.27713f); + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 4 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Turn left by 90 deg + movementPublisher.Publish(rightCommand); + for(int i=0; i<262; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 2 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<120; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given commands to perform a U-turn manoeuvre. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_UTurn() + { + Vector3 expectedEndPosition = new Vector3(9.046477f, -0.07222325f, -3.879607f); + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 4 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Turn by 180 deg + movementPublisher.Publish(rightCommand); + for(int i=0; i<395; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward for 2 seconds + movementPublisher.Publish(moveCommand); + for(int i=0; i<120; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break for 4 seconds + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + + /// + /// Test Outline: + /// - A test to check the correct behaviour of the vehicle. + /// - The test checks the position of the vehicle after a given commands to perform a line change manoeuvre. + /// - The physics is manually simulated by calling the PhysicsScene.Simulate(deltaTime) method. + /// Test Target: + /// - Check if the vehicle script responsible for receiving commands works correctly. + /// - Verify the simulation of the vehicle physics. + /// Expected Result: + /// - The distance between 'expectedEndPosition' and the vehicle's position at the end of the test is equal to or less than 0.01f. + /// + [UnityTest] + public IEnumerator VehicleDynamics_LineChange() + { + Vector3 expectedEndPosition = new Vector3(2.553552f, -0.07222325f, 28.81023f); + + autoware_auto_control_msgs.msg.AckermannControlCommand leftCmd = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = 1.0f + }, + Lateral = new autoware_auto_control_msgs.msg.AckermannLateralCommand() { + Steering_tire_angle = 0.0872f + } + }; + + autoware_auto_control_msgs.msg.AckermannControlCommand rightCmd = new autoware_auto_control_msgs.msg.AckermannControlCommand() + { + Longitudinal = new autoware_auto_control_msgs.msg.LongitudinalCommand() { + Acceleration = 1.0f + }, + Lateral = new autoware_auto_control_msgs.msg.AckermannLateralCommand() { + Steering_tire_angle = -0.0872f + } + }; + + + // Initial physics simulation steps + for(int i=0; i<10; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to PARK + gearCommandPublisher.Publish(parkGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // Set Vehicle to DRIVE + gearCommandPublisher.Publish(driveGearCommand); + for(int i=0; i<6; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // move forward + movementPublisher.Publish(moveCommand); + for(int i=0; i<120; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // change to right line + movementPublisher.Publish(rightCmd); + for(int i=0; i<159; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + movementPublisher.Publish(leftCmd); + for(int i=0; i<96; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + // break + movementPublisher.Publish(breakCommand); + for(int i=0; i<240; i++) + { + physicsScene.Simulate(Time.fixedDeltaTime); + yield return new WaitForFixedUpdate(); + } + + float distanceToExpectedPosition = Vector3.Distance(expectedEndPosition, egoGameObject.transform.position); + Assert.That(Utils.AreFloatsEqual(0.0f, distanceToExpectedPosition, acceptableErrorDistance), Is.True); + } + +} diff --git a/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs.meta b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs.meta new file mode 100644 index 000000000..87839a210 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dac093a3f9b1ab2a5bdea3391ec55aa0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity new file mode 100644 index 000000000..d3381bc2f --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity @@ -0,0 +1,837 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &220815745 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 220815747} + - component: {fileID: 220815746} + m_Layer: 0 + m_Name: Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &220815746 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 220815745} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: f332f61f827568157a12edcab1c726ac, type: 2} +--- !u!4 &220815747 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 220815745} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &332453149 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 332453151} + - component: {fileID: 332453150} + - component: {fileID: 332453152} + m_Layer: 0 + m_Name: Environment + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &332453150 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332453149} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da2e1ff5f05f87a4f8ded134767d5b24, type: 3} + m_Name: + m_EditorClassIdentifier: + mgrsOffsetPosition: {x: 0, y: 0, z: 0} + mgrsGridZone: +--- !u!4 &332453151 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332453149} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &332453152 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 332453149} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5603a893e02b41ffa847870219ef3c3f, type: 3} + m_Name: + m_EditorClassIdentifier: + meshSource: 2 + semanticCategoryDictionaryFile: +--- !u!1 &780626756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 780626759} + - component: {fileID: 780626758} + - component: {fileID: 780626757} + - component: {fileID: 780626760} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &780626757 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 780626756} + m_Enabled: 1 +--- !u!20 &780626758 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 780626756} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &780626759 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 780626756} + m_LocalRotation: {x: -0.06890602, y: -0.39094955, z: 0.029435921, w: -0.917357} + m_LocalPosition: {x: -5.977283, y: 2.2547038, z: -2.433487} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &780626760 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 780626756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 7 + m_ObsoleteRenderingPath: 0 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + clearColorMode: 0 + backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0} + clearDepth: 1 + volumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + volumeAnchorOverride: {fileID: 0} + antialiasing: 0 + SMAAQuality: 2 + dithering: 0 + stopNaNs: 0 + taaSharpenStrength: 0.5 + TAAQuality: 1 + taaHistorySharpening: 0.35 + taaAntiFlicker: 0.5 + taaMotionVectorRejection: 0 + taaAntiHistoryRinging: 0 + physicalParameters: + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + flipYMode: 0 + xrRendering: 1 + fullscreenPassthrough: 0 + allowDynamicResolution: 0 + customRenderingSettings: 0 + invertFaceCulling: 0 + probeLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + hasPersistentHistory: 0 + exposureTarget: {fileID: 0} + m_RenderingPathCustomFrameSettings: + bitDatas: + data1: 72198262773251917 + data2: 13763000468760363032 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 20 + materialQuality: 0 + renderingPathCustomFrameSettingsOverrideMask: + mask: + data1: 0 + data2: 0 + defaultFrameSettings: 0 +--- !u!1001 &1039584826 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3089313591046698684, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4981081891045692864, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_Name + value: Lexus RX450h 2015 Sample Sensor + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5650763240072318842, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 164645b2d105b6b4ab4e3d2e7c65dab2, type: 3} +--- !u!1 &1317237649 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1317237653} + - component: {fileID: 1317237652} + - component: {fileID: 1317237651} + - component: {fileID: 1317237650} + m_Layer: 7 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!64 &1317237650 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1317237649} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &1317237651 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1317237649} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 257 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: da5adce89d38a3c48ac3ed12df97c9f4, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1317237652 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1317237649} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1317237653 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1317237649} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 10, y: 1, z: 10} + m_Children: [] + m_Father: {fileID: 1686629229} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1426995553 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1426995555} + - component: {fileID: 1426995554} + - component: {fileID: 1426995556} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1426995554 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1426995553} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 100000 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 2 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 1 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1426995555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1426995553} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &1426995556 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1426995553} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 11 + m_ObsoleteShadowResolutionTier: 1 + m_ObsoleteUseShadowQualitySettings: 0 + m_ObsoleteCustomShadowResolution: 512 + m_ObsoleteContactShadows: 0 + m_PointlightHDType: 0 + m_SpotLightShape: 0 + m_AreaLightShape: 0 + m_Intensity: 100000 + m_EnableSpotReflector: 1 + m_LuxAtDistance: 1 + m_InnerSpotPercent: 0 + m_SpotIESCutoffPercent: 100 + m_LightDimmer: 1 + m_VolumetricDimmer: 1 + m_LightUnit: 2 + m_FadeDistance: 10000 + m_VolumetricFadeDistance: 10000 + m_AffectDiffuse: 1 + m_AffectSpecular: 1 + m_NonLightmappedOnly: 0 + m_ShapeWidth: 0.5 + m_ShapeHeight: 0.5 + m_AspectRatio: 1 + m_ShapeRadius: 0.025 + m_SoftnessScale: 1 + m_UseCustomSpotLightShadowCone: 0 + m_CustomSpotLightShadowCone: 30 + m_MaxSmoothness: 0.99 + m_ApplyRangeAttenuation: 1 + m_DisplayAreaLightEmissiveMesh: 0 + m_AreaLightCookie: {fileID: 0} + m_IESPoint: {fileID: 0} + m_IESSpot: {fileID: 0} + m_IncludeForRayTracing: 1 + m_AreaLightShadowCone: 120 + m_UseScreenSpaceShadows: 0 + m_InteractsWithSky: 1 + m_AngularDiameter: 0.5 + m_FlareSize: 2 + m_FlareTint: {r: 1, g: 1, b: 1, a: 1} + m_FlareFalloff: 4 + m_SurfaceTexture: {fileID: 0} + m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} + m_Distance: 1.5e+11 + m_UseRayTracedShadows: 0 + m_NumRayTracingSamples: 4 + m_FilterTracedShadow: 1 + m_FilterSizeTraced: 16 + m_SunLightConeAngle: 0.5 + m_LightShadowRadius: 0.5 + m_SemiTransparentShadow: 0 + m_ColorShadow: 1 + m_DistanceBasedFiltering: 0 + m_EvsmExponent: 15 + m_EvsmLightLeakBias: 0 + m_EvsmVarianceBias: 0.00001 + m_EvsmBlurPasses: 0 + m_LightlayersMask: 1 + m_LinkShadowLayers: 1 + m_ShadowNearPlane: 0.1 + m_BlockerSampleCount: 24 + m_FilterSampleCount: 16 + m_MinFilterSize: 0.1 + m_KernelSize: 5 + m_LightAngle: 1 + m_MaxDepthBias: 0.001 + m_ShadowResolution: + m_Override: 512 + m_UseOverride: 1 + m_Level: 0 + m_ShadowDimmer: 1 + m_VolumetricShadowDimmer: 1 + m_ShadowFadeDistance: 10000 + m_UseContactShadow: + m_Override: 0 + m_UseOverride: 1 + m_Level: 0 + m_RayTracedContactShadow: 0 + m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} + m_PenumbraTint: 0 + m_NormalBias: 0.75 + m_SlopeBias: 0.5 + m_ShadowUpdateMode: 0 + m_AlwaysDrawDynamicShadows: 0 + m_UpdateShadowOnLightMovement: 0 + m_CachedShadowTranslationThreshold: 0.01 + m_CachedShadowAngularThreshold: 0.5 + m_BarnDoorAngle: 90 + m_BarnDoorLength: 0.05 + m_preserveCachedShadow: 0 + m_OnDemandShadowRenderOnPlacement: 1 + m_ShadowCascadeRatios: + - 0.05 + - 0.2 + - 0.3 + m_ShadowCascadeBorders: + - 0.2 + - 0.2 + - 0.2 + - 0.2 + m_ShadowAlgorithm: 0 + m_ShadowVariant: 0 + m_ShadowPrecision: 0 + useOldInspector: 0 + useVolumetric: 1 + featuresFoldout: 1 + showAdditionalSettings: 0 + m_AreaLightEmissiveMeshShadowCastingMode: 0 + m_AreaLightEmissiveMeshMotionVectorGenerationMode: 0 + m_AreaLightEmissiveMeshLayer: -1 +--- !u!1 &1686629228 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1686629229} + m_Layer: 7 + m_Name: Ground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1686629229 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1686629228} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1317237653} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity.meta b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity.meta new file mode 100644 index 000000000..8fec77c55 --- /dev/null +++ b/Assets/Tests/PlayMode/VehicleDynamics/VehicleDynamicsTest.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3797dd5df5a19c8e6a66342db8c3cf49 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: