Datasets:
Commit
•
3d24dd4
1
Parent(s):
406fc49
Upload . with huggingface_hub
Browse files- .gitattributes +1 -0
- addons/godot_rl_agents/controller/ai_controller.gd +77 -0
- addons/godot_rl_agents/controller/ai_controller_2d.gd +8 -0
- addons/godot_rl_agents/controller/ai_controller_3d.gd +8 -0
- addons/godot_rl_agents/icon.png.import +2 -2
- addons/godot_rl_agents/onnx/csharp/ONNXInference.cs +93 -0
- addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs +106 -0
- addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml +31 -0
- addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml +29 -0
- addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd +19 -0
- addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn +11 -11
- addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd +1 -1
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd +31 -7
- addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn +4 -3
- addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd +1 -1
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd +8 -8
- addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn +26 -42
- addons/godot_rl_agents/sync.gd +119 -78
- bin/VirtualCamera.console.exe +0 -0
- bin/VirtualCamera.exe +3 -0
- bin/VirtualCamera.pck +0 -0
- bin/VirtualCamera.sh +4 -0
- bin/VirtualCamera.x86_64 +2 -2
- export_presets.cfg +87 -5
- icon.png.import +1 -1
- project.godot +9 -39
.gitattributes
CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
bin/VirtualCamera.x86_64 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
bin/VirtualCamera.x86_64 filter=lfs diff=lfs merge=lfs -text
|
56 |
+
bin/VirtualCamera.exe filter=lfs diff=lfs merge=lfs -text
|
addons/godot_rl_agents/controller/ai_controller.gd
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node
|
2 |
+
class_name AIController
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
@export var reset_after := 1000
|
6 |
+
|
7 |
+
var heuristic := "human"
|
8 |
+
var done := false
|
9 |
+
var reward := 0.0
|
10 |
+
var n_steps := 0
|
11 |
+
|
12 |
+
var needs_reset := false
|
13 |
+
|
14 |
+
func _ready():
|
15 |
+
add_to_group("AGENT")
|
16 |
+
|
17 |
+
#-- Methods that need implementing using the "extend script" option in Godot --#
|
18 |
+
func get_obs() -> Dictionary:
|
19 |
+
assert(false, "the get_obs method is not implemented when extending from ai_controller")
|
20 |
+
return {"obs":[]}
|
21 |
+
|
22 |
+
func get_reward() -> float:
|
23 |
+
assert(false, "the get_reward method is not implemented when extending from ai_controller")
|
24 |
+
return 0.0
|
25 |
+
|
26 |
+
func get_action_space() -> Dictionary:
|
27 |
+
assert(false, "the get get_action_space method is not implemented when extending from ai_controller")
|
28 |
+
return {
|
29 |
+
"example_actions_continous" : {
|
30 |
+
"size": 2,
|
31 |
+
"action_type": "continuous"
|
32 |
+
},
|
33 |
+
"example_actions_discrete" : {
|
34 |
+
"size": 2,
|
35 |
+
"action_type": "discrete"
|
36 |
+
},
|
37 |
+
}
|
38 |
+
|
39 |
+
func set_action(action) -> void:
|
40 |
+
assert(false, "the get set_action method is not implemented when extending from ai_controller")
|
41 |
+
# -----------------------------------------------------------------------------#
|
42 |
+
|
43 |
+
func _physics_process(delta):
|
44 |
+
n_steps += 1
|
45 |
+
if n_steps > reset_after:
|
46 |
+
needs_reset = true
|
47 |
+
|
48 |
+
func get_obs_space():
|
49 |
+
# may need overriding if the obs space is complex
|
50 |
+
var obs = get_obs()
|
51 |
+
return {
|
52 |
+
"obs": {
|
53 |
+
"size": [len(obs["obs"])],
|
54 |
+
"space": "box"
|
55 |
+
},
|
56 |
+
}
|
57 |
+
|
58 |
+
func reset():
|
59 |
+
n_steps = 0
|
60 |
+
needs_reset = false
|
61 |
+
|
62 |
+
func reset_if_done():
|
63 |
+
if done:
|
64 |
+
reset()
|
65 |
+
|
66 |
+
func set_heuristic(h):
|
67 |
+
# sets the heuristic from "human" or "model" nothing to change here
|
68 |
+
heuristic = h
|
69 |
+
|
70 |
+
func get_done():
|
71 |
+
return done
|
72 |
+
|
73 |
+
func set_done_false():
|
74 |
+
done = false
|
75 |
+
|
76 |
+
func zero_reward():
|
77 |
+
reward = 0.0
|
addons/godot_rl_agents/controller/ai_controller_2d.gd
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController
|
2 |
+
class_name AIController2D
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
var _player: Node2D
|
6 |
+
|
7 |
+
func init(player: Node2D):
|
8 |
+
_player = player
|
addons/godot_rl_agents/controller/ai_controller_3d.gd
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends AIController
|
2 |
+
class_name AIController3D
|
3 |
+
|
4 |
+
# ------------------ Godot RL Agents Logic ------------------------------------#
|
5 |
+
var _player: Node3D
|
6 |
+
|
7 |
+
func init(player: Node3D):
|
8 |
+
_player = player
|
addons/godot_rl_agents/icon.png.import
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
-
uid="uid://
|
6 |
path="res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"
|
7 |
metadata={
|
8 |
"vram_texture": false
|
@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.cte
|
|
16 |
[params]
|
17 |
|
18 |
compress/mode=0
|
|
|
19 |
compress/lossy_quality=0.7
|
20 |
compress/hdr_compression=1
|
21 |
-
compress/bptc_ldr=0
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
mipmaps/generate=false
|
|
|
2 |
|
3 |
importer="texture"
|
4 |
type="CompressedTexture2D"
|
5 |
+
uid="uid://dn7mfntm1bfv4"
|
6 |
path="res://.godot/imported/icon.png-45a871b53434e556222f5901d598ab34.ctex"
|
7 |
metadata={
|
8 |
"vram_texture": false
|
|
|
16 |
[params]
|
17 |
|
18 |
compress/mode=0
|
19 |
+
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
|
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
mipmaps/generate=false
|
addons/godot_rl_agents/onnx/csharp/ONNXInference.cs
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
using Godot;
|
2 |
+
using System.Collections.Generic;
|
3 |
+
using System.Linq;
|
4 |
+
using Microsoft.ML.OnnxRuntime;
|
5 |
+
using Microsoft.ML.OnnxRuntime.Tensors;
|
6 |
+
|
7 |
+
namespace GodotONNX{
|
8 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/ONNXInference/*'/>
|
9 |
+
public partial class ONNXInference : Node
|
10 |
+
{
|
11 |
+
|
12 |
+
private InferenceSession session;
|
13 |
+
/// <summary>
|
14 |
+
/// Path to the ONNX model. Use Initialize to change it.
|
15 |
+
/// </summary>
|
16 |
+
private string modelPath;
|
17 |
+
private int batchSize;
|
18 |
+
|
19 |
+
private SessionOptions SessionOpt;
|
20 |
+
|
21 |
+
//init function
|
22 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Initialize/*'/>
|
23 |
+
public void Initialize(string Path, int BatchSize)
|
24 |
+
{
|
25 |
+
modelPath = Path;
|
26 |
+
batchSize = BatchSize;
|
27 |
+
SessionConfigurator.SystemCheck();
|
28 |
+
SessionOpt = SessionConfigurator.GetSessionOptions();
|
29 |
+
session = LoadModel(modelPath);
|
30 |
+
|
31 |
+
}
|
32 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Run/*'/>
|
33 |
+
public Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> RunInference(Godot.Collections.Array<float> obs, int state_ins)
|
34 |
+
{
|
35 |
+
//Current model: Any (Godot Rl Agents)
|
36 |
+
//Expects a tensor of shape [batch_size, input_size] type float named obs and a tensor of shape [batch_size] type float named state_ins
|
37 |
+
|
38 |
+
//Fill the input tensors
|
39 |
+
// create span from inputSize
|
40 |
+
var span = new float[obs.Count]; //There's probably a better way to do this
|
41 |
+
for (int i = 0; i < obs.Count; i++)
|
42 |
+
{
|
43 |
+
span[i] = obs[i];
|
44 |
+
}
|
45 |
+
|
46 |
+
IReadOnlyCollection<NamedOnnxValue> inputs = new List<NamedOnnxValue>
|
47 |
+
{
|
48 |
+
NamedOnnxValue.CreateFromTensor("obs", new DenseTensor<float>(span, new int[] { batchSize, obs.Count })),
|
49 |
+
NamedOnnxValue.CreateFromTensor("state_ins", new DenseTensor<float>(new float[] { state_ins }, new int[] { batchSize }))
|
50 |
+
};
|
51 |
+
IReadOnlyCollection<string> outputNames = new List<string> { "output", "state_outs" }; //ONNX is sensible to these names, as well as the input names
|
52 |
+
|
53 |
+
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> results;
|
54 |
+
|
55 |
+
try{
|
56 |
+
results = session.Run(inputs, outputNames);
|
57 |
+
}
|
58 |
+
catch (OnnxRuntimeException e) {
|
59 |
+
//This error usually means that the model is not compatible with the input, beacause of the input shape (size)
|
60 |
+
GD.Print("Error at inference: ", e);
|
61 |
+
return null;
|
62 |
+
}
|
63 |
+
//Can't convert IEnumerable<float> to Variant, so we have to convert it to an array or something
|
64 |
+
Godot.Collections.Dictionary<string, Godot.Collections.Array<float>> output = new Godot.Collections.Dictionary<string, Godot.Collections.Array<float>>();
|
65 |
+
DisposableNamedOnnxValue output1 = results.First();
|
66 |
+
DisposableNamedOnnxValue output2 = results.Last();
|
67 |
+
Godot.Collections.Array<float> output1Array = new Godot.Collections.Array<float>();
|
68 |
+
Godot.Collections.Array<float> output2Array = new Godot.Collections.Array<float>();
|
69 |
+
|
70 |
+
foreach (float f in output1.AsEnumerable<float>()) {
|
71 |
+
output1Array.Add(f);
|
72 |
+
}
|
73 |
+
|
74 |
+
foreach (float f in output2.AsEnumerable<float>()) {
|
75 |
+
output2Array.Add(f);
|
76 |
+
}
|
77 |
+
|
78 |
+
output.Add(output1.Name, output1Array);
|
79 |
+
output.Add(output2.Name, output2Array);
|
80 |
+
|
81 |
+
//Output is a dictionary of arrays, ex: { "output" : [0.1, 0.2, 0.3, 0.4, ...], "state_outs" : [0.5, ...]}
|
82 |
+
return output;
|
83 |
+
}
|
84 |
+
/// <include file='docs/ONNXInference.xml' path='docs/members[@name="ONNXInference"]/Load/*'/>
|
85 |
+
public InferenceSession LoadModel(string Path)
|
86 |
+
{
|
87 |
+
Godot.FileAccess file = FileAccess.Open(Path, Godot.FileAccess.ModeFlags.Read);
|
88 |
+
byte[] model = file.GetBuffer((int)file.GetLength());
|
89 |
+
file.Close();
|
90 |
+
return new InferenceSession(model, SessionOpt); //Load the model
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
using Godot;
|
2 |
+
using Microsoft.ML.OnnxRuntime;
|
3 |
+
|
4 |
+
namespace GodotONNX{
|
5 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SessionConfigurator/*'/>
|
6 |
+
|
7 |
+
public static class SessionConfigurator {
|
8 |
+
|
9 |
+
private static SessionOptions options = new SessionOptions();
|
10 |
+
|
11 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/GetSessionOptions/*'/>
|
12 |
+
public static SessionOptions GetSessionOptions() {
|
13 |
+
options = new SessionOptions();
|
14 |
+
options.LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_WARNING;
|
15 |
+
// see warnings
|
16 |
+
SystemCheck();
|
17 |
+
return options;
|
18 |
+
}
|
19 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/SystemCheck/*'/>
|
20 |
+
|
21 |
+
static public void SystemCheck()
|
22 |
+
{
|
23 |
+
//Most code for this function is verbose only, the only reason it exists is to track
|
24 |
+
//implementation progress of the different compute APIs.
|
25 |
+
|
26 |
+
//December 2022: CUDA is not working.
|
27 |
+
|
28 |
+
string OSName = OS.GetName(); //Get OS Name
|
29 |
+
int ComputeAPIID = ComputeCheck(); //Get Compute API
|
30 |
+
//TODO: Get CPU architecture
|
31 |
+
|
32 |
+
//Linux can use OpenVINO (C#) on x64 and ROCm on x86 (GDNative/C++)
|
33 |
+
//Windows can use OpenVINO (C#) on x64
|
34 |
+
//TODO: try TensorRT instead of CUDA
|
35 |
+
//TODO: Use OpenVINO for Intel Graphics
|
36 |
+
|
37 |
+
string [] ComputeNames = {"CUDA", "DirectML/ROCm", "DirectML", "CoreML", "CPU"};
|
38 |
+
//match OS and Compute API
|
39 |
+
options.AppendExecutionProvider_CPU(0); // Always use CPU
|
40 |
+
GD.Print("OS: " + OSName, " | Compute API: " + ComputeNames[ComputeAPIID]);
|
41 |
+
|
42 |
+
switch (OSName)
|
43 |
+
{
|
44 |
+
case "Windows": //Can use CUDA, DirectML
|
45 |
+
if (ComputeAPIID == 0)
|
46 |
+
{
|
47 |
+
//CUDA
|
48 |
+
//options.AppendExecutionProvider_CUDA(0);
|
49 |
+
options.AppendExecutionProvider_DML(0);
|
50 |
+
}
|
51 |
+
else if (ComputeAPIID == 1)
|
52 |
+
{
|
53 |
+
//DirectML
|
54 |
+
options.AppendExecutionProvider_DML(0);
|
55 |
+
}
|
56 |
+
break;
|
57 |
+
case "X11": //Can use CUDA, ROCm
|
58 |
+
if (ComputeAPIID == 0)
|
59 |
+
{
|
60 |
+
//CUDA
|
61 |
+
//options.AppendExecutionProvider_CUDA(0);
|
62 |
+
}
|
63 |
+
if (ComputeAPIID == 1)
|
64 |
+
{
|
65 |
+
//ROCm, only works on x86
|
66 |
+
//Research indicates that this has to be compiled as a GDNative plugin
|
67 |
+
GD.Print("ROCm not supported yet, using CPU.");
|
68 |
+
options.AppendExecutionProvider_CPU(0);
|
69 |
+
}
|
70 |
+
|
71 |
+
break;
|
72 |
+
case "OSX": //Can use CoreML
|
73 |
+
if (ComputeAPIID == 0) { //CoreML
|
74 |
+
//TODO: Needs testing
|
75 |
+
options.AppendExecutionProvider_CoreML(0);
|
76 |
+
//CoreML on ARM64, out of the box, on x64 needs .tar file from GitHub
|
77 |
+
}
|
78 |
+
break;
|
79 |
+
default:
|
80 |
+
GD.Print("OS not Supported.");
|
81 |
+
break;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
/// <include file='docs/SessionConfigurator.xml' path='docs/members[@name="SessionConfigurator"]/ComputeCheck/*'/>
|
85 |
+
|
86 |
+
public static int ComputeCheck()
|
87 |
+
{
|
88 |
+
string adapterName = Godot.RenderingServer.GetVideoAdapterName();
|
89 |
+
//string adapterVendor = Godot.RenderingServer.GetVideoAdapterVendor();
|
90 |
+
adapterName = adapterName.ToUpper(new System.Globalization.CultureInfo(""));
|
91 |
+
//TODO: GPU vendors for MacOS, what do they even use these days?
|
92 |
+
if (adapterName.Contains("INTEL")) {
|
93 |
+
//Return 2, should use DirectML only
|
94 |
+
return 2;}
|
95 |
+
if (adapterName.Contains("AMD")) {
|
96 |
+
//Return 1, should use DirectML, check later for ROCm
|
97 |
+
return 1;}
|
98 |
+
if (adapterName.Contains("NVIDIA")){
|
99 |
+
//Return 0, should use CUDA
|
100 |
+
return 0;}
|
101 |
+
|
102 |
+
GD.Print("Graphics Card not recognized."); //Return -1, should use CPU
|
103 |
+
return -1;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
addons/godot_rl_agents/onnx/csharp/docs/ONNXInference.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="ONNXInference">
|
3 |
+
<ONNXInference>
|
4 |
+
<summary>
|
5 |
+
The main <c>ONNXInference</c> Class that handles the inference process.
|
6 |
+
</summary>
|
7 |
+
</ONNXInference>
|
8 |
+
<Initialize>
|
9 |
+
<summary>
|
10 |
+
Starts the inference process.
|
11 |
+
</summary>
|
12 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
13 |
+
<param name="BatchSize">How many observations will the model recieve.</param>
|
14 |
+
</Initialize>
|
15 |
+
<Run>
|
16 |
+
<summary>
|
17 |
+
Runs the given input through the model and returns the output.
|
18 |
+
</summary>
|
19 |
+
<param name="obs">Dictionary containing all observations.</param>
|
20 |
+
<param name="state_ins">How many different agents are creating these observations.</param>
|
21 |
+
<returns>A Dictionary of arrays, containing instructions based on the observations.</returns>
|
22 |
+
</Run>
|
23 |
+
<Load>
|
24 |
+
<summary>
|
25 |
+
Loads the given model into the inference process, using the best Execution provider available.
|
26 |
+
</summary>
|
27 |
+
<param name="Path">Path to the ONNX model, expects a path inside resources.</param>
|
28 |
+
<returns>InferenceSession ready to run.</returns>
|
29 |
+
</Load>
|
30 |
+
</members>
|
31 |
+
</docs>
|
addons/godot_rl_agents/onnx/csharp/docs/SessionConfigurator.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<docs>
|
2 |
+
<members name="SessionConfigurator">
|
3 |
+
<SessionConfigurator>
|
4 |
+
<summary>
|
5 |
+
The main <c>SessionConfigurator</c> Class that handles the execution options and providers for the inference process.
|
6 |
+
</summary>
|
7 |
+
</SessionConfigurator>
|
8 |
+
<GetSessionOptions>
|
9 |
+
<summary>
|
10 |
+
Creates a SessionOptions with all available execution providers.
|
11 |
+
</summary>
|
12 |
+
<returns>SessionOptions with all available execution providers.</returns>
|
13 |
+
</GetSessionOptions>
|
14 |
+
<SystemCheck>
|
15 |
+
<summary>
|
16 |
+
Appends any execution provider available in the current system.
|
17 |
+
</summary>
|
18 |
+
<remarks>
|
19 |
+
This function is mainly verbose for tracking implementation progress of different compute APIs.
|
20 |
+
</remarks>
|
21 |
+
</SystemCheck>
|
22 |
+
<ComputeCheck>
|
23 |
+
<summary>
|
24 |
+
Checks for available GPUs.
|
25 |
+
</summary>
|
26 |
+
<returns>An integer identifier for each compute platform.</returns>
|
27 |
+
</ComputeCheck>
|
28 |
+
</members>
|
29 |
+
</docs>
|
addons/godot_rl_agents/onnx/wrapper/ONNX_wrapper.gd
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extends Node
|
2 |
+
class_name ONNXModel
|
3 |
+
var inferencer_script = load("res://addons/godot_rl_agents/onnx/csharp/ONNXInference.cs")
|
4 |
+
|
5 |
+
var inferencer = null
|
6 |
+
|
7 |
+
# Must provide the path to the model and the batch size
|
8 |
+
func _init(model_path, batch_size):
|
9 |
+
inferencer = inferencer_script.new()
|
10 |
+
inferencer.Initialize(model_path, batch_size)
|
11 |
+
|
12 |
+
# This function is the one that will be called from the game,
|
13 |
+
# requires the observation as an array and the state_ins as an int
|
14 |
+
# returns an Array containing the action the model takes.
|
15 |
+
func run_inference(obs : Array, state_ins : int) -> Dictionary:
|
16 |
+
if inferencer == null:
|
17 |
+
printerr("Inferencer not initialized")
|
18 |
+
return {}
|
19 |
+
return inferencer.RunInference(obs, state_ins)
|
addons/godot_rl_agents/sensors/sensors_2d/ExampleRaycastSensor2D.tscn
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
[gd_scene load_steps=5 format=
|
2 |
|
3 |
-
[ext_resource path="res://sensors/sensors_2d/RaycastSensor2D.gd"
|
4 |
|
5 |
-
[sub_resource type="GDScript" id=2]
|
6 |
script/source = "extends Node2D
|
7 |
|
8 |
|
@@ -12,7 +12,7 @@ func _physics_process(delta: float) -> void:
|
|
12 |
|
13 |
"
|
14 |
|
15 |
-
[sub_resource type="GDScript" id=1]
|
16 |
script/source = "extends RayCast2D
|
17 |
|
18 |
var steps = 1
|
@@ -26,23 +26,23 @@ func _physics_process(delta: float) -> void:
|
|
26 |
print(is_colliding())
|
27 |
"
|
28 |
|
29 |
-
[sub_resource type="CircleShape2D" id=3]
|
30 |
|
31 |
[node name="ExampleRaycastSensor2D" type="Node2D"]
|
32 |
-
script = SubResource(
|
33 |
|
34 |
[node name="ExampleAgent" type="Node2D" parent="."]
|
35 |
-
position = Vector2(
|
36 |
rotation = 0.286234
|
37 |
|
38 |
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"]
|
39 |
-
script = ExtResource(
|
40 |
|
41 |
[node name="TestRayCast2D" type="RayCast2D" parent="."]
|
42 |
-
script = SubResource(
|
43 |
|
44 |
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
45 |
-
position = Vector2(
|
46 |
|
47 |
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
48 |
-
shape = SubResource(
|
|
|
1 |
+
[gd_scene load_steps=5 format=3 uid="uid://ddeq7mn1ealyc"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
|
5 |
+
[sub_resource type="GDScript" id="2"]
|
6 |
script/source = "extends Node2D
|
7 |
|
8 |
|
|
|
12 |
|
13 |
"
|
14 |
|
15 |
+
[sub_resource type="GDScript" id="1"]
|
16 |
script/source = "extends RayCast2D
|
17 |
|
18 |
var steps = 1
|
|
|
26 |
print(is_colliding())
|
27 |
"
|
28 |
|
29 |
+
[sub_resource type="CircleShape2D" id="3"]
|
30 |
|
31 |
[node name="ExampleRaycastSensor2D" type="Node2D"]
|
32 |
+
script = SubResource("2")
|
33 |
|
34 |
[node name="ExampleAgent" type="Node2D" parent="."]
|
35 |
+
position = Vector2(573, 314)
|
36 |
rotation = 0.286234
|
37 |
|
38 |
[node name="RaycastSensor2D" type="Node2D" parent="ExampleAgent"]
|
39 |
+
script = ExtResource("1")
|
40 |
|
41 |
[node name="TestRayCast2D" type="RayCast2D" parent="."]
|
42 |
+
script = SubResource("1")
|
43 |
|
44 |
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
45 |
+
position = Vector2(1, 52)
|
46 |
|
47 |
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
48 |
+
shape = SubResource("3")
|
addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
extends Node2D
|
2 |
class_name ISensor2D
|
3 |
|
4 |
-
var _obs : Array
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
|
|
1 |
extends Node2D
|
2 |
class_name ISensor2D
|
3 |
|
4 |
+
var _obs : Array = []
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd
CHANGED
@@ -1,6 +1,24 @@
|
|
|
|
1 |
extends ISensor2D
|
2 |
class_name RaycastSensor2D
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
@export var n_rays := 16.0:
|
6 |
get: return n_rays
|
@@ -8,18 +26,18 @@ class_name RaycastSensor2D
|
|
8 |
n_rays = value
|
9 |
_update()
|
10 |
|
11 |
-
@
|
12 |
get: return ray_length
|
13 |
set(value):
|
14 |
ray_length = value
|
15 |
_update()
|
16 |
-
@
|
17 |
get: return cone_width
|
18 |
set(value):
|
19 |
cone_width = value
|
20 |
_update()
|
21 |
|
22 |
-
@export var debug_draw :=
|
23 |
get: return debug_draw
|
24 |
set(value):
|
25 |
debug_draw = value
|
@@ -31,12 +49,16 @@ var rays := []
|
|
31 |
|
32 |
func _update():
|
33 |
if Engine.is_editor_hint():
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
func _ready() -> void:
|
37 |
_spawn_nodes()
|
38 |
|
39 |
-
|
40 |
func _spawn_nodes():
|
41 |
for ray in rays:
|
42 |
ray.queue_free()
|
@@ -55,7 +77,9 @@ func _spawn_nodes():
|
|
55 |
))
|
56 |
ray.set_name("node_"+str(i))
|
57 |
ray.enabled = true
|
58 |
-
ray.collide_with_areas =
|
|
|
|
|
59 |
add_child(ray)
|
60 |
rays.append(ray)
|
61 |
|
|
|
1 |
+
@tool
|
2 |
extends ISensor2D
|
3 |
class_name RaycastSensor2D
|
4 |
+
|
5 |
+
@export_flags_2d_physics var collision_mask := 1:
|
6 |
+
get: return collision_mask
|
7 |
+
set(value):
|
8 |
+
collision_mask = value
|
9 |
+
_update()
|
10 |
+
|
11 |
+
@export var collide_with_areas := false:
|
12 |
+
get: return collide_with_areas
|
13 |
+
set(value):
|
14 |
+
collide_with_areas = value
|
15 |
+
_update()
|
16 |
+
|
17 |
+
@export var collide_with_bodies := true:
|
18 |
+
get: return collide_with_bodies
|
19 |
+
set(value):
|
20 |
+
collide_with_bodies = value
|
21 |
+
_update()
|
22 |
|
23 |
@export var n_rays := 16.0:
|
24 |
get: return n_rays
|
|
|
26 |
n_rays = value
|
27 |
_update()
|
28 |
|
29 |
+
@export_range(5,200,5.0) var ray_length := 200:
|
30 |
get: return ray_length
|
31 |
set(value):
|
32 |
ray_length = value
|
33 |
_update()
|
34 |
+
@export_range(5,360,5.0) var cone_width := 360.0:
|
35 |
get: return cone_width
|
36 |
set(value):
|
37 |
cone_width = value
|
38 |
_update()
|
39 |
|
40 |
+
@export var debug_draw := true :
|
41 |
get: return debug_draw
|
42 |
set(value):
|
43 |
debug_draw = value
|
|
|
49 |
|
50 |
func _update():
|
51 |
if Engine.is_editor_hint():
|
52 |
+
if debug_draw:
|
53 |
+
_spawn_nodes()
|
54 |
+
else:
|
55 |
+
for ray in get_children():
|
56 |
+
if ray is RayCast2D:
|
57 |
+
remove_child(ray)
|
58 |
|
59 |
func _ready() -> void:
|
60 |
_spawn_nodes()
|
61 |
|
|
|
62 |
func _spawn_nodes():
|
63 |
for ray in rays:
|
64 |
ray.queue_free()
|
|
|
77 |
))
|
78 |
ray.set_name("node_"+str(i))
|
79 |
ray.enabled = true
|
80 |
+
ray.collide_with_areas = collide_with_areas
|
81 |
+
ray.collide_with_bodies = collide_with_bodies
|
82 |
+
ray.collision_mask = collision_mask
|
83 |
add_child(ray)
|
84 |
rays.append(ray)
|
85 |
|
addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.tscn
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
[gd_scene load_steps=2 format=
|
2 |
|
3 |
-
[ext_resource path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd"
|
4 |
|
5 |
[node name="RaycastSensor2D" type="Node2D"]
|
6 |
-
script = ExtResource(
|
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://drvfihk5esgmv"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd" id="1"]
|
4 |
|
5 |
[node name="RaycastSensor2D" type="Node2D"]
|
6 |
+
script = ExtResource("1")
|
7 |
+
n_rays = 17.0
|
addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
extends Node3D
|
2 |
class_name ISensor3D
|
3 |
|
4 |
-
var _obs : Array
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
|
|
1 |
extends Node3D
|
2 |
class_name ISensor3D
|
3 |
|
4 |
+
var _obs : Array = []
|
5 |
var _active := false
|
6 |
|
7 |
func get_observation():
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd
CHANGED
@@ -1,6 +1,6 @@
|
|
|
|
1 |
extends ISensor3D
|
2 |
class_name RayCastSensor3D
|
3 |
-
@tool
|
4 |
@export_flags_3d_physics var collision_mask = 1:
|
5 |
get: return collision_mask
|
6 |
set(value):
|
@@ -10,7 +10,7 @@ class_name RayCastSensor3D
|
|
10 |
get: return boolean_class_mask
|
11 |
set(value):
|
12 |
boolean_class_mask = value
|
13 |
-
_update()
|
14 |
|
15 |
@export var n_rays_width := 6.0:
|
16 |
get: return n_rays_width
|
@@ -42,18 +42,18 @@ class_name RayCastSensor3D
|
|
42 |
cone_height = value
|
43 |
_update()
|
44 |
|
45 |
-
@export var collide_with_bodies := true:
|
46 |
-
get: return collide_with_bodies
|
47 |
-
set(value):
|
48 |
-
collide_with_bodies = value
|
49 |
-
_update()
|
50 |
-
|
51 |
@export var collide_with_areas := false:
|
52 |
get: return collide_with_areas
|
53 |
set(value):
|
54 |
collide_with_areas = value
|
55 |
_update()
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
@export var class_sensor := false
|
58 |
|
59 |
var rays := []
|
|
|
1 |
+
@tool
|
2 |
extends ISensor3D
|
3 |
class_name RayCastSensor3D
|
|
|
4 |
@export_flags_3d_physics var collision_mask = 1:
|
5 |
get: return collision_mask
|
6 |
set(value):
|
|
|
10 |
get: return boolean_class_mask
|
11 |
set(value):
|
12 |
boolean_class_mask = value
|
13 |
+
_update()
|
14 |
|
15 |
@export var n_rays_width := 6.0:
|
16 |
get: return n_rays_width
|
|
|
42 |
cone_height = value
|
43 |
_update()
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
@export var collide_with_areas := false:
|
46 |
get: return collide_with_areas
|
47 |
set(value):
|
48 |
collide_with_areas = value
|
49 |
_update()
|
50 |
|
51 |
+
@export var collide_with_bodies := true:
|
52 |
+
get: return collide_with_bodies
|
53 |
+
set(value):
|
54 |
+
collide_with_bodies = value
|
55 |
+
_update()
|
56 |
+
|
57 |
@export var class_sensor := false
|
58 |
|
59 |
var rays := []
|
addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.tscn
CHANGED
@@ -1,49 +1,33 @@
|
|
1 |
-
[gd_scene load_steps=2 format=
|
2 |
|
3 |
-
[ext_resource path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd"
|
4 |
|
5 |
[node name="RaycastSensor3D" type="Node3D"]
|
6 |
-
script = ExtResource(
|
7 |
n_rays_width = 4.0
|
8 |
n_rays_height = 2.0
|
9 |
ray_length = 11.0
|
10 |
|
11 |
-
[node name="node_0
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
[node name="
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
collide_with_areas = true
|
35 |
-
|
36 |
-
[node name="node_2 1" type="RayCast3D" parent="."]
|
37 |
-
enabled = true
|
38 |
-
cast_to = Vector3( 1.38686, 2.84701, 10.5343 )
|
39 |
-
collide_with_areas = true
|
40 |
-
|
41 |
-
[node name="node_3 0" type="RayCast3D" parent="."]
|
42 |
-
enabled = true
|
43 |
-
cast_to = Vector3( 4.06608, -2.84701, 9.81639 )
|
44 |
-
collide_with_areas = true
|
45 |
-
|
46 |
-
[node name="node_3 1" type="RayCast3D" parent="."]
|
47 |
-
enabled = true
|
48 |
-
cast_to = Vector3( 4.06608, 2.84701, 9.81639 )
|
49 |
-
collide_with_areas = true
|
|
|
1 |
+
[gd_scene load_steps=2 format=3 uid="uid://b803cbh1fmy66"]
|
2 |
|
3 |
+
[ext_resource type="Script" path="res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd" id="1"]
|
4 |
|
5 |
[node name="RaycastSensor3D" type="Node3D"]
|
6 |
+
script = ExtResource("1")
|
7 |
n_rays_width = 4.0
|
8 |
n_rays_height = 2.0
|
9 |
ray_length = 11.0
|
10 |
|
11 |
+
[node name="@node_0 0@18991" type="RayCast3D" parent="."]
|
12 |
+
target_position = Vector3(-4.06608, -2.84701, 9.81639)
|
13 |
+
|
14 |
+
[node name="node_0 1" type="RayCast3D" parent="."]
|
15 |
+
target_position = Vector3(-4.06608, 2.84701, 9.81639)
|
16 |
+
|
17 |
+
[node name="@node_1 0@18992" type="RayCast3D" parent="."]
|
18 |
+
target_position = Vector3(-1.38686, -2.84701, 10.5343)
|
19 |
+
|
20 |
+
[node name="@node_1 1@18993" type="RayCast3D" parent="."]
|
21 |
+
target_position = Vector3(-1.38686, 2.84701, 10.5343)
|
22 |
+
|
23 |
+
[node name="@node_2 0@18994" type="RayCast3D" parent="."]
|
24 |
+
target_position = Vector3(1.38686, -2.84701, 10.5343)
|
25 |
+
|
26 |
+
[node name="@node_2 1@18995" type="RayCast3D" parent="."]
|
27 |
+
target_position = Vector3(1.38686, 2.84701, 10.5343)
|
28 |
+
|
29 |
+
[node name="@node_3 0@18996" type="RayCast3D" parent="."]
|
30 |
+
target_position = Vector3(4.06608, -2.84701, 9.81639)
|
31 |
+
|
32 |
+
[node name="@node_3 1@18997" type="RayCast3D" parent="."]
|
33 |
+
target_position = Vector3(4.06608, 2.84701, 9.81639)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/godot_rl_agents/sync.gd
CHANGED
@@ -2,7 +2,9 @@ extends Node
|
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
@export var action_repeat := 8
|
4 |
@export var speed_up = 1
|
5 |
-
var
|
|
|
|
|
6 |
|
7 |
const MAJOR_VERSION := "0"
|
8 |
const MINOR_VERSION := "3"
|
@@ -16,21 +18,122 @@ var should_connect = true
|
|
16 |
var agents
|
17 |
var need_to_send_obs = false
|
18 |
var args = null
|
19 |
-
@onready var start_time = Time.get_ticks_msec()
|
20 |
var initialized = false
|
21 |
var just_reset = false
|
|
|
|
|
22 |
|
|
|
|
|
23 |
|
24 |
# Called when the node enters the scene tree for the first time.
|
25 |
|
26 |
func _ready():
|
27 |
-
|
28 |
await get_tree().root.ready
|
29 |
get_tree().set_pause(true)
|
30 |
_initialize()
|
31 |
await get_tree().create_timer(1.0).timeout
|
32 |
get_tree().set_pause(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
func _get_agents():
|
35 |
agents = get_tree().get_nodes_in_group("AGENT")
|
36 |
|
@@ -75,17 +178,16 @@ func _send_dict_as_json_message(dict):
|
|
75 |
func _send_env_info():
|
76 |
var json_dict = _get_dict_json_message()
|
77 |
assert(json_dict["type"] == "env_info")
|
78 |
-
|
|
|
79 |
var message = {
|
80 |
"type" : "env_info",
|
81 |
-
|
82 |
-
"
|
83 |
-
"action_space":agents[0].get_action_space(),
|
84 |
"n_agents": len(agents)
|
85 |
}
|
86 |
_send_dict_as_json_message(message)
|
87 |
|
88 |
-
|
89 |
func connect_to_server():
|
90 |
print("Waiting for one second to allow server to start")
|
91 |
OS.delay_msec(1000)
|
@@ -98,17 +200,13 @@ func connect_to_server():
|
|
98 |
var connect = stream.connect_to_host(ip, port)
|
99 |
stream.set_no_delay(true) # TODO check if this improves performance or not
|
100 |
stream.poll()
|
|
|
|
|
|
|
101 |
return stream.get_status() == 2
|
102 |
|
103 |
func _get_args():
|
104 |
print("getting command line arguments")
|
105 |
-
# var arguments = {}
|
106 |
-
# for argument in OS.get_cmdline_args():
|
107 |
-
# # Parse valid command-line arguments into a dictionary
|
108 |
-
# if argument.find("=") > -1:
|
109 |
-
# var key_value = argument.split("=")
|
110 |
-
# arguments[key_value[0].lstrip("--")] = key_value[1]
|
111 |
-
|
112 |
var arguments = {}
|
113 |
for argument in OS.get_cmdline_args():
|
114 |
print(argument)
|
@@ -139,70 +237,7 @@ func _set_action_repeat():
|
|
139 |
func disconnect_from_server():
|
140 |
stream.disconnect_from_host()
|
141 |
|
142 |
-
func _initialize():
|
143 |
-
_get_agents()
|
144 |
-
|
145 |
-
args = _get_args()
|
146 |
-
Engine.physics_ticks_per_second = _get_speedup() * 60 # Replace with function body.
|
147 |
-
Engine.time_scale = _get_speedup() * 1.0
|
148 |
-
prints("physics ticks", Engine.physics_ticks_per_second, Engine.time_scale, _get_speedup(), speed_up)
|
149 |
-
|
150 |
-
connected = connect_to_server()
|
151 |
-
if connected:
|
152 |
-
_set_heuristic("model")
|
153 |
-
_handshake()
|
154 |
-
_send_env_info()
|
155 |
-
else:
|
156 |
-
_set_heuristic("human")
|
157 |
-
|
158 |
-
_set_seed()
|
159 |
-
_set_action_repeat()
|
160 |
-
initialized = true
|
161 |
-
|
162 |
-
func _physics_process(delta):
|
163 |
-
# two modes, human control, agent control
|
164 |
-
# pause tree, send obs, get actions, set actions, unpause tree
|
165 |
-
if n_action_steps % action_repeat != 0:
|
166 |
-
n_action_steps += 1
|
167 |
-
return
|
168 |
|
169 |
-
n_action_steps += 1
|
170 |
-
|
171 |
-
if connected:
|
172 |
-
get_tree().set_pause(true)
|
173 |
-
|
174 |
-
if just_reset:
|
175 |
-
just_reset = false
|
176 |
-
var obs = _get_obs_from_agents()
|
177 |
-
|
178 |
-
var reply = {
|
179 |
-
"type": "reset",
|
180 |
-
"obs": obs
|
181 |
-
}
|
182 |
-
_send_dict_as_json_message(reply)
|
183 |
-
# this should go straight to getting the action and setting it checked the agent, no need to perform one phyics tick
|
184 |
-
get_tree().set_pause(false)
|
185 |
-
return
|
186 |
-
|
187 |
-
if need_to_send_obs:
|
188 |
-
need_to_send_obs = false
|
189 |
-
var reward = _get_reward_from_agents()
|
190 |
-
var done = _get_done_from_agents()
|
191 |
-
#_reset_agents_if_done() # this ensures the new observation is from the next env instance : NEEDS REFACTOR
|
192 |
-
|
193 |
-
var obs = _get_obs_from_agents()
|
194 |
-
|
195 |
-
var reply = {
|
196 |
-
"type": "step",
|
197 |
-
"obs": obs,
|
198 |
-
"reward": reward,
|
199 |
-
"done": done
|
200 |
-
}
|
201 |
-
_send_dict_as_json_message(reply)
|
202 |
-
|
203 |
-
var handled = handle_message()
|
204 |
-
else:
|
205 |
-
_reset_agents_if_done()
|
206 |
|
207 |
func handle_message() -> bool:
|
208 |
# get json message: reset, step, close
|
@@ -272,6 +307,7 @@ func _get_obs_from_agents():
|
|
272 |
var obs = []
|
273 |
for agent in agents:
|
274 |
obs.append(agent.get_obs())
|
|
|
275 |
return obs
|
276 |
|
277 |
func _get_reward_from_agents():
|
@@ -293,3 +329,8 @@ func _set_agent_actions(actions):
|
|
293 |
for i in range(len(actions)):
|
294 |
agents[i].set_action(actions[i])
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# --fixed-fps 2000 --disable-render-loop
|
3 |
@export var action_repeat := 8
|
4 |
@export var speed_up = 1
|
5 |
+
@export var onnx_model_path := ""
|
6 |
+
|
7 |
+
@onready var start_time = Time.get_ticks_msec()
|
8 |
|
9 |
const MAJOR_VERSION := "0"
|
10 |
const MINOR_VERSION := "3"
|
|
|
18 |
var agents
|
19 |
var need_to_send_obs = false
|
20 |
var args = null
|
|
|
21 |
var initialized = false
|
22 |
var just_reset = false
|
23 |
+
var onnx_model = null
|
24 |
+
var n_action_steps = 0
|
25 |
|
26 |
+
var _action_space : Dictionary
|
27 |
+
var _obs_space : Dictionary
|
28 |
|
29 |
# Called when the node enters the scene tree for the first time.
|
30 |
|
31 |
func _ready():
|
|
|
32 |
await get_tree().root.ready
|
33 |
get_tree().set_pause(true)
|
34 |
_initialize()
|
35 |
await get_tree().create_timer(1.0).timeout
|
36 |
get_tree().set_pause(false)
|
37 |
+
|
38 |
+
func _initialize():
|
39 |
+
_get_agents()
|
40 |
+
_obs_space = agents[0].get_obs_space()
|
41 |
+
_action_space = agents[0].get_action_space()
|
42 |
+
args = _get_args()
|
43 |
+
Engine.physics_ticks_per_second = _get_speedup() * 60 # Replace with function body.
|
44 |
+
Engine.time_scale = _get_speedup() * 1.0
|
45 |
+
prints("physics ticks", Engine.physics_ticks_per_second, Engine.time_scale, _get_speedup(), speed_up)
|
46 |
+
|
47 |
+
|
48 |
+
connected = connect_to_server()
|
49 |
+
if connected:
|
50 |
+
_set_heuristic("model")
|
51 |
+
_handshake()
|
52 |
+
_send_env_info()
|
53 |
+
elif onnx_model_path != "":
|
54 |
+
onnx_model = ONNXModel.new(onnx_model_path, 1)
|
55 |
+
_set_heuristic("model")
|
56 |
+
else:
|
57 |
+
_set_heuristic("human")
|
58 |
+
|
59 |
+
_set_seed()
|
60 |
+
_set_action_repeat()
|
61 |
+
initialized = true
|
62 |
+
|
63 |
+
func _physics_process(delta):
|
64 |
+
# two modes, human control, agent control
|
65 |
+
# pause tree, send obs, get actions, set actions, unpause tree
|
66 |
+
if n_action_steps % action_repeat != 0:
|
67 |
+
n_action_steps += 1
|
68 |
+
return
|
69 |
+
|
70 |
+
n_action_steps += 1
|
71 |
+
|
72 |
+
if connected:
|
73 |
+
get_tree().set_pause(true)
|
74 |
+
|
75 |
+
if just_reset:
|
76 |
+
just_reset = false
|
77 |
+
var obs = _get_obs_from_agents()
|
78 |
+
|
79 |
+
var reply = {
|
80 |
+
"type": "reset",
|
81 |
+
"obs": obs
|
82 |
+
}
|
83 |
+
_send_dict_as_json_message(reply)
|
84 |
+
# this should go straight to getting the action and setting it checked the agent, no need to perform one phyics tick
|
85 |
+
get_tree().set_pause(false)
|
86 |
+
return
|
87 |
+
|
88 |
+
if need_to_send_obs:
|
89 |
+
need_to_send_obs = false
|
90 |
+
var reward = _get_reward_from_agents()
|
91 |
+
var done = _get_done_from_agents()
|
92 |
+
#_reset_agents_if_done() # this ensures the new observation is from the next env instance : NEEDS REFACTOR
|
93 |
+
|
94 |
+
var obs = _get_obs_from_agents()
|
95 |
+
|
96 |
+
var reply = {
|
97 |
+
"type": "step",
|
98 |
+
"obs": obs,
|
99 |
+
"reward": reward,
|
100 |
+
"done": done
|
101 |
+
}
|
102 |
+
_send_dict_as_json_message(reply)
|
103 |
+
|
104 |
+
var handled = handle_message()
|
105 |
+
|
106 |
+
elif onnx_model != null:
|
107 |
+
var obs : Array = _get_obs_from_agents()
|
108 |
+
|
109 |
+
var actions = []
|
110 |
+
for o in obs:
|
111 |
+
var action = onnx_model.run_inference(o["obs"], 1.0)
|
112 |
+
action["output"] = clamp_array(action["output"], -1.0, 1.0)
|
113 |
+
var action_dict = _extract_action_dict(action["output"])
|
114 |
+
actions.append(action_dict)
|
115 |
+
|
116 |
+
_set_agent_actions(actions)
|
117 |
+
need_to_send_obs = true
|
118 |
+
get_tree().set_pause(false)
|
119 |
+
_reset_agents_if_done()
|
120 |
|
121 |
+
else:
|
122 |
+
_reset_agents_if_done()
|
123 |
+
|
124 |
+
func _extract_action_dict(action_array: Array):
|
125 |
+
var index = 0
|
126 |
+
var result = {}
|
127 |
+
for key in _action_space.keys():
|
128 |
+
var size = _action_space[key]["size"]
|
129 |
+
if _action_space[key]["action_type"] == "discrete":
|
130 |
+
result[key] = round(action_array[index])
|
131 |
+
else:
|
132 |
+
result[key] = action_array.slice(index,index+size)
|
133 |
+
index += size
|
134 |
+
|
135 |
+
return result
|
136 |
+
|
137 |
func _get_agents():
|
138 |
agents = get_tree().get_nodes_in_group("AGENT")
|
139 |
|
|
|
178 |
func _send_env_info():
|
179 |
var json_dict = _get_dict_json_message()
|
180 |
assert(json_dict["type"] == "env_info")
|
181 |
+
|
182 |
+
|
183 |
var message = {
|
184 |
"type" : "env_info",
|
185 |
+
"observation_space": _obs_space,
|
186 |
+
"action_space":_action_space,
|
|
|
187 |
"n_agents": len(agents)
|
188 |
}
|
189 |
_send_dict_as_json_message(message)
|
190 |
|
|
|
191 |
func connect_to_server():
|
192 |
print("Waiting for one second to allow server to start")
|
193 |
OS.delay_msec(1000)
|
|
|
200 |
var connect = stream.connect_to_host(ip, port)
|
201 |
stream.set_no_delay(true) # TODO check if this improves performance or not
|
202 |
stream.poll()
|
203 |
+
# Fetch the status until it is either connected (2) or failed to connect (3)
|
204 |
+
while stream.get_status() < 2:
|
205 |
+
stream.poll()
|
206 |
return stream.get_status() == 2
|
207 |
|
208 |
func _get_args():
|
209 |
print("getting command line arguments")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
var arguments = {}
|
211 |
for argument in OS.get_cmdline_args():
|
212 |
print(argument)
|
|
|
237 |
func disconnect_from_server():
|
238 |
stream.disconnect_from_host()
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
func handle_message() -> bool:
|
243 |
# get json message: reset, step, close
|
|
|
307 |
var obs = []
|
308 |
for agent in agents:
|
309 |
obs.append(agent.get_obs())
|
310 |
+
|
311 |
return obs
|
312 |
|
313 |
func _get_reward_from_agents():
|
|
|
329 |
for i in range(len(actions)):
|
330 |
agents[i].set_action(actions[i])
|
331 |
|
332 |
+
func clamp_array(arr : Array, min:float, max:float):
|
333 |
+
var output : Array = []
|
334 |
+
for a in arr:
|
335 |
+
output.append(clamp(a, min, max))
|
336 |
+
return output
|
bin/VirtualCamera.console.exe
ADDED
Binary file (186 kB). View file
|
|
bin/VirtualCamera.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:784e2e3b2022a9421df07c764fc394ff0576147b16d186b9ed17fb725e96d4d4
|
3 |
+
size 68805120
|
bin/VirtualCamera.pck
CHANGED
Binary files a/bin/VirtualCamera.pck and b/bin/VirtualCamera.pck differ
|
|
bin/VirtualCamera.sh
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
echo -ne '\033c\033]0;VirtualCamera\a'
|
3 |
+
base_path="$(dirname "$(realpath "$0")")"
|
4 |
+
"$base_path/VirtualCamera.x86_64" "$@"
|
bin/VirtualCamera.x86_64
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dda38dcc9dacc4e8d58d79f88a109bd36a30d97af1400a46b9d9d4e24278dbfe
|
3 |
+
size 70085064
|
export_presets.cfg
CHANGED
@@ -3,22 +3,104 @@
|
|
3 |
name="Linux/X11"
|
4 |
platform="Linux/X11"
|
5 |
runnable=true
|
|
|
6 |
custom_features=""
|
7 |
export_filter="all_resources"
|
8 |
include_filter=""
|
9 |
exclude_filter=""
|
10 |
-
export_path="
|
11 |
-
|
|
|
|
|
|
|
12 |
script_encryption_key=""
|
13 |
|
14 |
[preset.0.options]
|
15 |
|
16 |
custom_template/debug=""
|
17 |
custom_template/release=""
|
18 |
-
|
19 |
binary_format/embed_pck=false
|
20 |
-
texture_format/bptc=
|
21 |
texture_format/s3tc=true
|
22 |
texture_format/etc=false
|
23 |
texture_format/etc2=false
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
name="Linux/X11"
|
4 |
platform="Linux/X11"
|
5 |
runnable=true
|
6 |
+
dedicated_server=false
|
7 |
custom_features=""
|
8 |
export_filter="all_resources"
|
9 |
include_filter=""
|
10 |
exclude_filter=""
|
11 |
+
export_path=""
|
12 |
+
encryption_include_filters=""
|
13 |
+
encryption_exclude_filters=""
|
14 |
+
encrypt_pck=false
|
15 |
+
encrypt_directory=false
|
16 |
script_encryption_key=""
|
17 |
|
18 |
[preset.0.options]
|
19 |
|
20 |
custom_template/debug=""
|
21 |
custom_template/release=""
|
22 |
+
debug/export_console_script=1
|
23 |
binary_format/embed_pck=false
|
24 |
+
texture_format/bptc=true
|
25 |
texture_format/s3tc=true
|
26 |
texture_format/etc=false
|
27 |
texture_format/etc2=false
|
28 |
+
binary_format/architecture="x86_64"
|
29 |
+
ssh_remote_deploy/enabled=false
|
30 |
+
ssh_remote_deploy/host="user@host_ip"
|
31 |
+
ssh_remote_deploy/port="22"
|
32 |
+
ssh_remote_deploy/extra_args_ssh=""
|
33 |
+
ssh_remote_deploy/extra_args_scp=""
|
34 |
+
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
35 |
+
export DISPLAY=:0
|
36 |
+
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
37 |
+
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
38 |
+
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
39 |
+
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
40 |
+
rm -rf \"{temp_dir}\""
|
41 |
+
|
42 |
+
[preset.1]
|
43 |
+
|
44 |
+
name="Windows Desktop"
|
45 |
+
platform="Windows Desktop"
|
46 |
+
runnable=true
|
47 |
+
dedicated_server=false
|
48 |
+
custom_features=""
|
49 |
+
export_filter="all_resources"
|
50 |
+
include_filter=""
|
51 |
+
exclude_filter=""
|
52 |
+
export_path=""
|
53 |
+
encryption_include_filters=""
|
54 |
+
encryption_exclude_filters=""
|
55 |
+
encrypt_pck=false
|
56 |
+
encrypt_directory=false
|
57 |
+
script_encryption_key=""
|
58 |
+
|
59 |
+
[preset.1.options]
|
60 |
+
|
61 |
+
custom_template/debug=""
|
62 |
+
custom_template/release=""
|
63 |
+
debug/export_console_script=1
|
64 |
+
binary_format/embed_pck=false
|
65 |
+
texture_format/bptc=true
|
66 |
+
texture_format/s3tc=true
|
67 |
+
texture_format/etc=false
|
68 |
+
texture_format/etc2=false
|
69 |
+
binary_format/architecture="x86_64"
|
70 |
+
codesign/enable=false
|
71 |
+
codesign/identity_type=0
|
72 |
+
codesign/identity=""
|
73 |
+
codesign/password=""
|
74 |
+
codesign/timestamp=true
|
75 |
+
codesign/timestamp_server_url=""
|
76 |
+
codesign/digest_algorithm=1
|
77 |
+
codesign/description=""
|
78 |
+
codesign/custom_options=PackedStringArray()
|
79 |
+
application/modify_resources=true
|
80 |
+
application/icon=""
|
81 |
+
application/console_wrapper_icon=""
|
82 |
+
application/icon_interpolation=4
|
83 |
+
application/file_version=""
|
84 |
+
application/product_version=""
|
85 |
+
application/company_name=""
|
86 |
+
application/product_name=""
|
87 |
+
application/file_description=""
|
88 |
+
application/copyright=""
|
89 |
+
application/trademarks=""
|
90 |
+
ssh_remote_deploy/enabled=false
|
91 |
+
ssh_remote_deploy/host="user@host_ip"
|
92 |
+
ssh_remote_deploy/port="22"
|
93 |
+
ssh_remote_deploy/extra_args_ssh=""
|
94 |
+
ssh_remote_deploy/extra_args_scp=""
|
95 |
+
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
96 |
+
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
97 |
+
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
98 |
+
$settings = New-ScheduledTaskSettingsSet
|
99 |
+
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
100 |
+
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
101 |
+
Start-ScheduledTask -TaskName godot_remote_debug
|
102 |
+
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
103 |
+
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
104 |
+
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
105 |
+
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
106 |
+
Remove-Item -Recurse -Force '{temp_dir}'"
|
icon.png.import
CHANGED
@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte
|
|
16 |
[params]
|
17 |
|
18 |
compress/mode=0
|
|
|
19 |
compress/lossy_quality=0.7
|
20 |
compress/hdr_compression=1
|
21 |
-
compress/bptc_ldr=0
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
mipmaps/generate=false
|
|
|
16 |
[params]
|
17 |
|
18 |
compress/mode=0
|
19 |
+
compress/high_quality=false
|
20 |
compress/lossy_quality=0.7
|
21 |
compress/hdr_compression=1
|
|
|
22 |
compress/normal_map=0
|
23 |
compress/channel_pack=0
|
24 |
mipmaps/generate=false
|
project.godot
CHANGED
@@ -8,40 +8,6 @@
|
|
8 |
|
9 |
config_version=5
|
10 |
|
11 |
-
_global_script_classes=[{
|
12 |
-
"base": "Node2D",
|
13 |
-
"class": &"ISensor2D",
|
14 |
-
"language": &"GDScript",
|
15 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_2d/ISensor2D.gd"
|
16 |
-
}, {
|
17 |
-
"base": "Node3D",
|
18 |
-
"class": &"ISensor3D",
|
19 |
-
"language": &"GDScript",
|
20 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/ISensor3D.gd"
|
21 |
-
}, {
|
22 |
-
"base": "Node3D",
|
23 |
-
"class": &"RGBCameraSensor3D",
|
24 |
-
"language": &"GDScript",
|
25 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/RGBCameraSensor3D.gd"
|
26 |
-
}, {
|
27 |
-
"base": "ISensor3D",
|
28 |
-
"class": &"RayCastSensor3D",
|
29 |
-
"language": &"GDScript",
|
30 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_3d/RaycastSensor3D.gd"
|
31 |
-
}, {
|
32 |
-
"base": "ISensor2D",
|
33 |
-
"class": &"RaycastSensor2D",
|
34 |
-
"language": &"GDScript",
|
35 |
-
"path": "res://addons/godot_rl_agents/sensors/sensors_2d/RaycastSensor2D.gd"
|
36 |
-
}]
|
37 |
-
_global_script_class_icons={
|
38 |
-
"ISensor2D": "",
|
39 |
-
"ISensor3D": "",
|
40 |
-
"RGBCameraSensor3D": "",
|
41 |
-
"RayCastSensor3D": "",
|
42 |
-
"RaycastSensor2D": ""
|
43 |
-
}
|
44 |
-
|
45 |
[application]
|
46 |
|
47 |
config/name="VirtualCamera"
|
@@ -54,6 +20,10 @@ config/icon="res://icon.png"
|
|
54 |
window/size/width=1280
|
55 |
window/size/height=720
|
56 |
|
|
|
|
|
|
|
|
|
57 |
[editor_plugins]
|
58 |
|
59 |
enabled=PackedStringArray()
|
@@ -62,27 +32,27 @@ enabled=PackedStringArray()
|
|
62 |
|
63 |
turn_left={
|
64 |
"deadzone": 0.5,
|
65 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
66 |
]
|
67 |
}
|
68 |
turn_right={
|
69 |
"deadzone": 0.5,
|
70 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
71 |
]
|
72 |
}
|
73 |
move_forwards={
|
74 |
"deadzone": 0.5,
|
75 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
76 |
]
|
77 |
}
|
78 |
move_backwards={
|
79 |
"deadzone": 0.5,
|
80 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
81 |
]
|
82 |
}
|
83 |
r_key={
|
84 |
"deadzone": 0.5,
|
85 |
-
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
86 |
]
|
87 |
}
|
88 |
|
|
|
8 |
|
9 |
config_version=5
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
[application]
|
12 |
|
13 |
config/name="VirtualCamera"
|
|
|
20 |
window/size/width=1280
|
21 |
window/size/height=720
|
22 |
|
23 |
+
[dotnet]
|
24 |
+
|
25 |
+
project/assembly_name="VirtualCamera"
|
26 |
+
|
27 |
[editor_plugins]
|
28 |
|
29 |
enabled=PackedStringArray()
|
|
|
32 |
|
33 |
turn_left={
|
34 |
"deadzone": 0.5,
|
35 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
36 |
]
|
37 |
}
|
38 |
turn_right={
|
39 |
"deadzone": 0.5,
|
40 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
41 |
]
|
42 |
}
|
43 |
move_forwards={
|
44 |
"deadzone": 0.5,
|
45 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
46 |
]
|
47 |
}
|
48 |
move_backwards={
|
49 |
"deadzone": 0.5,
|
50 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
51 |
]
|
52 |
}
|
53 |
r_key={
|
54 |
"deadzone": 0.5,
|
55 |
+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
|
56 |
]
|
57 |
}
|
58 |
|