-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsole.cs
More file actions
61 lines (48 loc) · 2.05 KB
/
Copy pathConsole.cs
File metadata and controls
61 lines (48 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using UnityEngine;
using System.Collections;
public class Console : MonoBehaviour {
private Backpropagation bp = null;
private quadPhysics qp = null;
// Use this for initialization
void Start () {
bp = GameObject.Find("GM").GetComponent<Backpropagation>();
qp = GameObject.Find("quadcopter").GetComponent<quadPhysics>();
var repo = ConsoleCommandsRepository.Instance;
repo.RegisterCommand("sr", ShowResults);
repo.RegisterCommand("help", Help);
repo.RegisterCommand("save", Save);
repo.RegisterCommand("load", Load);
}
public string Help(params string[] args) {
return "save [filename]\t\t save calculated hidden neurons\n" +
"load [filename]\t\t load hidden neurons\n" +
"start \t\t start this simulation\n" +
"help\t\t\t show this command\n\n" +
"sr\t\t\t ShowResults";
}
public string Save(params string[] args) {
var filename = args[0];
//new LevelSaver().Save(filename);
return "Saved to " + filename;
}
public string Load(params string[] args) {
var filename = args[0];
//new LevelLoader().Load(filename);
return "Loaded " + filename;
}
public string ShowResults(params string[] args) {
var filename = args[0];
float[] result = new float[4];
ConsoleLog.Instance.Log("Rotation\n[0] " + qp.transform.rotation[0]) ;
ConsoleLog.Instance.Log("[1] " + qp.transform.rotation[1]);
ConsoleLog.Instance.Log("[2] " + qp.transform.rotation[2]);
ConsoleLog.Instance.Log("[3] " + qp.transform.rotation[3]);
ConsoleLog.Instance.Log(" ");
result = bp.feedForwardContinue(qp.transform.rotation[0],qp.transform.rotation[1],qp.transform.rotation[2],qp.transform.rotation[3]);
//new LevelLoader().Load(filename);
return "\n\nLoaded\n[0] " + result[0] + "\n[1] " + result[1] + "\n[2] " + result[2] + "\n[3] " + result[3]; //взять следующие данные, которые посчитала нейронная сеть
}
// Update is called once per frame
void Update () {
}
}