Readd mlagents 0.8.1
68
.gitignore
vendored
@ -35,3 +35,71 @@ sysinfo.txt
|
|||||||
*.apk
|
*.apk
|
||||||
*.unitypackage
|
*.unitypackage
|
||||||
envs/
|
envs/
|
||||||
|
|
||||||
|
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
@ -10,19 +10,19 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 8b23992c8eb17439887f5e944bf04a40, type: 3}
|
m_Script: {fileID: 11500000, guid: 8b23992c8eb17439887f5e944bf04a40, type: 3}
|
||||||
m_Name: CozmoLearning
|
m_Name: CozmoLearningBrain
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
brainParameters:
|
brainParameters:
|
||||||
vectorObservationSize: 0
|
vectorObservationSize: 0
|
||||||
numStackedVectorObservations: 1
|
numStackedVectorObservations: 1
|
||||||
vectorActionSize: 0300000003000000
|
vectorActionSize: 0200000002000000
|
||||||
cameraResolutions:
|
cameraResolutions:
|
||||||
- width: 84
|
- width: 84
|
||||||
height: 84
|
height: 84
|
||||||
blackAndWhite: 1
|
blackAndWhite: 0
|
||||||
vectorActionDescriptions:
|
vectorActionDescriptions:
|
||||||
- forward
|
- forward
|
||||||
- rotate
|
- rotation
|
||||||
vectorActionSpaceType: 0
|
vectorActionSpaceType: 0
|
||||||
model: {fileID: 0}
|
model: {fileID: 0}
|
||||||
inferenceDevice: 0
|
inferenceDevice: 0
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 94e62c225e4fe8148a7543c5fd1acfd4
|
guid: 0d9d5ce547064a648b466ad7f208cf3d
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 11400000
|
mainObjectFileID: 11400000
|
@ -506,7 +506,7 @@ MonoBehaviour:
|
|||||||
agentCameras:
|
agentCameras:
|
||||||
- {fileID: 589453882}
|
- {fileID: 589453882}
|
||||||
agentRenderTextures: []
|
agentRenderTextures: []
|
||||||
maxStep: 1000
|
maxStep: 0
|
||||||
resetOnDone: 1
|
resetOnDone: 1
|
||||||
onDemandDecision: 0
|
onDemandDecision: 0
|
||||||
numberOfActionsBetweenDecisions: 1
|
numberOfActionsBetweenDecisions: 1
|
||||||
@ -560,7 +560,7 @@ MonoBehaviour:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 7570006596986120123}
|
m_GameObject: {fileID: 7570006596986120123}
|
||||||
m_Enabled: 0
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 4265d0764c65d26409f0f920e5293c82, type: 3}
|
m_Script: {fileID: 11500000, guid: 4265d0764c65d26409f0f920e5293c82, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
|
@ -24,7 +24,7 @@ public class CozmoMovement : MonoBehaviour
|
|||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
// When the tank is turned on, make sure it's not kinematic.
|
// When the cozmo is turned on, make sure it's not kinematic.
|
||||||
m_Rigidbody.isKinematic = false;
|
m_Rigidbody.isKinematic = false;
|
||||||
|
|
||||||
// Also reset the input values.
|
// Also reset the input values.
|
||||||
@ -35,17 +35,15 @@ public class CozmoMovement : MonoBehaviour
|
|||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
// When the tank is turned off, set it to kinematic so it stops moving.
|
// When the cozmo is turned off, set it to kinematic so it stops moving.
|
||||||
m_Rigidbody.isKinematic = true;
|
m_Rigidbody.isKinematic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// The axes names are based on player number.
|
|
||||||
m_MovementAxisName = "Vertical";
|
m_MovementAxisName = "Vertical";
|
||||||
m_TurnAxisName = "Horizontal";
|
m_TurnAxisName = "Horizontal";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +64,7 @@ public class CozmoMovement : MonoBehaviour
|
|||||||
|
|
||||||
public void Move(float directionValue)
|
public void Move(float directionValue)
|
||||||
{
|
{
|
||||||
// Create a vector in the direction the tank is facing with a magnitude based on the input, speed and the time between frames.
|
// Create a vector in the direction the cozmo is facing with a magnitude based on the input, speed and the time between frames.
|
||||||
Vector3 movement = directionValue * transform.forward * m_Speed * Time.deltaTime;
|
Vector3 movement = directionValue * transform.forward * m_Speed * Time.deltaTime;
|
||||||
|
|
||||||
// Apply this movement to the rigidbody's position.
|
// Apply this movement to the rigidbody's position.
|
||||||
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public enum TestStates { MovementSpeed, RotationSpeed }
|
public enum TestStates { MovementSpeed, RotationSpeed } // enum to determine test scenarios
|
||||||
|
|
||||||
[RequireComponent(typeof(CozmoMovement))]
|
[RequireComponent(typeof(CozmoMovement))]
|
||||||
public class CozmoMovementTester : MonoBehaviour
|
public class CozmoMovementTester : MonoBehaviour
|
||||||
@ -16,7 +16,6 @@ public class CozmoMovementTester : MonoBehaviour
|
|||||||
private CozmoMovement movement; // Reference to the movement script of cozmo
|
private CozmoMovement movement; // Reference to the movement script of cozmo
|
||||||
private Vector3 startPositionCozmo; // Original position of cozmo
|
private Vector3 startPositionCozmo; // Original position of cozmo
|
||||||
private float lastY; // Last Y of cozmo
|
private float lastY; // Last Y of cozmo
|
||||||
private float curAngleX = 0; // Current angle in the x axis of cozmo
|
|
||||||
private Stopwatch movementWatch; // Stopwatch to measure the time for the movement usecase
|
private Stopwatch movementWatch; // Stopwatch to measure the time for the movement usecase
|
||||||
private Stopwatch rotationWatch; // Stopwatch to measure the time for the rotation usecase
|
private Stopwatch rotationWatch; // Stopwatch to measure the time for the rotation usecase
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ public class CozmoMovementTester : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
startPositionCozmo = movement.transform.position; // Cache the starting position of Cozmo
|
startPositionCozmo = movement.transform.position; // Cache the starting position of Cozmo
|
||||||
lastY = movement.transform.rotation.y; // Cache the rotation Vector of Cozmo
|
lastY = movement.transform.rotation.y; // Cache the rotation Vector of Cozmo
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
@ -58,7 +57,7 @@ public class CozmoMovementTester : MonoBehaviour
|
|||||||
{
|
{
|
||||||
rotationWatch.Stop();
|
rotationWatch.Stop();
|
||||||
UnityEngine.Debug.Log("Cozmo: " + gameObject.name +
|
UnityEngine.Debug.Log("Cozmo: " + gameObject.name +
|
||||||
"/nElapsed time in milliseconds (Rotation): " + rotationWatch.ElapsedMilliseconds);
|
"\nElapsed time in milliseconds (Rotation): " + rotationWatch.ElapsedMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 7dc1ce4b31c63e34da34775dd888c0dc
|
guid: cab51972497b97040814f06bb409e7c0
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 239a923e346c7564eab507004b9293df
|
guid: fa7ea7fa4ff2dea4eaf717b9f695b516
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 48abdf8d850ee0b4890625559ec6f520
|
guid: a667ec11dafd88c4882174cec99ff9bd
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
@ -28,9 +28,16 @@ namespace MLAgents
|
|||||||
"agentParameters.onDemandDecision");
|
"agentParameters.onDemandDecision");
|
||||||
SerializedProperty cameras = serializedAgent.FindProperty(
|
SerializedProperty cameras = serializedAgent.FindProperty(
|
||||||
"agentParameters.agentCameras");
|
"agentParameters.agentCameras");
|
||||||
|
SerializedProperty renderTextures = serializedAgent.FindProperty(
|
||||||
|
"agentParameters.agentRenderTextures");
|
||||||
|
|
||||||
EditorGUILayout.PropertyField(brain);
|
EditorGUILayout.PropertyField(brain);
|
||||||
|
|
||||||
|
if (cameras.arraySize > 0 && renderTextures.arraySize > 0)
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox("Brain visual observations created by first getting all cameras then all render textures.", MessageType.Info);
|
||||||
|
}
|
||||||
|
|
||||||
EditorGUILayout.LabelField("Agent Cameras");
|
EditorGUILayout.LabelField("Agent Cameras");
|
||||||
for (int i = 0; i < cameras.arraySize; i++)
|
for (int i = 0; i < cameras.arraySize; i++)
|
||||||
{
|
{
|
||||||
@ -52,6 +59,28 @@ namespace MLAgents
|
|||||||
|
|
||||||
EditorGUILayout.EndHorizontal();
|
EditorGUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
EditorGUILayout.LabelField("Agent RenderTextures");
|
||||||
|
for (int i = 0; i < renderTextures.arraySize; i++)
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(
|
||||||
|
renderTextures.GetArrayElementAtIndex(i),
|
||||||
|
new GUIContent("RenderTexture " + (i + 1).ToString() + ": "));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
if (GUILayout.Button("Add RenderTextures", EditorStyles.miniButton))
|
||||||
|
{
|
||||||
|
renderTextures.arraySize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("Remove RenderTextures", EditorStyles.miniButton))
|
||||||
|
{
|
||||||
|
renderTextures.arraySize--;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
|
||||||
EditorGUILayout.PropertyField(
|
EditorGUILayout.PropertyField(
|
||||||
maxSteps,
|
maxSteps,
|
||||||
new GUIContent(
|
new GUIContent(
|
@ -97,7 +97,7 @@ namespace MLAgents
|
|||||||
property.FindPropertyRelative(NumVecObsPropName),
|
property.FindPropertyRelative(NumVecObsPropName),
|
||||||
new GUIContent("Stacked Vectors",
|
new GUIContent("Stacked Vectors",
|
||||||
"Number of states that will be stacked before " +
|
"Number of states that will be stacked before " +
|
||||||
"beeing fed to the neural network."));
|
"being fed to the neural network."));
|
||||||
position.y += LineHeight;
|
position.y += LineHeight;
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
|
||||||
|
namespace MLAgents.Tests
|
||||||
|
{
|
||||||
|
public class RayPerceptionTests : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestPerception3D()
|
||||||
|
{
|
||||||
|
var angles = new[] {0f, 90f, 180f};
|
||||||
|
var tags = new[] {"test", "test_1"};
|
||||||
|
|
||||||
|
var go = new GameObject("MyGameObject");
|
||||||
|
RayPerception3D rayPer3D = go.AddComponent<RayPerception3D>();
|
||||||
|
var result = rayPer3D.Perceive(1f, angles ,
|
||||||
|
tags, 0f, 0f);
|
||||||
|
Debug.Log(result.Count);
|
||||||
|
Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPerception2D()
|
||||||
|
{
|
||||||
|
var angles = new[] {0f, 90f, 180f};
|
||||||
|
var tags = new[] {"test", "test_1"};
|
||||||
|
|
||||||
|
var go = new GameObject("MyGameObject");
|
||||||
|
RayPerception2D rayPer2D = go.AddComponent<RayPerception2D>();
|
||||||
|
var result = rayPer2D.Perceive(1f, angles,
|
||||||
|
tags);
|
||||||
|
Debug.Log(result.Count);
|
||||||
|
Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29010426d01b4569830a85795f4f345b
|
||||||
|
timeCreated: 1552498773
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |