-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from feagi/Stat_call
Stat call
- Loading branch information
Showing
16 changed files
with
173 additions
and
114 deletions.
There are no files selected for viewing
5 changes: 0 additions & 5 deletions
5
.godot/editor/Main.tscn-folding-bcb0d2eb5949c52b6a65bfe9de3e985b.cfg
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"FEAGI_domain":"127.0.0.1","enabled":true,"encryption":"NO_ENCRYPTION","feagi_output_mappings":[{"OPU_mapping_to":"MOTOR","godot_action":"move_left","neuron_X_index":0,"optional_signal_name":"","pass_FEAGI_weight_instead_of_max":false,"seconds_to_hold":0.1,"threshold":0.01},{"OPU_mapping_to":"MOTOR","godot_action":"move_right","neuron_X_index":1,"optional_signal_name":"","pass_FEAGI_weight_instead_of_max":false,"seconds_to_hold":0.1,"threshold":0.01}],"http_port":"8000","metrics":[],"output":"AUTOMATIC_SEND_WHOLE_VIEWPORT","websocket_port":"9055"} |
32 changes: 32 additions & 0 deletions
32
addons/FeagiIntegration/Feagi-Interface/FEAGIActionHolder.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
""" | ||
Copyright 2016-2024 The FEAGI Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
============================================================================== | ||
""" | ||
extends Timer | ||
class_name FEAGIActionHolder | ||
## Holds down an action from a FEAGI press for the duration specified | ||
|
||
var action_mapping: FEAGIActionMap | ||
|
||
func setup_from_action(action_mapping_: FEAGIActionMap) -> void: | ||
action_mapping = action_mapping_ | ||
timeout.connect(_FEAGI_released) | ||
|
||
func FEAGI_pressed(strength: float) -> void: | ||
stop() # reset the timer to the hold time | ||
start(action_mapping.seconds_to_hold) | ||
action_mapping.action(strength) | ||
|
||
func _FEAGI_released() -> void: | ||
action_mapping.action(0.0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extends HTTPRequest | ||
class_name FEAGIHTTP | ||
##Allows for sending of HTTP requests to FEAGI | ||
|
||
signal FEAGI_call_complete(response_code: int, data: PackedByteArray) | ||
|
||
func _ready() -> void: | ||
request_completed.connect(_on_call_complete) | ||
|
||
func send_POST_request(base_URL: StringName, header: PackedStringArray, URL_path: StringName, json: StringName) -> void: | ||
request(base_URL + URL_path, header, HTTPClient.METHOD_POST, json) | ||
|
||
func send_PUT_request(base_URL: StringName, header: PackedStringArray, URL_path: StringName, json: StringName) -> void: | ||
request(base_URL + URL_path, header, HTTPClient.METHOD_PUT, json) | ||
|
||
func send_DELETE_request(base_URL: StringName, header: PackedStringArray, URL_path: StringName, json: StringName) -> void: | ||
request(base_URL + URL_path, header, HTTPClient.METHOD_DELETE, json) | ||
|
||
func _on_call_complete(_result: HTTPRequest.Result, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void: | ||
FEAGI_call_complete.emit(response_code, body) | ||
queue_free() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://bleh55any0dbr"] | ||
|
||
[ext_resource type="Script" path="res://addons/FeagiIntegration/Feagi-Interface/FEAGIHTTP.gd" id="1_ju7qc"] | ||
|
||
[node name="Feagihttp" type="HTTPRequest"] | ||
script = ExtResource("1_ju7qc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.