@@ -19,18 +19,6 @@ def __init__(self, state):
19
19
self .broker = BrokerConnect (state )
20
20
self .info = Information (state )
21
21
22
- def get_xyz (self ):
23
- """Returns the current (x, y, z) coordinates of the FarmBot."""
24
-
25
- tree_data = self .info .read_status ()
26
-
27
- x_val = tree_data ["location_data" ]["position" ]["x" ]
28
- y_val = tree_data ["location_data" ]["position" ]["y" ]
29
- z_val = tree_data ["location_data" ]["position" ]["z" ]
30
-
31
- self .broker .state .print_status ("get_xyz()" , description = f"Current coordinate: ({ x_val } , { y_val } , { z_val } )." )
32
- return x_val , y_val , z_val
33
-
34
22
def move (self , x , y , z ):
35
23
"""Moves to the specified (x, y, z) coordinate."""
36
24
@@ -67,10 +55,8 @@ def axis_overwrite(axis, value):
67
55
68
56
self .broker .publish (move_message )
69
57
70
- x_val , y_val , z_val = self .get_xyz ()
71
-
72
- self .broker .state .print_status ("move()" , description = f"Moved to coordinates: ({ x_val } , { y_val } , { z_val } )." )
73
- return x_val , y_val , z_val
58
+ self .broker .state .print_status ("move()" , description = f"Moved to coordinates: ({ x } , { y } , { z } )." )
59
+ return x , y , z
74
60
75
61
def set_home (self , axis = "all" ):
76
62
"""Sets the current position as the home position for a specific axis."""
@@ -116,10 +102,8 @@ def find_home(self, axis="all", speed=100):
116
102
}
117
103
self .broker .publish (message )
118
104
119
- x_val , y_val , z_val = self .get_xyz ()
120
-
121
- self .broker .state .print_status ("find_home()" , description = f"Moved to home: ({ x_val } , { y_val } , { z_val } )." )
122
- return x_val , y_val , z_val
105
+ self .broker .state .print_status ("find_home()" , description = "Moved to home position." )
106
+ return
123
107
124
108
def axis_length (self , axis = "all" ):
125
109
"""Returns the length of a specified axis."""
@@ -137,6 +121,18 @@ def axis_length(self, axis="all"):
137
121
self .broker .publish (axis_length_message )
138
122
return # TODO: return axis length as values(?)
139
123
124
+ def get_xyz (self ):
125
+ """Returns the current (x, y, z) coordinates of the FarmBot."""
126
+
127
+ tree_data = self .info .read_status ()
128
+
129
+ x_val = tree_data ["location_data" ]["position" ]["x" ]
130
+ y_val = tree_data ["location_data" ]["position" ]["y" ]
131
+ z_val = tree_data ["location_data" ]["position" ]["z" ]
132
+
133
+ self .broker .state .print_status ("get_xyz()" , description = f"Current coordinate: ({ x_val } , { y_val } , { z_val } )." )
134
+ return x_val , y_val , z_val
135
+
140
136
def check_position (self , user_x , user_y , user_z , tolerance ):
141
137
"""Verifies position of the FarmBot within specified tolerance range."""
142
138
0 commit comments