benson V6 har smadret racetrack 1

This commit is contained in:
2024-04-20 17:04:19 +02:00
parent 65607aebc4
commit d5b24b17ea
37 changed files with 134577 additions and 605 deletions

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: f2cb18df5dfc76442a641e5bc025fdb4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0
importMode: 1
weightsTypeMode: 0
activationTypeMode: 0

View File

@@ -1 +1 @@
{"count":1,"self":71.3308416,"total":564.2276214,"children":{"InitializeActuators":{"count":10,"self":0.0025063999999999998,"total":0.0025063999999999998,"children":null},"InitializeSensors":{"count":10,"self":0.0020006,"total":0.0020006,"children":null},"AgentSendState":{"count":104734,"self":3.1834852,"total":6.9912367,"children":{"CollectObservations":{"count":209470,"self":1.2111973,"total":1.2111973,"children":null},"WriteActionMask":{"count":209470,"self":0.10131609999999999,"total":0.10131609999999999,"children":null},"RequestDecision":{"count":209470,"self":0.4577849,"total":2.4952381999999997,"children":{"AgentInfo.ToProto":{"count":209470,"self":0.4025186,"total":2.0374532999999997,"children":{"GenerateSensorData":{"count":209470,"self":1.3459704,"total":1.6349346999999999,"children":{"RayPerceptionSensor.Perceive":{"count":418940,"self":0.2889643,"total":0.2889643,"children":null}}}}}}}}},"DecideAction":{"count":104734,"self":358.0066304,"total":358.00662489999996,"children":null},"AgentAct":{"count":104734,"self":127.88074239999999,"total":127.89341119999999,"children":{"AgentInfo.ToProto":{"count":819,"self":0.0010191,"total":0.012669399999999999,"children":{"GenerateSensorData":{"count":819,"self":0.011148,"total":0.011650299999999999,"children":{"RayPerceptionSensor.Perceive":{"count":1638,"self":0.0005023,"total":0.0005023,"children":null}}}}}}}},"gauges":{"BensonV5.CumulativeReward":{"count":819,"max":11.6134615,"min":0.537391961,"runningAverage":10.37029,"value":11.4620371,"weightedAverage":9.683728}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713616473","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId e08cc479-296a-466a-a392-68af5330fc09 -accessToken S1StEIprioU2rzDDo5vTCfsRe2zgz-zUchvR2e0iCUQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"AI training","end_time_seconds":"1713617037"}}
{"count":1,"self":32.069286399999996,"total":32.6511512,"children":{"InitializeActuators":{"count":10,"self":0.0010176,"total":0.0010176,"children":null},"InitializeSensors":{"count":10,"self":0.0015512,"total":0.0015512,"children":null},"AgentSendState":{"count":1385,"self":0.0759091,"total":0.1266493,"children":{"CollectObservations":{"count":2770,"self":0.0294204,"total":0.0294204,"children":null},"WriteActionMask":{"count":2770,"self":0.0010054999999999999,"total":0.0010054999999999999,"children":null},"RequestDecision":{"count":2770,"self":0.017293299999999998,"total":0.0203143,"children":{"RayPerceptionSensor.Perceive":{"count":4986,"self":0.003021,"total":0.003021,"children":null}}}}},"DecideAction":{"count":1385,"self":0.2520318,"total":0.2545522,"children":{"RayPerceptionSensor.Perceive":{"count":554,"self":0.0025204,"total":0.0025204,"children":null}}},"AgentAct":{"count":1385,"self":0.1965915,"total":0.1965915,"children":{"RayPerceptionSensor.Perceive":{"count":72,"self":0,"total":0,"children":null}}}},"gauges":{"BensonV6.CumulativeReward":{"count":37,"max":24.2855549,"min":-0.0275001545,"runningAverage":0.629609466,"value":24.2855549,"weightedAverage":6.05076361}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713624371","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId e08cc479-296a-466a-a392-68af5330fc09 -accessToken S1StEIprioU2rzDDo5vTCfsRe2zgz-zUchvR2e0iCUQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"AI training","end_time_seconds":"1713624404"}}

View File

@@ -279,7 +279,7 @@ GameObject:
m_Component:
- component: {fileID: 193802083315334602}
m_Layer: 0
m_Name: TrainingV4
m_Name: TrainingV2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -1121,10 +1121,10 @@ PrefabInstance:
addedObject: {fileID: 1228817729644437253}
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
insertIndex: -1
addedObject: {fileID: 1639575900821545436}
addedObject: {fileID: 2582194196424739661}
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
insertIndex: -1
addedObject: {fileID: 6232026075062764434}
addedObject: {fileID: 8245043561086062929}
m_SourcePrefab: {fileID: 100100000, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
--- !u!4 &105864364744706313 stripped
Transform:
@@ -1149,7 +1149,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 7
VectorObservationSize: 6
NumStackedVectorObservations: 1
m_ActionSpec:
m_NumContinuousActions: 0
@@ -1158,15 +1158,15 @@ MonoBehaviour:
VectorActionDescriptions: []
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 0}
m_Model: {fileID: 5022602860645237092, guid: f2cb18df5dfc76442a641e5bc025fdb4, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: BensonV5
m_BehaviorName: BensonV6
TeamId: 0
m_UseChildSensors: 1
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &1639575900821545436
--- !u!114 &2582194196424739661
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -1175,7 +1175,7 @@ MonoBehaviour:
m_GameObject: {fileID: 360449495197158213}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a31c1c1fd9a962429d7742f2cd1ac61, type: 3}
m_Script: {fileID: 11500000, guid: e504560e573e8634db5ced380452680f, type: 3}
m_Name:
m_EditorClassIdentifier:
agentParameters:
@@ -1207,7 +1207,7 @@ MonoBehaviour:
maxStepsPerCheckpoint: 300
distanceBetweenCheckpoints: 12
ignoreMentalPain: 1
--- !u!114 &6232026075062764434
--- !u!114 &8245043561086062929
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b341ab9d1c90ec94ca57298c7d0a4eeb
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -123,189 +123,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &334245626
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (6)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &526098640
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 50
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (8)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &742882787
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 150
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (9)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1 &765367128
GameObject:
m_ObjectHideFlags: 0
@@ -398,128 +215,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1001 &830421161
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 150
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (3)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &836204927
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 50
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (1)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &915493271
PrefabInstance:
m_ObjectHideFlags: 0
@@ -530,7 +225,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.x
value: 2.5158076
value: 61.01581
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.y
@@ -538,23 +233,23 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.z
value: 5.4411907
value: 21.94119
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.w
value: 0.97014254
value: 0.6859944
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0.24253564
value: 0.17149861
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 0.6859944
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: -0.17149861
objectReference: {fileID: 0}
- target: {fileID: 320316327550477191, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -650,7 +345,7 @@ PrefabInstance:
objectReference: {fileID: 1673238739}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.x
value: 2.5158076
value: 61.01581
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.y
@@ -658,23 +353,23 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalPosition.z
value: 5.4411907
value: 21.94119
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.w
value: 0.97014254
value: 0.6859944
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.x
value: 0.24253564
value: 0.17149861
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 0.6859944
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: -0.17149861
objectReference: {fileID: 0}
- target: {fileID: 8890610309520933432, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -958,67 +653,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
m_PrefabInstance: {fileID: 1175324936}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1399613449
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (2)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &1574695326
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1190,70 +824,9 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
--- !u!4 &1673238739 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 105864364744706313, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
m_PrefabInstance: {fileID: 7847784393444387584}
m_CorrespondingSourceObject: {fileID: 5717467054321889237, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
m_PrefabInstance: {fileID: 3501671592297850731}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1792933722
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 200
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (4)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1 &2015283366 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4840733166066636179, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
@@ -1271,7 +844,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1e8b78ac948f05a46a6d8339a503172b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &2032319799
--- !u!1001 &3501671592297850731
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@@ -1279,177 +852,63 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 3797832664772287022, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_Name
value: TrainingV3
objectReference: {fileID: 0}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalPosition.z
value: 100
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
- target: {fileID: 5516939357876673302, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (5)
- target: {fileID: 7923332692670229905, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: maxStepsPerCheckpoint
value: 400
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
- target: {fileID: 7923332692670229905, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
propertyPath: distanceBetweenCheckpoints
value: 20
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &2102622621
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 200
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 100
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4 (7)
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
--- !u!1001 &7847784393444387584
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 193802083315334602, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
propertyPath: m_Name
value: TrainingV4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: b341ab9d1c90ec94ca57298c7d0a4eeb, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -1459,13 +918,4 @@ SceneRoots:
- {fileID: 915493271}
- {fileID: 1175324936}
- {fileID: 765367131}
- {fileID: 7847784393444387584}
- {fileID: 2032319799}
- {fileID: 836204927}
- {fileID: 526098640}
- {fileID: 1399613449}
- {fileID: 334245626}
- {fileID: 830421161}
- {fileID: 742882787}
- {fileID: 1792933722}
- {fileID: 2102622621}
- {fileID: 3501671592297850731}

View File

@@ -1,18 +1,317 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Actuators;
using UnityEngine.UIElements;
using System.Linq;
using Unity.Mathematics;
using Unity.VisualScripting;
using System.Reflection;
using System;
public class AgentControllerV6 : MonoBehaviour
public class AgentControllerV6 : Agent
{
public float motorTorque = 300;
public float brakeTorque = 500;
public float maxSpeed = 400;
public float steeringRange = 9;
public float steeringRangeAtMaxSpeed = 7;
public float autoBrake = 100;
WheelControl[] wheels;
Rigidbody rigidBody;
public List<GameObject> checkpoints;
Vector3 startPosition;
Quaternion startRotation;
int currentStep = 0;
float totalReward = 0;
float totalMentalPain = 0;
int stepsSinceCheckpoint = 0;
int checkpointsReached = 0;
public int maxStepsPerCheckpoint = 300;
public int distanceBetweenCheckpoints = 5;
public bool ignoreMentalPain = false;
// Start is called before the first frame update
void Start()
{
rigidBody = GetComponent<Rigidbody>();
// Find all child GameObjects that have the WheelControl script attached
wheels = GetComponentsInChildren<WheelControl>();
startPosition = transform.localPosition;
startRotation = transform.localRotation;
}
// Update is called once per frame
void Update()
public override void OnEpisodeBegin()
{
stepsSinceCheckpoint = 0;
checkpointsReached = 0;
totalReward = 0;
totalMentalPain = 0;
// reset wheels
foreach (var wheel in wheels)
{
wheel.WheelCollider.brakeTorque = 0;
wheel.WheelCollider.motorTorque = 0;
wheel.WheelCollider.steerAngle = 0;
}
// reset car
transform.localPosition = startPosition;
transform.localRotation = startRotation;
rigidBody.velocity = Vector3.zero;
rigidBody.angularVelocity = Vector3.zero;
// reset checkpoints
foreach (GameObject checkpoint in checkpoints)
{
checkpoint.GetComponent<Checkpoint>().isCollected = false;
}
}
}
public override void CollectObservations(VectorSensor sensor)
{
Transform currentCheckpoint = checkpoints[0].transform;
foreach (GameObject checkpoint in checkpoints)
{
bool isCollected = checkpoint.GetComponent<Checkpoint>().isCollected;
if (!isCollected)
{
currentCheckpoint = checkpoint.transform;
break;
}
}
// distance to next checkpoint
sensor.AddObservation(distanceToCheckpoint(currentCheckpoint));
// relative angle to checkpoint
sensor.AddObservation(angleToCheckpoint(currentCheckpoint));
// relative vector pointing to checkpoint
Vector3 position = transform.localPosition;
Vector3 checkpointPosition = currentCheckpoint.localPosition;
Vector3 toCheckpoint = new Vector3(
checkpointPosition.x - position.x,
0,
checkpointPosition.z - position.z
);
float carAngle = transform.localEulerAngles.y;
toCheckpoint = Quaternion.Euler(0, -carAngle, 0) * toCheckpoint.normalized;
sensor.AddObservation(toCheckpoint.x);
sensor.AddObservation(toCheckpoint.z);
// relative Velocity
Vector3 velocity = new Vector3(
rigidBody.velocity.x,
0,
rigidBody.velocity.z
);
Vector3 relativeVelocity = Quaternion.Euler(0, -carAngle, 0) * velocity;
sensor.AddObservation(relativeVelocity.x);
sensor.AddObservation(relativeVelocity.z);
}
public override void OnActionReceived(ActionBuffers actions)
{
// Actions size = 2 [vertical speed, horizontal speed] = [-1..1, -1..1] // discrete = [{0, 1, 2}, {0, 1, 2}] = [{-1, 0, 1}...]
float vInput = 0;
float hInput = 0;
if (actions.DiscreteActions[0] == 0)
vInput = -1f;
if (actions.DiscreteActions[0] == 1)
vInput = 1f;
if (actions.DiscreteActions[1] == 0)
hInput = -1f;
if (actions.DiscreteActions[1] == 1)
hInput = 1f;
// give benson mental pain for existing (punishment for maximizing first checkpoint by standing still)
// AddReward(-0.002f);
AddReward(-0.0018f); // less pain because of V4
totalMentalPain -= 0.0018f;
if (ignoreMentalPain)
totalReward -= 0.0018f;
float forwardSpeed = Vector3.Dot(transform.forward, rigidBody.velocity);
// Calculate how close the car is to top speed
// as a number from zero to one
float speedFactor = Mathf.InverseLerp(0, maxSpeed / 4, forwardSpeed);
// Use that to calculate how much torque is available
// (zero torque at top speed)
float currentMotorTorque = Mathf.Lerp(motorTorque, 0, speedFactor);
// …and to calculate how much to steer
// (the car steers more gently at top speed)
float currentSteerRange = Mathf.Lerp(steeringRange, steeringRangeAtMaxSpeed, speedFactor);
// Check whether the user input is in the same direction
// as the car's velocity
bool isAccelerating = Mathf.Sign(vInput) == Mathf.Sign(forwardSpeed);
bool isStopping = vInput == 0; // range
bool isBraking = (vInput < 0 && forwardSpeed > 0) || (vInput > 0 && forwardSpeed < 0);
if (vInput > 0 && forwardSpeed < 0)
{
isAccelerating = false;
}
foreach (var wheel in wheels)
{
// Apply steering to Wheel colliders that have "Steerable" enabled
if (wheel.steerable)
{
wheel.WheelCollider.steerAngle = hInput * currentSteerRange;
}
if (isBraking)
{
wheel.WheelCollider.brakeTorque = Mathf.Abs(vInput) * brakeTorque;
//wheel.WheelCollider.motorTorque = 0;
}
if (isAccelerating)
{
// Apply torque to Wheel colliders that have "Motorized" enabled
if (wheel.motorized)
{
wheel.WheelCollider.motorTorque = vInput * currentMotorTorque;
}
wheel.WheelCollider.brakeTorque = 0;
}
if (isStopping)
{
// If the user is trying to go in the opposite direction
// apply brakes to all wheels
wheel.WheelCollider.brakeTorque = Mathf.Abs(vInput) * brakeTorque + autoBrake;
if (forwardSpeed < 0)
{
wheel.WheelCollider.brakeTorque = (Mathf.Abs(vInput) * brakeTorque + autoBrake) * 5;
}
}
}
// rewards
Transform currentCheckpoint = checkpoints[0].transform;
foreach (GameObject checkpoint in checkpoints)
{
bool isCollected = checkpoint.GetComponent<Checkpoint>().isCollected;
if (!isCollected)
{
currentCheckpoint = checkpoint.transform;
break;
}
}
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
float reward = (1 - Mathf.InverseLerp(0, distanceBetweenCheckpoints, checkpintDistance)) / 500;
totalReward += reward;
AddReward(reward);
float checkpointAngle = angleToCheckpoint(currentCheckpoint);
if (checkpointAngle > 0)
reward = (1 - Mathf.InverseLerp(0, 60, checkpointAngle)) / 2000;
else
reward = Mathf.InverseLerp(-60, 0, checkpointAngle) / 2000;
AddReward(reward);
if (checkpintDistance < 0.1f)
{
currentCheckpoint.GetComponent<Checkpoint>().isCollected = true;
stepsSinceCheckpoint = 0;
checkpointsReached += 1;
// If last checkpoint
if (currentCheckpoint == checkpoints[checkpoints.Count - 1].transform)
{
AddReward(10f);
EndEpisode();
}
//TODO fix variable names
AddReward(1f);
AddReward(-totalReward);
totalReward = 0;
print("checkpoint");
}
currentStep += 1;
stepsSinceCheckpoint += 1;
if (stepsSinceCheckpoint >= maxStepsPerCheckpoint)
{
stepsSinceCheckpoint = 0;
EndEpisode();
}
// print(GetCumulativeReward());
}
public override void Heuristic(in ActionBuffers actionsOut)
{
var discreteActionsOut = actionsOut.DiscreteActions;
discreteActionsOut[0] = 2;
discreteActionsOut[1] = 2;
if (Input.GetAxis("Vertical") < -0.5)
discreteActionsOut[0] = 0;
if (Input.GetAxis("Vertical") > 0.5)
discreteActionsOut[0] = 1;
if (Input.GetAxis("Horizontal") < -0.5)
discreteActionsOut[1] = 0;
if (Input.GetAxis("Horizontal") > 0.5)
discreteActionsOut[1] = 1;
}
// finds distance from agent to closest point on the checkpoint line
float distanceToCheckpoint(Transform checkpoint)
{
var closestPoint = checkpoint.GetComponent<Collider>().ClosestPointOnBounds(transform.position);
var distanceToCheckpoint = Vector3.Distance(transform.position, closestPoint);
return distanceToCheckpoint;
}
float angleToCheckpoint(Transform checkpoint)
{
Vector3 checkpointDirection = checkpoint.localPosition - transform.localPosition;
float angle = Vector3.SignedAngle(transform.forward, checkpointDirection, Vector3.up);
return angle;
}
}