Skip to content
Snippets Groups Projects
Commit d3ad4643 authored by jlKronos01's avatar jlKronos01
Browse files

New graph

parent 5b338480
No related branches found
No related tags found
No related merge requests found
...@@ -211,10 +211,10 @@ class AnchorTagGUI: ...@@ -211,10 +211,10 @@ class AnchorTagGUI:
# Define lower and upper bounds based on measured distances # Define lower and upper bounds based on measured distances
lower_bound = [ lower_bound = [
-max_dist / 2, # x_B lower bound -max_dist, # x_B lower bound
min_dist / 2, # y_B lower bound (above y_C) -max_dist, # y_B lower bound (above y_C)
-max_dist / 2, # x_C lower bound -max_dist, # x_C lower bound
min_dist / 4, # y_C lower bound -max_dist, # y_C lower bound
min_dist / 2 # y_A lower bound min_dist / 2 # y_A lower bound
] ]
upper_bound = [ upper_bound = [
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
{ {
"name": "A1", "name": "A1",
"x": 0, "x": 0,
"y": 651.0481397780962 "y": 648.6316708863168
}, },
{ {
"name": "A2", "name": "A2",
"x": 1479.7478814611454, "x": 1468.4133842739848,
"y": 151.04148347199438 "y": 194.60015778254368
}, },
{ {
"name": "A3", "name": "A3",
"x": 685.6726454571167, "x": 613.1114093691383,
"y": 51.538313358969546 "y": -662.092685166558
}, },
{ {
"name": "A4", "name": "A4",
...@@ -23,63 +23,27 @@ ...@@ -23,63 +23,27 @@
}, },
{ {
"name": "Node5", "name": "Node5",
"x": 331.69908639944265, "x": 422.68116099210135,
"y": 219.6884517103497 "y": 240.66665054606628
}, },
{ {
"name": "Node6", "name": "Node6",
"x": 804.6899830688058, "x": 225.39109837500405,
"y": 253.54023292422087 "y": 103.58921334272708
}, },
{ {
"name": "Node7", "name": "Node7",
"x": 731.3223179628816, "x": 833.3324669960278,
"y": 648.2744809152002 "y": 580.806573828447
}, },
{ {
"name": "Node8", "name": "Node8",
"x": 1337.665266230345, "x": 351.6722842246809,
"y": 594.604557319591 "y": 595.6297821466235
},
{
"name": "Node9",
"x": 1296.8310843564375,
"y": 237.97240044765596
},
{
"name": "Node10",
"x": 1001.8600424277655,
"y": 240.102853853133
} }
], ],
"connections": [ "connections": [
[ [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
[
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
[
false,
false,
false, false,
false, false,
false, false,
...@@ -97,8 +61,6 @@ ...@@ -97,8 +61,6 @@
false, false,
false, false,
false, false,
false,
false,
false false
], ],
[ [
...@@ -107,8 +69,6 @@ ...@@ -107,8 +69,6 @@
false, false,
false, false,
false, false,
true,
false,
false, false,
false, false,
false false
...@@ -118,9 +78,7 @@ ...@@ -118,9 +78,7 @@
false, false,
false, false,
false, false,
true,
false, false,
true,
false, false,
false, false,
false false
...@@ -133,8 +91,6 @@ ...@@ -133,8 +91,6 @@
false, false,
true, true,
false, false,
true,
false,
false false
], ],
[ [
...@@ -142,8 +98,6 @@ ...@@ -142,8 +98,6 @@
false, false,
false, false,
false, false,
false,
false,
true, true,
false, false,
true, true,
...@@ -155,8 +109,6 @@ ...@@ -155,8 +109,6 @@
false, false,
false, false,
false, false,
false,
false,
true, true,
false, false,
true true
...@@ -168,8 +120,6 @@ ...@@ -168,8 +120,6 @@
false, false,
false, false,
false, false,
false,
false,
true, true,
false false
] ]
......
...@@ -4,7 +4,7 @@ import os ...@@ -4,7 +4,7 @@ import os
from realtime_location_cli_only import AnchorTagCLI from realtime_location_cli_only import AnchorTagCLI
class GraphMaker: class GraphMaker:
def __init__(self, port="COM11", testing=False): def __init__(self, port="COM5", testing=False):
self.app = AnchorTagCLI(port=port, testing=testing) self.app = AnchorTagCLI(port=port, testing=testing)
self.graph = { self.graph = {
"name": "Lab 1 Extended", "name": "Lab 1 Extended",
...@@ -15,7 +15,8 @@ class GraphMaker: ...@@ -15,7 +15,8 @@ class GraphMaker:
def call_bpm_and_store_anchors(self): def call_bpm_and_store_anchors(self):
self.app.call_bpm() self.app.call_bpm()
for name, (x, y) in self.app.anchors.items(): for name, (x, y, z) in self.app.anchors.items():
# print(name, x, y)
self.graph["nodes"].append({ self.graph["nodes"].append({
"name": name, "name": name,
"x": x, "x": x,
...@@ -73,7 +74,8 @@ class GraphMaker: ...@@ -73,7 +74,8 @@ class GraphMaker:
print(f"Node {new_node_index+1} added at ({tag1_x:.2f}, {tag1_y:.2f}).") print(f"Node {new_node_index+1} added at ({tag1_x:.2f}, {tag1_y:.2f}).")
def save_graph(self): def save_graph(self):
directory = "/Users/paulwinpenny/Documents/GitHub/robobin/Wireless_Communication/UWB/Beacons_tag_position/output" # directory = "/Users/paulwinpenny/Documents/GitHub/robobin/Wireless_Communication/UWB/Beacons_tag_position/output"
directory = "C:/Users/joell/OneDrive/Documents/GitHub"
os.makedirs(directory, exist_ok=True) # Create the directory if it doesn't exist os.makedirs(directory, exist_ok=True) # Create the directory if it doesn't exist
file_path = os.path.join(directory, "graph.json") file_path = os.path.join(directory, "graph.json")
with open(file_path, "w") as f: with open(file_path, "w") as f:
...@@ -108,5 +110,5 @@ class GraphMaker: ...@@ -108,5 +110,5 @@ class GraphMaker:
print("Invalid command. Try 'bpm', 'start', 'save', 'finish', or 'quit'.") print("Invalid command. Try 'bpm', 'start', 'save', 'finish', or 'quit'.")
if __name__ == "__main__": if __name__ == "__main__":
graph_maker = GraphMaker(port="/dev/tty.usbmodem14101", testing=False) graph_maker = GraphMaker(port="COM5", testing=False)
graph_maker.run() graph_maker.run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment