Browse Source

added splooting

main
cailean 7 months ago
parent
commit
9f193da92c
  1. BIN
      Assets/2_Chair/Brains/Sitting.onnx
  2. 16
      Assets/2_Chair/Brains/Sitting.onnx.meta
  3. 11
      Assets/2_Chair/Chair.prefab
  4. 12
      Assets/6_Scenes/Beep.unity
  5. 33
      Assets/7_Scripts/Agent/Walker.cs
  6. 5
      Assets/7_Scripts/Model Swapping/ModelSwap.cs
  7. 2
      Assets/ML-Agents/Timers/Beep_timers.json

BIN
Assets/2_Chair/Brains/Sitting.onnx

Binary file not shown.

16
Assets/2_Chair/Brains/Sitting.onnx.meta

@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 873bd5685b6fba74da8024c42ff3f0e6
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

11
Assets/2_Chair/Chair.prefab

@ -2037,7 +2037,7 @@ MonoBehaviour:
VectorActionDescriptions: []
VectorActionSpaceType: 1
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 5022602860645237092, guid: 00d0acaeb52a3894a9b8ca8c664b12db, type: 3}
m_Model: {fileID: 5022602860645237092, guid: 873bd5685b6fba74da8024c42ff3f0e6, type: 3}
m_InferenceDevice: 1
m_BehaviorType: 2
m_BehaviorName: c_Walker
@ -2062,14 +2062,14 @@ MonoBehaviour:
maxStep: 0
hasUpgradedFromAgentParameters: 1
MaxStep: 0
m_SelectedBrain: 4
m_SelectedBrain: 5
m_TargetWalkingSpeed: 8
rWalkSpeedEachEpisode: 0
m_RandomiseYRotation: 0
m_RandomiseXYZRotation: 0
m_ModelSwap: 1
m_ModelSwap: 0
m_ProximitySwapper: 0
m_SwitchModelAfterFalling: 1
m_SwitchModelAfterFalling: 0
m_StepCountAtLastMeter: 0
m_LastXPosition: 0
m_FinishedSwap: 0
@ -2131,13 +2131,14 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4d4f1f9b90b1b3949a25ccabbf8429d4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_InitialModel: {fileID: 5022602860645237092, guid: 00d0acaeb52a3894a9b8ca8c664b12db,
m_InitialModel: {fileID: 5022602860645237092, guid: 873bd5685b6fba74da8024c42ff3f0e6,
type: 3}
nnModelList:
- {fileID: 5022602860645237092, guid: 1dc2dd8bd62c1ce47b13f1740b15e522, type: 3}
- {fileID: 5022602860645237092, guid: 00d0acaeb52a3894a9b8ca8c664b12db, type: 3}
- {fileID: 5022602860645237092, guid: 4e2e22c8058641f4f943af2d50b147f6, type: 3}
- {fileID: 5022602860645237092, guid: 4564a8c073c3e134b96ce1698dbae60b, type: 3}
- {fileID: 5022602860645237092, guid: 873bd5685b6fba74da8024c42ff3f0e6, type: 3}
agent: {fileID: 0}
currentModel: 0
m_currentModelName:

12
Assets/6_Scenes/Beep.unity

@ -305,7 +305,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 83569712}
serializedVersion: 2
m_LocalRotation: {x: 0.08817883, y: 0.62572265, z: -0.07149482, w: 0.771741}
m_LocalRotation: {x: 0.08817881, y: 0.62572265, z: -0.07149482, w: 0.77174103}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -870,7 +870,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0}
GateFit: 1
FocusDistance: 8.93528
m_SensorSize: {x: 36, y: 24}
m_SensorSize: {x: 1, y: 1}
Iso: 50
ShutterSpeed: 0.0005
Aperture: 2.2
@ -913,7 +913,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 377437129}
serializedVersion: 2
m_LocalRotation: {x: -0.03783878, y: 0.8817097, z: -0.071784794, w: -0.46476156}
m_LocalRotation: {x: -0.037838772, y: 0.8817097, z: -0.071784794, w: -0.46476156}
m_LocalPosition: {x: -128.4, y: 13, z: -248.6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -951,7 +951,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0}
GateFit: 1
FocusDistance: 10
m_SensorSize: {x: 36, y: 24}
m_SensorSize: {x: 1, y: 1}
Iso: 50
ShutterSpeed: 0.0005
Aperture: 1.9
@ -1345,7 +1345,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 470663197}
serializedVersion: 2
m_LocalRotation: {x: 0.11851885, y: 0.6224197, z: -0.09609434, w: 0.7676672}
m_LocalRotation: {x: 0.118518844, y: 0.6224197, z: -0.096094325, w: 0.7676672}
m_LocalPosition: {x: -1.3505859, y: -4.517355, z: -13.63147}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2875,7 +2875,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1178814724}
serializedVersion: 2
m_LocalRotation: {x: 0.11851883, y: 0.6224197, z: -0.0960943, w: 0.76766723}
m_LocalRotation: {x: 0.11851882, y: 0.6224197, z: -0.09609432, w: 0.7676672}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0

33
Assets/7_Scripts/Agent/Walker.cs

@ -23,7 +23,9 @@ public class Walker : Agent
Getup,
Climber,
Balance,
DMScrambler
DMScrambler,
Sitting,
Treadmill
}
public Brain m_SelectedBrain;
@ -359,6 +361,18 @@ public class Walker : Agent
//AddReward(matchSpeedReward * lookAtTargetReward * DistanceFromTarget(20f));
AddReward(-0.002f);
}
else if (m_SelectedBrain == Brain.Sitting)
{
var height = CheckHeightRaycast();
var clampedHeight = Mathf.Pow((1 - height), 2);
//Debug.Log($"Clamped Height: {Mathf.Pow(clampedHeight,2)}");
AddReward(clampedHeight);
}
else if (m_SelectedBrain == Brain.Treadmill)
{
Debug.Log(DistanceFromTarget(5f));
AddReward(matchSpeedReward * lookAtTargetReward * DistanceFromTarget(5f));
}
}
// Use regular update to listen for keypresses
@ -466,11 +480,20 @@ public class Walker : Agent
return new Vector2(DeltaAngle(seat.eulerAngles.x), DeltaAngle(seat.eulerAngles.z));
}
float DistanceFromGround()
float CheckHeightRaycast()
{
float normalizedValue = Mathf.Clamp01((seat.position.y) / 3.0f);
Debug.Log(seat.position.y / 3.0f);
return Mathf.Pow(normalizedValue, 2);
RaycastHit hit;
if (Physics.Raycast(seat.transform.position, transform.TransformDirection(Vector3.down), out hit, Mathf.Infinity))
{
Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance, Color.red);
return hit.distance / 2;
}
else
{
Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward), Color.blue);
return 1;
}
}
float GetAverageXPositionFeet()

5
Assets/7_Scripts/Model Swapping/ModelSwap.cs

@ -69,6 +69,11 @@ public class ModelSwap : MonoBehaviour
agent.m_SelectedBrain = Walker.Brain.Getup;
m_currentModelName = modelName;
}
else if (modelName.Equals("Sitting"))
{
agent.m_SelectedBrain = Walker.Brain.Sitting;
m_currentModelName = modelName;
}
Debug.Log("Current Model: " + nnModelList[currentModel].name);
}

2
Assets/ML-Agents/Timers/Beep_timers.json

@ -1 +1 @@
{"count":1,"self":1517.6329216,"total":1518.486978,"children":{"InitializeActuators":{"count":1,"self":0.0039019999999999997,"total":0.0039019999999999997,"children":null},"InitializeSensors":{"count":1,"self":0.008347,"total":0.008347,"children":null},"AgentSendState":{"count":1372,"self":0.025497,"total":0.359039,"children":{"CollectObservations":{"count":275,"self":0.009477,"total":0.009477,"children":null},"WriteActionMask":{"count":275,"self":0.0012109999999999998,"total":0.0012109999999999998,"children":null},"RequestDecision":{"count":275,"self":0.322854,"total":0.322854,"children":null}}},"DecideAction":{"count":1372,"self":0.443955,"total":0.452791,"children":{"RayPerceptionSensor.Perceive":{"count":275,"self":0.008836,"total":0.008836,"children":null}}},"AgentAct":{"count":1372,"self":0.029858,"total":0.029858,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710170111","unity_version":"2023.2.8f1","command_line_arguments":"\/Applications\/Unity\/Hub\/Editor\/2023.2.8f1\/Unity.app\/Contents\/MacOS\/Unity -projectpath \/Users\/scn\/Documents\/BB_Beauty & The Beep\/12 Unity\/git\/beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710171630"}}
{"count":1,"self":13.661582399999999,"total":25.3009114,"children":{"InitializeActuators":{"count":1,"self":0,"total":0,"children":null},"InitializeSensors":{"count":1,"self":0.0025104,"total":0.0025104,"children":null},"AgentSendState":{"count":935,"self":0.0075565999999999993,"total":0.0362207,"children":{"CollectObservations":{"count":187,"self":0.0089777,"total":0.0089777,"children":null},"WriteActionMask":{"count":187,"self":0,"total":0,"children":null},"RequestDecision":{"count":187,"self":0.0196864,"total":0.0196864,"children":null}}},"DecideAction":{"count":935,"self":0.9864811,"total":11.5925809,"children":{"RayPerceptionSensor.Perceive":{"count":187,"self":10.6061,"total":10.606099799999999,"children":null}}},"AgentAct":{"count":935,"self":0.0070177,"total":0.0070177,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710174516","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710174542"}}
Loading…
Cancel
Save