diff --git a/.gitignore b/.gitignore index 51c275c..3e54b1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ publish.sh -src tests setup.py dist diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..3bd3f0d --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +bellande_step.egg-info diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/__pycache__/__init__.cpython-38.pyc b/src/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..f6585b9 Binary files /dev/null and b/src/__pycache__/__init__.cpython-38.pyc differ diff --git a/src/bellande_step/Bellande_Step b/src/bellande_step/Bellande_Step new file mode 100755 index 0000000..5f4247f Binary files /dev/null and b/src/bellande_step/Bellande_Step differ diff --git a/src/bellande_step/__init__.py b/src/bellande_step/__init__.py new file mode 100644 index 0000000..14b2a3f --- /dev/null +++ b/src/bellande_step/__init__.py @@ -0,0 +1,3 @@ +""" +ros_extension +""" diff --git a/src/bellande_step/__pycache__/__init__.cpython-38.pyc b/src/bellande_step/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..993ef27 Binary files /dev/null and b/src/bellande_step/__pycache__/__init__.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_10d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_10d.cpython-38.pyc new file mode 100644 index 0000000..db5dd8c Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_10d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_2d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_2d.cpython-38.pyc new file mode 100644 index 0000000..a31bb5f Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_2d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_3d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_3d.cpython-38.pyc new file mode 100644 index 0000000..cc7f65b Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_3d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_4d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_4d.cpython-38.pyc new file mode 100644 index 0000000..5a2fd50 Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_4d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_5d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_5d.cpython-38.pyc new file mode 100644 index 0000000..2f9e833 Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_5d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_6d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_6d.cpython-38.pyc new file mode 100644 index 0000000..0086a6e Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_6d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_7d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_7d.cpython-38.pyc new file mode 100644 index 0000000..5aae57e Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_7d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_8d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_8d.cpython-38.pyc new file mode 100644 index 0000000..03446be Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_8d.cpython-38.pyc differ diff --git a/src/bellande_step/__pycache__/bellande_robot_step_9d.cpython-38.pyc b/src/bellande_step/__pycache__/bellande_robot_step_9d.cpython-38.pyc new file mode 100644 index 0000000..824a6d7 Binary files /dev/null and b/src/bellande_step/__pycache__/bellande_robot_step_9d.cpython-38.pyc differ diff --git a/src/bellande_step/bellande_step.py b/src/bellande_step/bellande_step.py new file mode 100644 index 0000000..2f428fa --- /dev/null +++ b/src/bellande_step/bellande_step.py @@ -0,0 +1,62 @@ +import subprocess +import argparse +import json +import os +import sys + +def get_executable_path(): + if getattr(sys, 'frozen', False): + application_path = sys._MEIPASS + else: + application_path = os.path.dirname(os.path.abspath(__file__)) + + return os.path.join(application_path, 'Bellande_Step') + +def run_bellande_step(coord1, coord2, limit, dimensions): + executable_path = get_executable_path() + passcode = "bellande_step_executable_access_key" + + # Convert string representations of coordinates to actual lists + coord1_list = json.loads(coord1) + coord2_list = json.loads(coord2) + + # Validate input + if len(coord1_list) != dimensions or len(coord2_list) != dimensions: + raise ValueError(f"Coordinates must have {dimensions} dimensions") + + # Prepare the command + command = [ + executable_path, + passcode, + json.dumps(coord1_list), + json.dumps(coord2_list), + str(limit), + str(dimensions) + ] + + # Run the command + try: + result = subprocess.run(command, check=True, capture_output=True, text=True) + print("Output:", result.stdout) + except subprocess.CalledProcessError as e: + print("Error occurred:", e) + print("Error output:", e.stderr) + +def main(): + parser = argparse.ArgumentParser(description="Run Bellande Step executable") + parser.add_argument("coord1", help="First coordinate as a JSON-formatted list") + parser.add_argument("coord2", help="Second coordinate as a JSON-formatted list") + parser.add_argument("limit", type=int, help="Limit for the algorithm") + parser.add_argument("dimensions", type=int, help="Number of dimensions") + + args = parser.parse_args() + + run_bellande_step( + args.coord1, + args.coord2, + args.limit, + args.dimensions + ) + +if __name__ == "__main__": + main() diff --git a/src/bellande_step/bellande_step_10d.py b/src/bellande_step/bellande_step_10d.py new file mode 100644 index 0000000..c9ffda1 --- /dev/null +++ b/src/bellande_step/bellande_step_10d.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node10D: + def __init__(self, x, y, z, w, v, u, t, s, r, l, parent=None): + self.coord = (x, y, z, w, v, u, t, s, r, l) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + @property + def u(self): + return self.coord[5] + + @property + def t(self): + return self.coord[6] + + @property + def s(self): + return self.coord[7] + + @property + def r(self): + return self.coord[8] + + @property + def l(self): + return self.coord[9] + + + + +def bellande_step_10d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + delta_u = node1.u - node0.u + delta_t = node1.t - node0.t + delta_s = node1.s - node0.s + delta_r = node1.r - node0.r + delta_l = node1.l - node0.l + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2 + delta_r ** 2 + delta_l ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + step_u = node0.u + delta_u * ratio + step_t = node0.t + delta_t * ratio + step_s = node0.s + delta_s * ratio + step_r = node0.r + delta_r * ratio + step_l = node0.l + delta_l * ratio + + return Node10D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s, step_r, step_l) diff --git a/src/bellande_step/bellande_step_2d.py b/src/bellande_step/bellande_step_2d.py new file mode 100644 index 0000000..2a40cc5 --- /dev/null +++ b/src/bellande_step/bellande_step_2d.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node2D: + def __init__(self, x, y, parent=None): + self.coord = (x, y) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + +def bellande_step_2d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + dist = np.sqrt(delta_x ** 2 + delta_y ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + + return Node2D(step_x, step_y) diff --git a/src/bellande_step/bellande_step_3d.py b/src/bellande_step/bellande_step_3d.py new file mode 100644 index 0000000..859dd30 --- /dev/null +++ b/src/bellande_step/bellande_step_3d.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node3D: + def __init__(self, x, y, z, parent=None): + self.coord = (x, y, z) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + + +def bellande_step_3d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + + return Node3D(step_x, step_y, step_z) diff --git a/src/bellande_step/bellande_step_4d.py b/src/bellande_step/bellande_step_4d.py new file mode 100644 index 0000000..cee48b9 --- /dev/null +++ b/src/bellande_step/bellande_step_4d.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node4D: + def __init__(self, x, y, z, w, parent=None): + self.coord = (x, y, z, w) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + +def bellande_step_4d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + + return Node4D(step_x, step_y, step_z, step_w) diff --git a/src/bellande_step/bellande_step_5d.py b/src/bellande_step/bellande_step_5d.py new file mode 100644 index 0000000..f59f92a --- /dev/null +++ b/src/bellande_step/bellande_step_5d.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node5D: + def __init__(self, x, y, z, w, v, parent=None): + self.coord = (x, y, z, w, v) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + + +def bellande_step_5d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + + return Node5D(step_x, step_y, step_z, step_w, step_v) diff --git a/src/bellande_step/bellande_step_6d.py b/src/bellande_step/bellande_step_6d.py new file mode 100644 index 0000000..5c5f3fe --- /dev/null +++ b/src/bellande_step/bellande_step_6d.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node6D: + def __init__(self, x, y, z, w, v, u, parent=None): + self.coord = (x, y, z, w, v, u) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + @property + def u(self): + return self.coord[5] + + + +def bellande_step_6d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + delta_u = node1.u - node0.u + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + step_u = node0.u + delta_u * ratio + + return Node6D(step_x, step_y, step_z, step_w, step_v, step_u) diff --git a/src/bellande_step/bellande_step_7d.py b/src/bellande_step/bellande_step_7d.py new file mode 100644 index 0000000..52262d3 --- /dev/null +++ b/src/bellande_step/bellande_step_7d.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node7D: + def __init__(self, x, y, z, w, v, u, t, parent=None): + self.coord = (x, y, z, w, v, u, t) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + @property + def u(self): + return self.coord[5] + + @property + def t(self): + return self.coord[6] + + +def bellande_step_7d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + delta_u = node1.u - node0.u + delta_t = node1.t - node0.t + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + step_u = node0.u + delta_u * ratio + step_t = node0.t + delta_t * ratio + + return Node7D(step_x, step_y, step_z, step_w, step_v, step_u, step_t) diff --git a/src/bellande_step/bellande_step_8d.py b/src/bellande_step/bellande_step_8d.py new file mode 100644 index 0000000..d09065c --- /dev/null +++ b/src/bellande_step/bellande_step_8d.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node8D: + def __init__(self, x, y, z, w, v, u, t, s, parent=None): + self.coord = (x, y, z, w, v, u, t, s) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + @property + def u(self): + return self.coord[5] + + @property + def t(self): + return self.coord[6] + + @property + def s(self): + return self.coord[7] + + +def bellande_step_8d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + delta_u = node1.u - node0.u + delta_t = node1.t - node0.t + delta_s = node1.s - node0.s + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + step_u = node0.u + delta_u * ratio + step_t = node0.t + delta_t * ratio + step_s = node0.s + delta_s * ratio + + return Node8D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s) diff --git a/src/bellande_step/bellande_step_9d.py b/src/bellande_step/bellande_step_9d.py new file mode 100644 index 0000000..43fbbe6 --- /dev/null +++ b/src/bellande_step/bellande_step_9d.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 + +from header_imports import * + +class Node9D: + def __init__(self, x, y, z, w, v, u, t, s, r, parent=None): + self.coord = (x, y, z, w, v, u, t, s, r) + self.parent = parent + + @property + def x(self): + return self.coord[0] + + @property + def y(self): + return self.coord[1] + + @property + def z(self): + return self.coord[2] + + @property + def w(self): + return self.coord[3] + + @property + def v(self): + return self.coord[4] + + @property + def u(self): + return self.coord[5] + + @property + def t(self): + return self.coord[6] + + @property + def s(self): + return self.coord[7] + + @property + def r(self): + return self.coord[8] + + + +def bellande_step_9d(node0, node1, limit=75): + delta_x = node1.x - node0.x + delta_y = node1.y - node0.y + delta_z = node1.z - node0.z + delta_w = node1.w - node0.w + delta_v = node1.v - node0.v + delta_u = node1.u - node0.u + delta_t = node1.t - node0.t + delta_s = node1.s - node0.s + delta_r = node1.r - node0.r + + dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2 + delta_r ** 2) + + if dist < limit: + return node1 + + ratio = limit / dist + step_x = node0.x + delta_x * ratio + step_y = node0.y + delta_y * ratio + step_z = node0.z + delta_z * ratio + step_w = node0.w + delta_w * ratio + step_v = node0.v + delta_v * ratio + step_u = node0.u + delta_u * ratio + step_t = node0.t + delta_t * ratio + step_s = node0.s + delta_s * ratio + step_r = node0.r + delta_r * ratio + + return Node9D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s, step_r)