Skip to content
Snippets Groups Projects
Commit 38deac06 authored by gawen.ackerman's avatar gawen.ackerman :robot:
Browse files

UPDATE FIX : Coordinates system of the UDP sender after a test of the physical...

UPDATE FIX : Coordinates system of the UDP sender after a test of the physical device whose bound are between 15 and 65
parent 3f6f724b
No related branches found
No related tags found
No related merge requests found
......@@ -100,17 +100,17 @@ public class PositionManager : MonoBehaviour
float min = coordinates_inputRange[0];
float max = coordinates_inputRange[1];
//string a = "";
string a = "";
// Normalize the values between -1 and 1
for (int i = 0; i < coordinates.Length; i++)
{
if (coordinates[i] > max) coordinates_inputRange[1] = coordinates[i];
float minmaxNormalized_value = 2 * ((coordinates[i] - min) / (max - min)) - 1;
//a += $"[{i}] minmaxNormalized_value = 2 * (({coordinates[i]} - {min}) / ({max} - {min})) - 1 = {minmaxNormalized_value}\n";
a += $"[{i}] minmaxNormalized_value = 2 * (({coordinates[i]} - {min}) / ({max} - {min})) - 1 = {minmaxNormalized_value}\n";
coordinates[i] = minmaxNormalized_value * coordinates_sensibility;
}
//print(a);
print(a);
}
//public void NormalizeValues()
......
......@@ -25,18 +25,18 @@ def update_position():
global mouse_x, mouse_y, y_theta, is_tracking
x = scale_value(mouse_x - CENTER_CANVAS)
y = scale_value(mouse_y - CENTER_CANVAS)
y = scale_value(CENTER_CANVAS - mouse_y)
z = 0
x_theta = 0
z_theta = 0
if (is_tracking != True):
x = 0
y = 0
x = scale_value(0)
y = scale_value(0)
z = 0
data = aggregate_values_to_string(x, -y, z, x_theta, y_theta, z_theta)
data = aggregate_values_to_string(x, y, z, x_theta, y_theta, z_theta)
sock.sendto(data.encode(), (UDP_IP, UDP_PORT))
print("Sent:", data)
......@@ -72,10 +72,8 @@ def draw_center_and_arrows(canvas):
canvas.create_line(CENTER_CANVAS - ARROW_MARGIN, CENTER_CANVAS, CENTER_CANVAS - ARROW_LENGTH, CENTER_CANVAS, arrow=tk.LAST, width=2)
def disable_tracking(event):
global mouse_x, mouse_y, y_theta, is_tracking
global is_tracking
is_tracking = False
mouse_x = 0
mouse_y = 0
def enable_tracking(event):
global is_tracking
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment