benson V5 har cooket
This commit is contained in:
@@ -1 +1 @@
|
||||
{"count":1,"self":111.86097919999999,"total":112.7056501,"children":{"InitializeActuators":{"count":1,"self":0.0010004999999999999,"total":0.0010004999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.0020055,"total":0.0020055,"children":null},"AgentSendState":{"count":5396,"self":0.072008599999999992,"total":0.112703,"children":{"CollectObservations":{"count":1080,"self":0.0271168,"total":0.0271168,"children":null},"WriteActionMask":{"count":1080,"self":0,"total":0,"children":null},"RequestDecision":{"count":1080,"self":0.013577599999999999,"total":0.013577599999999999,"children":null}}},"DecideAction":{"count":5396,"self":0.5794904,"total":0.58251979999999992,"children":{"RayPerceptionSensor.Perceive":{"count":2160,"self":0.0030294,"total":0.0030294,"children":null}}},"AgentAct":{"count":5396,"self":0.1464373,"total":0.1464373,"children":null}},"gauges":{"BensonV4.CumulativeReward":{"count":7,"max":5.96420574,"min":5.79276133,"runningAverage":5.889879,"value":5.87086153,"weightedAverage":5.89014149}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713539474","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 391732a6-a2b0-4a93-b4a3-321236b9bad5 -accessToken 3KS6Z2WtkqT-u9ZbvfSgVazd2aJBTKTOTKNuyMYuWDs005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"AI training","end_time_seconds":"1713539587"}}
|
||||
{"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"}}
|
||||
@@ -13,7 +13,7 @@ GameObject:
|
||||
- component: {fileID: 1915818325675539370}
|
||||
- component: {fileID: 3466260334280045808}
|
||||
- component: {fileID: 5655726606384773670}
|
||||
m_Layer: 0
|
||||
m_Layer: 2
|
||||
m_Name: CheckPoint
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
||||
@@ -9,7 +9,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3871044324247212909}
|
||||
m_Layer: 0
|
||||
m_Layer: 2
|
||||
m_Name: Rewards
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -267,8 +267,8 @@ MonoBehaviour:
|
||||
m_ObservationStacks: 1
|
||||
rayHitColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
rayMissColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_StartVerticalOffset: 0.25
|
||||
m_EndVerticalOffset: 0.25
|
||||
m_StartVerticalOffset: 0.2
|
||||
m_EndVerticalOffset: 0.2
|
||||
--- !u!1 &8832687267391831282
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -355,6 +355,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (7)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -422,6 +426,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (8)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -489,6 +497,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (13)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -556,6 +568,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (2)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -623,6 +639,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (11)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -694,6 +714,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (1)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -761,6 +785,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (10)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -828,6 +856,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (3)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -895,6 +927,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (6)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -944,7 +980,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 4361687674892069559, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3}
|
||||
- target: {fileID: 3310781390057679429, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5418785709807611868, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: maxSpeed
|
||||
@@ -1032,11 +1068,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7302242925535239009, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7906150893989788378, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7953198523918571078, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
@@ -1064,7 +1100,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8790375192439221064, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 5418785709807611868, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
@@ -1085,13 +1121,10 @@ PrefabInstance:
|
||||
addedObject: {fileID: 1228817729644437253}
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 3354859547742687855}
|
||||
addedObject: {fileID: 1639575900821545436}
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 2481429082858237285}
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 6023538107748668233}
|
||||
addedObject: {fileID: 6232026075062764434}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
--- !u!4 &105864364744706313 stripped
|
||||
Transform:
|
||||
@@ -1116,7 +1149,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_BrainParameters:
|
||||
VectorObservationSize: 6
|
||||
VectorObservationSize: 7
|
||||
NumStackedVectorObservations: 1
|
||||
m_ActionSpec:
|
||||
m_NumContinuousActions: 0
|
||||
@@ -1128,28 +1161,12 @@ MonoBehaviour:
|
||||
m_Model: {fileID: 0}
|
||||
m_InferenceDevice: 0
|
||||
m_BehaviorType: 0
|
||||
m_BehaviorName: BensonV4
|
||||
m_BehaviorName: BensonV5
|
||||
TeamId: 0
|
||||
m_UseChildSensors: 1
|
||||
m_UseChildActuators: 1
|
||||
m_ObservableAttributeHandling: 0
|
||||
--- !u!114 &3354859547742687855
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 360449495197158213}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f2902496c0120472b90269f94a0aec7e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Record: 0
|
||||
NumStepsToRecord: 0
|
||||
DemonstrationName: BensonV4
|
||||
DemonstrationDirectory:
|
||||
--- !u!114 &2481429082858237285
|
||||
--- !u!114 &1639575900821545436
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -1158,15 +1175,19 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 360449495197158213}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f5cda3de98f45464999f00bdd795f2a0, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 2a31c1c1fd9a962429d7742f2cd1ac61, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
agentParameters:
|
||||
maxStep: 0
|
||||
hasUpgradedFromAgentParameters: 1
|
||||
MaxStep: 0
|
||||
motorForce: 500
|
||||
steeringRange: 2
|
||||
motorTorque: 300
|
||||
brakeTorque: 500
|
||||
maxSpeed: 400
|
||||
steeringRange: 9
|
||||
steeringRangeAtMaxSpeed: 7
|
||||
autoBrake: 100
|
||||
checkpoints:
|
||||
- {fileID: 8925203239849578955}
|
||||
- {fileID: 8821007502236365947}
|
||||
@@ -1183,9 +1204,10 @@ MonoBehaviour:
|
||||
- {fileID: 8751309615715668357}
|
||||
- {fileID: 3783507094856640719}
|
||||
- {fileID: 1250869111078240827}
|
||||
maxStepsPerCheckpoint: 200
|
||||
maxStepsPerCheckpoint: 300
|
||||
distanceBetweenCheckpoints: 12
|
||||
--- !u!114 &6023538107748668233
|
||||
ignoreMentalPain: 1
|
||||
--- !u!114 &6232026075062764434
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -1251,6 +1273,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (5)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -1318,6 +1344,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (14)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -1459,6 +1489,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (4)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -1526,6 +1560,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (9)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -1593,6 +1631,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (15)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -1660,6 +1702,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Checkpoint (12)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7234834637752836426, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
||||
@@ -323,7 +323,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!81 &765367129
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -578,7 +578,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1387890555408215438, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2100622393876020061, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
|
||||
propertyPath: CameraSide
|
||||
@@ -1254,100 +1254,6 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
|
||||
--- !u!1 &1847426965
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1847426967}
|
||||
- component: {fileID: 1847426966}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &1847426966
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1847426965}
|
||||
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: 1
|
||||
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: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1847426967
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1847426965}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 100}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &2015283366 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4840733166066636179, guid: 80c5f8bcfe7e033419638b39d9a278c4, type: 3}
|
||||
@@ -1535,14 +1441,6 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1228817729644437253, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
|
||||
propertyPath: m_Model
|
||||
value:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1228817729644437253, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
|
||||
propertyPath: m_BehaviorType
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8832687267391831282, guid: a3462884d5dfc9e49a4a1c1abb5c98e7, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: TrainingV4
|
||||
@@ -1557,7 +1455,6 @@ SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 1051678512}
|
||||
- {fileID: 1847426967}
|
||||
- {fileID: 1574695326}
|
||||
- {fileID: 915493271}
|
||||
- {fileID: 1175324936}
|
||||
|
||||
293
Assets/Scripts/AgentControllerV5.cs
Normal file
293
Assets/Scripts/AgentControllerV5.cs
Normal file
@@ -0,0 +1,293 @@
|
||||
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 AgentControllerV5 : 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;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Agent rotation
|
||||
sensor.AddObservation(transform.localRotation.y);
|
||||
|
||||
Vector3 position = transform.localPosition;
|
||||
Vector3 checkpointPosition = currentCheckpoint.localPosition;
|
||||
|
||||
Vector2 toCheckpoint = new Vector2(
|
||||
checkpointPosition.x - position.x,
|
||||
checkpointPosition.z - position.z
|
||||
);
|
||||
|
||||
// Normalized vector in direction of checkpoint and distancce to checkpoint.
|
||||
sensor.AddObservation(toCheckpoint.normalized);
|
||||
sensor.AddObservation(distanceToCheckpoint(currentCheckpoint));
|
||||
|
||||
|
||||
Vector2 velocity = new Vector2(rigidBody.velocity.x, rigidBody.velocity.z);
|
||||
|
||||
// Velocity
|
||||
sensor.AddObservation(velocity);
|
||||
|
||||
sensor.AddObservation(angleToCheckpoint(currentCheckpoint));
|
||||
}
|
||||
|
||||
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)) / 1000;
|
||||
|
||||
totalReward += reward;
|
||||
AddReward(reward);
|
||||
|
||||
print(GetCumulativeReward().ToString());
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/AgentControllerV5.cs.meta
Normal file
11
Assets/Scripts/AgentControllerV5.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a31c1c1fd9a962429d7742f2cd1ac61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Scripts/AgentControllerV6.cs
Normal file
18
Assets/Scripts/AgentControllerV6.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AgentControllerV6 : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/AgentControllerV6.cs.meta
Normal file
11
Assets/Scripts/AgentControllerV6.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e504560e573e8634db5ced380452680f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user