initial commit

This commit is contained in:
2026-07-04 18:22:23 -06:00
commit 55522fc6fc
272 changed files with 12391 additions and 0 deletions
@@ -0,0 +1,49 @@
[gd_scene format=3 uid="uid://bl1fe6rldpncu"]
[ext_resource type="Script" uid="uid://cr4oydwvmm28y" path="res://widgets/accelerometer/scripts/accelerometer_widget_node.gd" id="1_hqf45"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="2_pog3i"]
[node name="AccelerometerWidget" type="Node2D" unique_id=1057256615]
script = ExtResource("1_hqf45")
metadata/_custom_type_script = "uid://cr4oydwvmm28y"
[node name="Panel" type="Panel" parent="." unique_id=1154284634]
visible = false
offset_left = -103.0
offset_top = -103.0
offset_right = 106.0
offset_bottom = 106.0
[node name="AccelVector" type="Line2D" parent="." unique_id=108699994]
points = PackedVector2Array(0, 0, 100, 100)
begin_cap_mode = 2
end_cap_mode = 2
[node name="XVector" type="Line2D" parent="." unique_id=1227326235]
points = PackedVector2Array(0, 0, -100, -100)
width = 5.0
default_color = Color(1, 0, 0, 1)
begin_cap_mode = 2
end_cap_mode = 2
[node name="YVector" type="Line2D" parent="." unique_id=1118780031]
width = 5.0
default_color = Color(0, 1, 0, 1)
begin_cap_mode = 2
end_cap_mode = 2
[node name="Label" type="Label" parent="." unique_id=749031600]
offset_right = 40.0
offset_bottom = 23.0
[node name="MovableControl" type="Control" parent="." unique_id=345939378 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_left = -103.0
offset_top = -103.0
offset_right = 106.0
offset_bottom = 106.0
mouse_filter = 1
script = ExtResource("2_pog3i")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
@@ -0,0 +1,32 @@
extends BaseWidgetNode
class_name AccelerometerWidgetNode
var accel_vector: Line2D
var x_vector: Line2D
var y_vector: Line2D
var label: Label
var origin: Vector2 = Vector2(0., 0.)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
super._ready()
Signals.linear_acceleration_updated.connect(_on_linear_acceleration_updated)
label = get_node('Label')
accel_vector = get_node("AccelVector")
accel_vector.points = [origin, origin]
x_vector = get_node("XVector")
x_vector.points = [origin, origin]
y_vector = get_node("YVector")
y_vector.points = [origin, origin]
func _on_linear_acceleration_updated(sensor_ip: String, linear_acceleration: Array):
var accel_vec = Vector2(-linear_acceleration[1], linear_acceleration[0])
var vec_norm: Vector2 = accel_vec.normalized()
var vec_length: float = accel_vec.length()
var accel_g = vec_length / Constants.g
var x_vec = Vector2(vec_norm.x*vec_length, 0)
accel_vector.points = [origin, accel_vec * 10]
x_vector.points = [origin, x_vec * 10]
y_vector.points = [x_vec * 10, accel_vec * 10]
label.text = str(round(accel_g*100)/100) + ' g'
@@ -0,0 +1 @@
uid://cr4oydwvmm28y
+30
View File
@@ -0,0 +1,30 @@
[gd_scene format=3 uid="uid://m14p8xxs14rf"]
[ext_resource type="Script" uid="uid://b3rfje1auw6to" path="res://widgets/altitude/scripts/altitude_widget_node.gd" id="1_hmdxp"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="2_34sps"]
[node name="AltitudeWidget" type="Node2D" unique_id=1004159593]
script = ExtResource("1_hmdxp")
metadata/_custom_type_script = "uid://b3rfje1auw6to"
[node name="Panel" type="Panel" parent="." unique_id=1393400967]
offset_right = 306.0
offset_bottom = 70.0
[node name="Label" type="Label" parent="." unique_id=1070194714]
offset_right = 306.0
offset_bottom = 70.0
theme_override_font_sizes/font_size = 32
text = "Altitude: 99999 ft"
horizontal_alignment = 1
vertical_alignment = 1
[node name="MovableControl" type="Control" parent="." unique_id=1186292353 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_right = 306.0
offset_bottom = 70.0
mouse_filter = 1
script = ExtResource("2_34sps")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
@@ -0,0 +1,16 @@
extends BaseWidgetNode
class_name AltitudeWidgetNode
var label_node: Label
var constants: Node
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
super._ready()
label_node = get_node("Label")
label_node.text = "0 ft"
Signals.altitude_updated.connect(_on_altitude_updated)
func _on_altitude_updated(sensor_ip: String, altitude_km: float):
label_node.text = 'Altitude: ' + str(int(round(altitude_km * Constants.M2FT * 1000))) + ' ft'
@@ -0,0 +1 @@
uid://b3rfje1auw6to
+36
View File
@@ -0,0 +1,36 @@
extends Node2D
class_name BaseWidgetNode
var sensor_class: String
var used_sensors: Dictionary = {}
var host_vehicle: VehicleNode
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Signals.vehicle_added.connect(_on_vehicle_added)
Signals.requested_host_vehicle.emit(self)
func _process(delta: float):
if host_vehicle != null:
return
Signals.requested_host_vehicle.emit(self)
func _on_vehicle_added(new_vehicle):
host_vehicle = new_vehicle
func set_host_vehicle(new_vehicle):
host_vehicle = new_vehicle
func check_valid_sensor(sensor_ip: String, sensor_class: String):
if host_vehicle == null:
return false
if sensor_ip not in host_vehicle.sensor_suites:
return false
if sensor_class == null:
return true
if sensor_class not in host_vehicle.sensor_classes:
return false
if sensor_ip not in host_vehicle.sensor_classes[sensor_class]:
return false
return true
+1
View File
@@ -0,0 +1 @@
uid://d38qqe1k0dv2p
+38
View File
@@ -0,0 +1,38 @@
[gd_scene format=3 uid="uid://bbdbyjievjpsq"]
[ext_resource type="Script" uid="uid://nxvyqddlwaf1" path="res://widgets/compass/scripts/compass_widget_node.gd" id="1_fslm7"]
[ext_resource type="Texture2D" uid="uid://cduyjqlfqd4bh" path="res://widgets/compass/resources/compass_indicator.png" id="2_qf1yp"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="3_qf1yp"]
[node name="Compass" type="Node2D" unique_id=2062816665]
rotation = -6.2831855
script = ExtResource("1_fslm7")
[node name="CompassIndicator" type="Sprite2D" parent="." unique_id=630014919]
position = Vector2(0, -100)
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_qf1yp")
[node name="Label" type="Label" parent="." unique_id=338110309]
offset_left = -50.0
offset_top = -350.0
offset_right = 50.0
offset_bottom = -150.0
theme_override_font_sizes/font_size = 80
text = "N"
horizontal_alignment = 1
vertical_alignment = 1
justification_flags = 161
[node name="MovableControl" type="Control" parent="." unique_id=124696843 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_left = -128.99997
offset_top = -188.00002
offset_right = 125.83328
offset_bottom = 194.89629
mouse_filter = 1
mouse_default_cursor_shape = 13
script = ExtResource("3_qf1yp")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cduyjqlfqd4bh"
path="res://.godot/imported/compass_indicator.png-8d5bbada0ecaff62865bf7bf5d36fd00.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://widgets/compass/resources/compass_indicator.png"
dest_files=["res://.godot/imported/compass_indicator.png-8d5bbada0ecaff62865bf7bf5d36fd00.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
@@ -0,0 +1,21 @@
extends BaseWidgetNode
class_name CompassWidgetNode
@export_range(0., 359., 0.1) var north_deg = 0.
var north_rad: float
var indicator: Sprite2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
super._ready()
if north_deg == null:
north_deg = 0.
north_rad = deg_to_rad(north_deg)
Signals.heading_updated.connect(_on_heading_updated)
indicator = get_node("CompassIndicator")
func _on_heading_updated(sensor_ip: String, heading_rad: float):
if not check_valid_sensor(sensor_ip, "MAG"):
return
indicator.rotation = north_rad + heading_rad
@@ -0,0 +1 @@
uid://nxvyqddlwaf1
@@ -0,0 +1,11 @@
extends BaseWidgetNode
class_name CoordinatesWidgetNode
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
@@ -0,0 +1 @@
uid://b6qxy6aymwevm
+13
View File
@@ -0,0 +1,13 @@
[gd_scene format=3 uid="uid://c1tptpc2xsvix"]
[ext_resource type="Script" uid="uid://mt037slvxcey" path="res://widgets/network/scripts/network_widget_node.gd" id="1_fmbht"]
[node name="NetworkWidget" type="Node2D" unique_id=864131213]
script = ExtResource("1_fmbht")
metadata/_custom_type_script = "uid://mt037slvxcey"
[node name="Label" type="Label" parent="." unique_id=753359612]
offset_right = 40.0
offset_bottom = 23.0
text = "Network
Widget"
@@ -0,0 +1,20 @@
extends BaseWidgetNode
class_name NetworkWidgetNode
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var label = get_node("Label")
var label_text: String = ''
for address in IP.get_local_addresses():
label_text += address + '\n'
label.text = label_text
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var label = get_node("Label")
var label_text: String = ''
for address in IP.get_local_addresses():
label_text += address + '\n'
label.text = label_text
@@ -0,0 +1 @@
uid://mt037slvxcey
+52
View File
@@ -0,0 +1,52 @@
[gd_scene format=3 uid="uid://bosjd085m7dnh"]
[ext_resource type="Script" uid="uid://ck4h0hm0ob56p" path="res://widgets/rotation/scripts/pitch_widget_node.gd" id="1_875uw"]
[ext_resource type="Texture2D" uid="uid://dlyvq43tjdaja" path="res://widgets/rotation/resources/crosstrek_left_outline.png" id="2_2b2r3"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="3_xt4uc"]
[node name="PitchWidget" type="Node2D" unique_id=446468870]
script = ExtResource("1_875uw")
metadata/_custom_type_script = "uid://ck4h0hm0ob56p"
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2072259568]
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_2b2r3")
[node name="Line2D" type="Line2D" parent="Sprite2D" unique_id=789552281]
points = PackedVector2Array(1500, 0, 2000, 0)
default_color = Color(0.1254902, 0.1254902, 0.1254902, 1)
[node name="Line2D2" type="Line2D" parent="Sprite2D" unique_id=346829192]
points = PackedVector2Array(-1500, 0, -2000, 0)
default_color = Color(0.1254902, 0.1254902, 0.1254902, 1)
[node name="Label" type="Label" parent="." unique_id=1536224386]
custom_minimum_size = Vector2(100, 0)
offset_left = -50.0
offset_top = -22.0
offset_right = 50.0
offset_bottom = 23.0
theme_override_font_sizes/font_size = 32
horizontal_alignment = 1
[node name="Line2D" type="Line2D" parent="." unique_id=1285997474]
points = PackedVector2Array(150, 0, 225, 0)
width = 1.0
default_color = Color(0, 0, 0, 1)
[node name="Line2D2" type="Line2D" parent="." unique_id=1217978761]
points = PackedVector2Array(-150, 0, -225, 0)
width = 1.0
default_color = Color(0, 0, 0, 1)
[node name="MovableControl" type="Control" parent="." unique_id=933534450 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_left = -228.0
offset_top = -45.0
offset_right = 227.0
offset_bottom = 46.0
mouse_filter = 1
script = ExtResource("3_xt4uc")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2lryykomcen"
path="res://.godot/imported/corsstrek_back_outline.png-92f6d4b266c6998d35340bf8d0778b6e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://widgets/rotation/resources/corsstrek_back_outline.png"
dest_files=["res://.godot/imported/corsstrek_back_outline.png-92f6d4b266c6998d35340bf8d0778b6e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cm3djc4qf14bd"
path="res://.godot/imported/crosstrek_front_outline.png-6479eaaf1adefbe7c6251ef8dd7f4797.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://widgets/rotation/resources/crosstrek_front_outline.png"
dest_files=["res://.godot/imported/crosstrek_front_outline.png-6479eaaf1adefbe7c6251ef8dd7f4797.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dlyvq43tjdaja"
path="res://.godot/imported/crosstrek_left_outline.png-e06999811d51aef7b3a2c0bfabe0ac44.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://widgets/rotation/resources/crosstrek_left_outline.png"
dest_files=["res://.godot/imported/crosstrek_left_outline.png-e06999811d51aef7b3a2c0bfabe0ac44.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cweqvcg1h48bk"
path="res://.godot/imported/crosstrek_right_outline.png-c84d4d5d654cd52cbbc156ef67c96d3b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://widgets/rotation/resources/crosstrek_right_outline.png"
dest_files=["res://.godot/imported/crosstrek_right_outline.png-c84d4d5d654cd52cbbc156ef67c96d3b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+52
View File
@@ -0,0 +1,52 @@
[gd_scene format=3 uid="uid://c61d1lcpgyld"]
[ext_resource type="Script" uid="uid://ckhpodvbko5y0" path="res://widgets/rotation/scripts/roll_widget_node.gd" id="1_pi8hj"]
[ext_resource type="Texture2D" uid="uid://b2lryykomcen" path="res://widgets/rotation/resources/corsstrek_back_outline.png" id="2_fu8d0"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="3_mrkoo"]
[node name="RollWidget" type="Node2D" unique_id=1446458625]
script = ExtResource("1_pi8hj")
metadata/_custom_type_script = "uid://ckhpodvbko5y0"
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=745045303]
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_fu8d0")
[node name="Line2D" type="Line2D" parent="Sprite2D" unique_id=1741698222]
points = PackedVector2Array(600, 0, 1000, 0)
default_color = Color(0.1254902, 0.1254902, 0.1254902, 1)
[node name="Line2D2" type="Line2D" parent="Sprite2D" unique_id=662407004]
points = PackedVector2Array(-600, 0, -1000, 0)
default_color = Color(0.1254902, 0.1254902, 0.1254902, 1)
[node name="Label" type="Label" parent="." unique_id=1267850263]
custom_minimum_size = Vector2(100, 0)
offset_left = -50.0
offset_top = -22.0
offset_right = 50.0
offset_bottom = 23.0
theme_override_font_sizes/font_size = 32
horizontal_alignment = 1
[node name="Line2D" type="Line2D" parent="." unique_id=1446923009]
points = PackedVector2Array(60, 0, 120, 0)
width = 1.0
default_color = Color(0, 0, 0, 1)
[node name="Line2D2" type="Line2D" parent="." unique_id=1131168134]
points = PackedVector2Array(-60, 0, -120, 0)
width = 1.0
default_color = Color(0, 0, 0, 1)
[node name="MovableControl" type="Control" parent="." unique_id=550168595 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_left = -122.0
offset_top = -45.0
offset_right = 121.0
offset_bottom = 44.0
mouse_filter = 1
script = ExtResource("3_mrkoo")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
@@ -0,0 +1,18 @@
extends BaseWidgetNode
class_name PitchWidgetNode
var sprite: Sprite2D
var label: Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
SensorSignals.pitch_updated.connect(_on_pitch_updated)
sprite = get_node("Sprite2D")
label = get_node("Label")
var label_size = label.size
func _on_pitch_updated(sensor_ip: String, pitch_rad: float):
sprite.rotation = pitch_rad
label.text = str(round(rad_to_deg(pitch_rad)*10)/10) + " \u00B0"
@@ -0,0 +1 @@
uid://ck4h0hm0ob56p
@@ -0,0 +1,17 @@
extends BaseWidgetNode
class_name RollWidgetNode
var sprite: Sprite2D
var label: Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
SensorSignals.roll_updated.connect(_on_roll_updated)
sprite = get_node("Sprite2D")
label = get_node("Label")
var label_size = label.size
func _on_roll_updated(sensor_ip: String, roll_rad: float):
sprite.rotation = roll_rad
label.text = str(round(rad_to_deg(abs(roll_rad))*10)/10) + " \u00B0"
@@ -0,0 +1 @@
uid://ckhpodvbko5y0
+16
View File
@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://c82t66hq0g1sq"]
[sub_resource type="SphereMesh" id="SphereMesh_mgj8s"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ivcly"]
albedo_color = Color(0, 1, 1, 1)
emission_enabled = true
emission = Color(1, 1, 1, 1)
emission_energy_multiplier = 100.0
[node name="Satellite" type="Node3D" unique_id=990255812]
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=829681102]
transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 100, 0, 0, 0)
mesh = SubResource("SphereMesh_mgj8s")
surface_material_override/0 = SubResource("StandardMaterial3D_ivcly")
+30
View File
@@ -0,0 +1,30 @@
[gd_scene format=3 uid="uid://b71kuj4yole3j"]
[ext_resource type="Script" uid="uid://dwif4hgjhkd4j" path="res://widgets/satellites/scripts/satellite_widget_node.gd" id="1_q0bd2"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="2_a0wwr"]
[node name="SatelliteWidget" type="Node2D" unique_id=931018379]
script = ExtResource("1_q0bd2")
metadata/_custom_type_script = "uid://dwif4hgjhkd4j"
[node name="Panel" type="Panel" parent="." unique_id=1980601372]
offset_right = 4000.0
offset_bottom = 698.0
[node name="Label" type="Label" parent="." unique_id=1126441894]
offset_left = 2.0
offset_top = 2.0
offset_right = 42.0
offset_bottom = 26.0
theme_override_font_sizes/font_size = 512
vertical_alignment = 1
[node name="MovableControl" type="Control" parent="." unique_id=73140661 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_right = 4000.0
offset_bottom = 698.0
mouse_filter = 1
script = ExtResource("2_a0wwr")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
@@ -0,0 +1,101 @@
extends Node3D
class_name SatelliteWidget3dNode
var sensor_class: String
var used_sensors: Dictionary = {}
var host_vehicle: VehicleNode
var vehicle_3d_node: Node3D
var vehicle_position: Vector3 = Vector3.ZERO
var sat_scene: PackedScene = preload("res://widgets/satellites/satellite.tscn")
var sat_nodes = {}
var need_sat_update: bool = true
var sat_update_timer: float = 0
var sat_update_rate: float = 60.
var lines = []
var GPS_ALT_KM = 20_200
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GPS_ALT_KM += Constants.EARTH_RADIUS_KM
Signals.vehicle_added.connect(_on_vehicle_added)
Signals.requested_host_vehicle.emit(self)
Signals.sat_position_updated.connect(_on_sat_position_updated)
Signals.position_updated.connect(_on_position_updated)
func _process(delta: float):
sat_update_timer += delta
if sat_update_timer >= sat_update_rate:
sat_update_timer = 0
need_sat_update = true
if host_vehicle != null:
return
Signals.requested_host_vehicle.emit(self)
func _on_vehicle_added(new_vehicle):
host_vehicle = new_vehicle
func set_host_vehicle(new_vehicle):
host_vehicle = new_vehicle
vehicle_3d_node = Node3D.new()
add_child(vehicle_3d_node)
func check_valid_sensor(sensor_ip: String, sensor_class: String):
if host_vehicle == null:
return false
if sensor_ip not in host_vehicle.sensors:
return false
if sensor_class == null:
return true
if sensor_class not in host_vehicle.sensor_classes:
return false
if sensor_ip not in host_vehicle.sensor_classes[sensor_class]:
return false
return true
func _on_sat_position_updated(sensor_ip: String, sat_position_data: Array):
if vehicle_3d_node == null:
return
if not need_sat_update:
return
need_sat_update = false
var current_sat_ids = []
for sat_data in sat_position_data:
var sat_id = sat_data[0]
var el_rad = deg_to_rad(sat_data[1])
var az_rad = deg_to_rad(sat_data[2])
current_sat_ids.append(sat_id)
if sat_id not in sat_nodes:
_create_sat_node(sat_id)
_update_sat_position(sat_id, el_rad, az_rad)
for old_sat_id in sat_nodes.keys():
if old_sat_id not in current_sat_ids:
vehicle_3d_node.remove_child(sat_nodes[old_sat_id])
sat_nodes[old_sat_id].queue_free()
sat_nodes.erase(old_sat_id)
func _create_sat_node(sat_id: String):
var new_sat_node = sat_scene.instantiate()
sat_nodes[sat_id] = new_sat_node
vehicle_3d_node.add_child(new_sat_node)
func _update_sat_position(sat_id, el_rad, az_rad):
# vehicle node is rotated to SEZ.
# Az is rotated clockwise from north
# 0 el is horizon. 90 is zenith
var x = sin(el_rad) * cos(az_rad + PI)
var y = sin(el_rad) * sin(az_rad + PI)
var z = cos(el_rad)
var sat_position = Vector3(x, y, z)
var global_sat_position = ((vehicle_position.normalized() + sat_position) * GPS_ALT_KM)
var local_sat_position = global_sat_position - vehicle_position
sat_nodes[sat_id].position = Vector3(local_sat_position.x, local_sat_position.z, local_sat_position.y)
func _on_position_updated(sensor_ip: String, physics_position: Vector3):
if vehicle_3d_node == null:
return
vehicle_position = physics_position
vehicle_3d_node.position = Vector3(physics_position.x, physics_position.z, physics_position.y)
@@ -0,0 +1 @@
uid://1825fgmcotxw
@@ -0,0 +1,40 @@
extends BaseWidgetNode
class_name SatelliteWidgetNode
@export_enum("Total", "BeiDou", "Galileo", "GLONASS", "GNSS", "GPS", "NavIC", "QZSS") var sat_category: String = "Total"
#[ga, gb, gi, gl, gp, gq, gn]
var sat_idx_map = {
"Galileo": 0,
"BeiDou": 1,
"NavIC": 2,
"GLONASS": 3,
"GPS": 4,
"QZSS": 5,
"GNSS": 6,
}
var label_node: Label
var prev_num_connections: int = 0
var num_connections: int = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
super._ready()
sensor_class = "PNT"
label_node = get_node("Label")
Signals.sat_count_updated.connect(_on_sat_count_updated)
label_node.text = sat_category + ": 0"
func _on_sat_count_updated(sensor_ip: String, sat_count_array: Array):
if sat_category == "Total":
var sat_sum = 0
for val in sat_count_array:
sat_sum += val
num_connections = sat_sum
else:
num_connections = sat_count_array[sat_idx_map[sat_category]]
if num_connections == prev_num_connections:
return
label_node.text = sat_category + ": " + str(num_connections)
prev_num_connections = num_connections
@@ -0,0 +1 @@
uid://dwif4hgjhkd4j
@@ -0,0 +1,22 @@
extends BaseWidgetNode
class_name SpeedWidgetNode
var K2MI = 0.6213712
var speed_kmh: float
var speed_mph: float
var label_node: Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
label_node = get_node("VBoxContainer/SpeedLabel")
SensorSignals.speed_updated.connect(_on_speed_updated)
func _on_speed_updated(ip_address: String, pnt_speed_kmh: float):
speed_kmh = pnt_speed_kmh
speed_mph = speed_kmh * K2MI
var display_speed: int = 0
if speed_mph >= 1:
display_speed = int(round(speed_mph))
label_node.text = str(display_speed)
@@ -0,0 +1 @@
uid://s6pwa5oevfwf
+36
View File
@@ -0,0 +1,36 @@
[gd_scene format=3 uid="uid://c71ads44rsa4u"]
[ext_resource type="Script" uid="uid://s6pwa5oevfwf" path="res://widgets/speed/scripts/speed_widget_node.gd" id="1_yqqoq"]
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="2_383ed"]
[node name="SpeedWidget" type="Node2D" unique_id=186354912]
script = ExtResource("1_yqqoq")
metadata/_custom_type_script = "uid://s6pwa5oevfwf"
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=596189086]
offset_right = 40.0
offset_bottom = 40.0
[node name="SpeedLabel" type="Label" parent="VBoxContainer" unique_id=2101712075]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
theme_override_font_sizes/font_size = 48
text = "10"
horizontal_alignment = 1
[node name="UnitLabel" type="Label" parent="VBoxContainer" unique_id=123505815]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme_override_font_sizes/font_size = 16
text = "MPH"
horizontal_alignment = 1
[node name="MovableControl" type="Control" parent="." unique_id=805495128 node_paths=PackedStringArray("move_target")]
layout_mode = 3
anchors_preset = 0
offset_right = 145.0
offset_bottom = 197.0
mouse_filter = 1
script = ExtResource("2_383ed")
move_target = NodePath("..")
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"