Implemented Academy / Set GoalPoint / Bug: Training does not move agents
This commit is contained in:
@@ -10,7 +10,7 @@ public class GridAgent : Agent
|
||||
public float timeBetweenDecisionsAtInference;
|
||||
private float timeSinceDecision;
|
||||
|
||||
[Tooltip("Because we want an observation right before making a decision, we can force " +
|
||||
[Tooltip("Because we want an observation right before making a decision, we can force " +
|
||||
"a camera to render before making a decision. Place the agentCam here if using " +
|
||||
"RenderTexture as observations.")]
|
||||
public Camera renderCamera;
|
||||
@@ -48,8 +48,8 @@ public class GridAgent : Agent
|
||||
private void SetMask()
|
||||
{
|
||||
// Prevents the agent from picking an action that would make it collide with a wall
|
||||
var positionX = (int) transform.position.x;
|
||||
var positionZ = (int) transform.position.z;
|
||||
var positionX = (int)transform.position.x;
|
||||
var positionZ = (int)transform.position.z;
|
||||
var maxPosition = academy.gridSize - 1;
|
||||
|
||||
if (positionX == 0)
|
||||
@@ -108,17 +108,17 @@ public class GridAgent : Agent
|
||||
|
||||
if (blockTest.Where(col => col.gameObject.CompareTag("goal")).ToArray().Length == 1)
|
||||
{
|
||||
Done();
|
||||
SetReward(1f);
|
||||
}
|
||||
if (blockTest.Where(col => col.gameObject.CompareTag("pit")).ToArray().Length == 1)
|
||||
{
|
||||
Done();
|
||||
SetReward(-1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// to be implemented by the developer
|
||||
public override void AgentReset()
|
||||
{
|
||||
@@ -132,7 +132,7 @@ public class GridAgent : Agent
|
||||
|
||||
private void WaitTimeInference()
|
||||
{
|
||||
if(renderCamera != null)
|
||||
if (renderCamera != null)
|
||||
{
|
||||
renderCamera.Render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user