bensonV3 preperation

This commit is contained in:
2024-04-12 13:06:03 +02:00
113 changed files with 14394 additions and 62 deletions

View File

@@ -79,10 +79,9 @@ public class AgentController : Agent
break;
}
}
float checkpointAngle = angleToCheckpoint(currentCheckpoint);
float checkpointDistance = distanceToCheckpoint(currentCheckpoint);
sensor.AddObservation(checkpointDistance);
sensor.AddObservation(checkpointAngle);
// Agent velocity
var FullVelocityMagnitude = rigidBody.velocity.magnitude; // Velocity including angular velocity
@@ -218,14 +217,6 @@ public class AgentController : Agent
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
print("forward " + transform.forward);
Vector3 checkpointDirection = currentCheckpoint.localPosition - transform.localPosition;
print("checkpoint direction " + checkpointDirection);
//print(angleToCheckpoint(currentCheckpoint));
// float reward = (1 - Mathf.InverseLerp(0, 20, checkpintDistance)) / 1000;
// AddReward(reward);
@@ -284,7 +275,7 @@ public class AgentController : Agent
{
Vector3 checkpointDirection = checkpoint.localPosition - transform.localPosition;
float angle = Vector3.Angle(transform.forward, checkpointDirection);
float angle = Vector3.SignedAngle(transform.forward, checkpointDirection, Vector3.up);
return angle;
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2f9964f63204e9542ba0533f5ec31d3f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using JetBrains.Annotations;
using Unity.Mathematics;
public class GameUI : MonoBehaviour
{
public GameObject car;
private float carVel;
public Rigidbody carRB;
// Start is called before the first frame update
void Start()
{
if (carRB == null)
{
carRB = GetComponent<Rigidbody>();
}
}
// Update is called once per frame
void Update()
{
carVel = (math.abs(carRB.velocity.x) + math.abs(carRB.velocity.y) + math.abs(carRB.velocity.z))*5;
print(carVel);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e08eb46613e9c34dbc9e95c80e40143
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: