浏览代码

implemented distToTarget Instead of targetPos

/active-variablespeed
HH 4 年前
当前提交
0560848f
共有 3 个文件被更改,包括 72 次插入14 次删除
  1. 2
      Project/Assets/ML-Agents/Examples/Walker/Prefabs/Ragdoll/WalkerRagdollBase.prefab
  2. 45
      Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerStatic.unity
  3. 39
      Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs

2
Project/Assets/ML-Agents/Examples/Walker/Prefabs/Ragdoll/WalkerRagdollBase.prefab


m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 238
VectorObservationSize: 236
NumStackedVectorObservations: 1
VectorActionSize: 27000000
VectorActionDescriptions: []

45
Project/Assets/ML-Agents/Examples/Walker/Scenes/WalkerStatic.unity


propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (4)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1 &459314944

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (3)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1001 &833025198

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (9)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1001 &1109751809

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (2)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1001 &1136586021

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (7)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1 &1321968714 stripped

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (6)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1 &1409355320

propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (8)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}
--- !u!1001 &1679910049

type: 3}
propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (5)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}

type: 3}
propertyPath: m_Name
value: WalkerRagdollStSingleSpeedVariant (1)
objectReference: {fileID: 0}
- target: {fileID: 8228205183255163001, guid: c319a0a1c387d420a92f520b38ef875b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c319a0a1c387d420a92f520b38ef875b, type: 3}

39
Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs


sensor.AddObservation(walkingSpeed / m_maxWalkingSpeed);
sensor.AddObservation(Quaternion.FromToRotation(hips.forward, cubeForward));
sensor.AddObservation(Quaternion.FromToRotation(head.forward, cubeForward));
Vector3 targetPos = walkDirectionMethod == WalkDirectionMethod.UseTarget
? target.transform.position
// : hips.position + (dirToLook * 100);
// : m_OrientationCube.transform.TransformDirection(dirToLook * 100);
: m_OrientationCube.transform.position + (cubeForward * 100);
targetPos.y = 0;
Vector3 relPos = Vector3.ClampMagnitude(m_OrientationCube.transform.InverseTransformPoint(targetPos), 100);
sensor.AddObservation(relPos);
Debug.DrawRay(targetPos, Vector3.up, Color.green,1);
Debug.DrawRay(m_OrientationCube.transform.InverseTransformPoint(targetPos), Vector3.up * 2, Color.red,5);
// sensor.AddObservation(Vector3.ClampMagnitude(m_OrientationCube.transform.InverseTransformPoint(target.transform.position), 100)
// sensor.AddObservation(targetPos);
//Dist To Target Normalized to 100 meters;
//If we're walking in world dir, always return 1;
float distToTarget = walkDirectionMethod == WalkDirectionMethod.UseTarget
? (target.position - hips.position).magnitude/100
: 1;
sensor.AddObservation(distToTarget);
// Vector3 targetPos = walkDirectionMethod == WalkDirectionMethod.UseTarget
// ? target.transform.position
//// : hips.position + (dirToLook * 100);
//// : m_OrientationCube.transform.TransformDirection(dirToLook * 100);
// : m_OrientationCube.transform.position + (cubeForward * 100);
// targetPos.y = 0;
// Vector3 relPos = Vector3.ClampMagnitude(m_OrientationCube.transform.InverseTransformPoint(targetPos), 100);
// sensor.AddObservation(relPos);
// Debug.DrawRay(targetPos, Vector3.up, Color.green,1);
// Debug.DrawRay(m_OrientationCube.transform.InverseTransformPoint(targetPos), Vector3.up * 2, Color.red,5);
foreach (var bodyPart in m_JdController.bodyPartsList)
{

void FixedUpdate()
{
UpdateOrientationObjects();
// if (walkDirectionMethod == WalkDirectionMethod.UseWorldDirection)
// {
// Vector3 targetPos
// if(targetPos hips.position)
// }
var cubeForward = m_OrientationCube.transform.forward;
// Set reward for this step according to mixture of the following elements.

正在加载...
取消
保存