This commit is contained in:
Ronaldson Bellande 2024-10-05 18:48:45 -04:00
parent d9255f76c5
commit 9e6825f1d2
26 changed files with 575 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
publish.sh publish.sh
src
tests tests
setup.py setup.py
dist dist

1
src/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bellande_step.egg-info

0
src/__init__.py Normal file
View File

Binary file not shown.

BIN
src/bellande_step/Bellande_Step Executable file

Binary file not shown.

View File

@ -0,0 +1,3 @@
"""
ros_extension
"""

Binary file not shown.

View File

@ -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()

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)