diff --git a/Package/python/src/bellande_limit/Bellande_Step b/Package/python/src/bellande_limit/Bellande_Step new file mode 100755 index 0000000..5f4247f Binary files /dev/null and b/Package/python/src/bellande_limit/Bellande_Step differ diff --git a/Package/python/src/bellande_limit/__init__.py b/Package/python/src/bellande_limit/__init__.py new file mode 100644 index 0000000..14b2a3f --- /dev/null +++ b/Package/python/src/bellande_limit/__init__.py @@ -0,0 +1,3 @@ +""" +ros_extension +""" diff --git a/Package/python/src/bellande_limit/bellande_limit_api.py b/Package/python/src/bellande_limit/bellande_limit_api.py new file mode 100644 index 0000000..f702751 --- /dev/null +++ b/Package/python/src/bellande_limit/bellande_limit_api.py @@ -0,0 +1,98 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +#!/usr/bin/env python3 + +import requests +import argparse +import json +import sys + +def make_bellande_limit_request(node0, node1, environment, size, goal, obstacles=None, search_radius=50, sample_points=20): + url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Limit/bellande_limit" + + # Convert string inputs to lists if they're strings + if isinstance(node0, str): + node0 = json.loads(node0) + if isinstance(node1, str): + node1 = json.loads(node1) + if isinstance(environment, str): + environment = json.loads(environment) + if isinstance(size, str): + size = json.loads(size) + if isinstance(goal, str): + goal = json.loads(goal) + if isinstance(obstacles, str): + obstacles = json.loads(obstacles) + + payload = { + "node0": node0, + "node1": node1, + "environment": environment, + "size": size, + "goal": goal, + "obstacles": obstacles or [], + "search_radius": search_radius, + "sample_points": sample_points, + "auth": { + "authorization_key": "bellande_web_api_opensource" + } + } + + headers = { + 'accept': 'application/json', + 'Content-Type': 'application/json' + } + + try: + response = requests.post(url, json=payload, headers=headers) + response.raise_for_status() + return response.json() + except requests.RequestException as e: + print(f"Error making request: {e}", file=sys.stderr) + sys.exit(1) + +def main(): + parser = argparse.ArgumentParser(description="Run Bellande Limit API") + parser.add_argument("--node0", required=True, help="Starting point coordinates as JSON-formatted list") + parser.add_argument("--node1", required=True, help="Target point coordinates as JSON-formatted list") + parser.add_argument("--environment", required=True, help="Environment dimensions as JSON-formatted list") + parser.add_argument("--size", required=True, help="Step sizes for each dimension as JSON-formatted list") + parser.add_argument("--goal", required=True, help="Goal coordinates as JSON-formatted list") + parser.add_argument("--obstacles", help="List of obstacles as JSON-formatted list of objects with 'position' and 'dimensions'") + parser.add_argument("--search-radius", type=float, default=50.0, help="Search radius for obstacle detection") + parser.add_argument("--sample-points", type=int, default=20, help="Number of sample points for obstacle detection") + + args = parser.parse_args() + + try: + result = make_bellande_limit_request( + args.node0, + args.node1, + args.environment, + args.size, + args.goal, + args.obstacles, + args.search_radius, + args.sample_points + ) + + print(json.dumps(result, indent=2)) + except json.JSONDecodeError as e: + print(f"Error: Invalid JSON format in input parameters - {e}", file=sys.stderr) + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/Package/python/src/bellande_limit/bellande_limit_executable.py b/Package/python/src/bellande_limit/bellande_limit_executable.py new file mode 100644 index 0000000..19c0d7d --- /dev/null +++ b/Package/python/src/bellande_limit/bellande_limit_executable.py @@ -0,0 +1,101 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +#!/usr/bin/env python3 + +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_Limit') + +def run_bellande_limit(node0, node1, environment, size, goal, obstacles=None, search_radius=50, sample_points=20): + executable_path = get_executable_path() + passcode = "bellande_limit_executable_access_key" + + # Convert string representations to actual lists/objects + node0_list = json.loads(node0) + node1_list = json.loads(node1) + environment_list = json.loads(environment) + size_list = json.loads(size) + goal_list = json.loads(goal) + obstacles_list = json.loads(obstacles) if obstacles else [] + + # Validate input dimensions + dimensions = len(environment_list) + if not all(len(x) == dimensions for x in [node0_list, node1_list, size_list, goal_list]): + raise ValueError(f"All coordinates must have {dimensions} dimensions") + + # Validate obstacles + for obstacle in obstacles_list: + if len(obstacle['position']) != dimensions or len(obstacle['dimensions']) != dimensions: + raise ValueError(f"Obstacle position and dimensions must have {dimensions} dimensions") + + # Prepare the command + command = [ + executable_path, + passcode, + json.dumps(node0_list), + json.dumps(node1_list), + json.dumps(environment_list), + json.dumps(size_list), + json.dumps(goal_list), + json.dumps(obstacles_list), + str(search_radius), + str(sample_points) + ] + + # Run the command + try: + result = subprocess.run(command, check=True, capture_output=True, text=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print("Error occurred:", e) + print("Error output:", e.stderr) + +def main(): + parser = argparse.ArgumentParser(description="Run Bellande Limit Executable") + parser.add_argument("--node0", required=True, help="Starting point coordinates as JSON-formatted list") + parser.add_argument("--node1", required=True, help="Target point coordinates as JSON-formatted list") + parser.add_argument("--environment", required=True, help="Environment dimensions as JSON-formatted list") + parser.add_argument("--size", required=True, help="Step sizes for each dimension as JSON-formatted list") + parser.add_argument("--goal", required=True, help="Goal coordinates as JSON-formatted list") + parser.add_argument("--obstacles", help="List of obstacles as JSON-formatted list of objects with 'position' and 'dimensions'") + parser.add_argument("--search-radius", type=float, default=50.0, help="Search radius for obstacle detection") + parser.add_argument("--sample-points", type=int, default=20, help="Number of sample points for obstacle detection") + + args = parser.parse_args() + + run_bellande_limit( + args.node0, + args.node1, + args.environment, + args.size, + args.goal, + args.obstacles, + args.search_radius, + args.sample_points + ) + +if __name__ == "__main__": + main() diff --git a/README.md b/README.md index 6cc1e15..a62c433 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,5 @@ # 📦 Bellande Limit -![Demo GIF](bellande_limit_api_package.gif) - -## Preprint -- [![Preprint](https://img.shields.io/badge/Preprint-Bellande%20Step-0099cc?style=for-the-badge)](https://dapp.orvium.io/deposits/6650ccb8afb407dc8beb0ff2/view) - -# Preprint Citation -``` -Bellande, R. (2024). Efficient Step Function for Infinite Multi-Dimensional Node Calculation within Model-Integrated Dimensional Space [version 1] [preprint]. Mathematics. -``` - - ## 🧙 Organization Website - [![Organization Website](https://img.shields.io/badge/Explore%20Our-Website-0099cc?style=for-the-badge)](https://robotics-sensors.github.io) @@ -21,7 +10,7 @@ Bellande, R. (2024). Efficient Step Function for Infinite Multi-Dimensional Node - **Ronaldson Bellande** ## Bellande Limit Executables & Models -- [![Bellande Limit Models & Executables ](https://img.shields.io/badge/Bellande%20Step-Models/Executables-0099cc?style=for-the-badge)](https://github.com/Artificial-Intelligence-Computer-Vision/bellande_step_models_executables) +- [![Bellande Limit Models & Executables ](https://img.shields.io/badge/Bellande%20Step-Models/Executables-0099cc?style=for-the-badge)](https://github.com/Artificial-Intelligence-Computer-Vision/bellande_limit_models_executables) # API HTTP Usability (BELLANDE FORMAT) ``` @@ -80,7 +69,15 @@ Bellande_Framework_Access_Key: bellande_web_api_opensource { "node0": [0, 0, 0], "node1": [100, 100, 100], + "environment": [1000, 1000, 1000], + "size": [10, 10, 10], "goal": [200, 200, 200], + "obstacles": [ + { + "position": [50, 50, 50], + "dimensions": [20, 20, 20] + } + ], "search_radius": 50, "sample_points": 20, "auth": { @@ -90,7 +87,7 @@ Bellande_Framework_Access_Key: bellande_web_api_opensource ``` # 🧙 Website Bellande API Testing -- [![Website API Testing](https://img.shields.io/badge/Bellande%20API-Testing-0099cc?style=for-the-badge)](https://bellanderoboticssensorsresearchinnovationcenterwebsite-kot42qxp.b4a.run/api/bellande_step_experiment) +- [![Website API Testing](https://img.shields.io/badge/Bellande%20API-Testing-0099cc?style=for-the-badge)](https://bellande-robotics-sensors-research-innovation-center.org/api/bellande_limit_experiment) # Quick Bellande API Testing ``` @@ -101,7 +98,15 @@ curl -X 'POST' \ -d '{ "node0": [0, 0, 0], "node1": [100, 100, 100], + "environment": [1000, 1000, 1000], + "size": [10, 10, 10], "goal": [100, 100, 100], + "obstacles": [ + { + "position": [50, 50, 50], + "dimensions": [20, 20, 20] + } + ], "search_radius": 50, "sample_points": 20, "auth": { @@ -110,132 +115,6 @@ curl -X 'POST' \ }' ``` -# BS(Bellande Step) Algorithm API -## Experiment 1 -- Limit = 1 - -| ![2D](graphs_charts/graph_charts_1/2D_Space.png) *Figure 2D* | ![3D](graphs_charts/graph_charts_1/3D_Space.png) *Figure 3D* | ![4D](graphs_charts/graph_charts_1/4D_Space.png) *Figure 4D* | -|:------------------------------------------------------------:|:------------------------------------------------------------:|:------------------------------------------------------------:| -| ![5D](graphs_charts/graph_charts_1/5D_Space.png) *Figure 5D* | ![6D](graphs_charts/graph_charts_1/6D_Space.png) *Figure 6D* | ![7D](graphs_charts/graph_charts_1/7D_Space.png) *Figure 7D* | -| ![8D](graphs_charts/graph_charts_1/8D_Space.png) *Figure 8D* | ![9D](graphs_charts/graph_charts_1/9D_Space.png) *Figure 9D* | ![10D](graphs_charts/graph_charts_1/10D_Space.png) *Figure 10D* | - - -## Experiment 2 -- Limit = 25 - -| ![2D](graphs_charts/graph_charts_25/2D_Space.png) *Figure 2D* | ![3D](graphs_charts/graph_charts_25/3D_Space.png) *Figure 3D* | ![4D](graphs_charts/graph_charts_25/4D_Space.png) *Figure 4D* | -|:-------------------------------------------------------------:|:-------------------------------------------------------------:|:-------------------------------------------------------------:| -| ![5D](graphs_charts/graph_charts_25/5D_Space.png) *Figure 5D* | ![6D](graphs_charts/graph_charts_25/6D_Space.png) *Figure 6D* | ![7D](graphs_charts/graph_charts_25/7D_Space.png) *Figure 7D* | -| ![8D](graphs_charts/graph_charts_25/8D_Space.png) *Figure 8D* | ![9D](graphs_charts/graph_charts_25/9D_Space.png) *Figure 9D* | ![10D](graphs_charts/graph_charts_25/10D_Space.png) *Figure 10D* | - - -## Experiment 3 -- Limit = 50 - -| ![2D](graphs_charts/graph_charts_50/2D_Space.png) *Figure 2D* | ![3D](graphs_charts/graph_charts_50/3D_Space.png) *Figure 3D* | ![4D](graphs_charts/graph_charts_50/4D_Space.png) *Figure 4D* | -|:-------------------------------------------------------------:|:-------------------------------------------------------------:|:-------------------------------------------------------------:| -| ![5D](graphs_charts/graph_charts_50/5D_Space.png) *Figure 5D* | ![6D](graphs_charts/graph_charts_50/6D_Space.png) *Figure 6D* | ![7D](graphs_charts/graph_charts_50/7D_Space.png) *Figure 7D* | -| ![8D](graphs_charts/graph_charts_50/8D_Space.png) *Figure 8D* | ![9D](graphs_charts/graph_charts_50/9D_Space.png) *Figure 9D* | ![10D](graphs_charts/graph_charts_50/10D_Space.png) *Figure 10D* | - - -## Experiment 4 -- Limit = 75 - -| ![2D](graphs_charts/graph_charts_75/2D_Space.png) *Figure 2D* | ![3D](graphs_charts/graph_charts_75/3D_Space.png) *Figure 3D* | ![4D](graphs_charts/graph_charts_75/4D_Space.png) *Figure 4D* | -|:-------------------------------------------------------------:|:-------------------------------------------------------------:|:-------------------------------------------------------------:| -| ![5D](graphs_charts/graph_charts_75/5D_Space.png) *Figure 5D* | ![6D](graphs_charts/graph_charts_75/6D_Space.png) *Figure 6D* | ![7D](graphs_charts/graph_charts_75/7D_Space.png) *Figure 7D* | -| ![8D](graphs_charts/graph_charts_75/8D_Space.png) *Figure 8D* | ![9D](graphs_charts/graph_charts_75/9D_Space.png) *Figure 9D* | ![10D](graphs_charts/graph_charts_75/10D_Space.png) *Figure 10D* | - - -## Experiment 5 -- Limit = 100 - -| ![2D](graphs_charts/graph_charts_100/2D_Space.png) *Figure 2D* | ![3D](graphs_charts/graph_charts_100/3D_Space.png) *Figure 3D* | ![4D](graphs_charts/graph_charts_100/4D_Space.png) *Figure 4D* | -|:--------------------------------------------------------------:|:--------------------------------------------------------------:|:--------------------------------------------------------------:| -| ![5D](graphs_charts/graph_charts_100/5D_Space.png) *Figure 5D* | ![6D](graphs_charts/graph_charts_100/6D_Space.png) *Figure 6D* | ![7D](graphs_charts/graph_charts_100/7D_Space.png) *Figure 7D* | -| ![8D](graphs_charts/graph_charts_100/8D_Space.png) *Figure 8D* | ![9D](graphs_charts/graph_charts_100/9D_Space.png) *Figure 9D* | ![10D](graphs_charts/graph_charts_100/10D_Space.png) *Figure 10D* | - - - -# Check Out Research Organization for open-source/semi-open-source API -- https://robotics-sensors.github.io -- Check out website for more information avaliable open-source API - -# Package via Executable -- Infinite Space - -``` -bellande_step "[0, 0, 0]" "[100, 100, 100]" 75 3 -``` -# API in api_docs -- 2D Space -- 3D Space -- 4D Space -- 5D Space -- 6D Space -- 7D Space -- 8D Space -- 9D Space -- 10D Space - - -# Can also checkout portion of the docs at [Portion API DOCS](https://github.com/Robotics-Sensors/bellande_robots_step/blob/main/api_docs.md) -### ✔️ confirmed versions -- `The step function efficiently computes the next step towards a target node within a specified distance limit.` - -## Usage 2D Space - -Suppose you have two nodes representing positions in a 2D space: -- `node0` at coordinates `(0, 0)` -- `node1` at coordinates `(5, 5)` - -You want to compute the next step from `node0` towards `node1` while limiting the maximum distance to 3 units. - -```python -# Define Import -from bellande_step.bellande_step_2d import bellande_step_2d - -# Define the nodes -node0 = Node2D(0, 0) -node1 = Node2D(5, 5) - -# Compute the next step within a distance limit of 3 units -next_step = bellande_step_2d(node0, node1, limit=3) - -# Output the coordinates of the next step -print("Next Step Coordinates:", next_step.coord) -``` - -## Usage 3D Space - -Suppose you have two nodes representing positions in a 3D space: -- `node0` at coordinates `(0, 0, 0)` -- `node1` at coordinates `(5, 5, 5)` - -You want to compute the next step from `node0` towards `node1` while limiting the maximum distance to 3 units. - -```python -# Define Import -from bellande_step.bellande_step_3d import bellande_step_3d - -# Define the nodes -node0 = Node3D(0, 0, 0) -node1 = Node3D(5, 5, 5) - -# Compute the next step within a distance limit of 3 units -next_step = bellande_step_3d(node0, node1, limit=3) - -# Output the coordinates of the next step -print("Next Step Coordinates:", next_step.coord) -``` - -### Avaliable -- 2D Space -- 3D Space -- 4D Space -- 5D Space -- 6D Space -- 7D Space -- 8D Space -- 9D Space -- 10D Space - - ## Website PYPI - https://pypi.org/project/bellande_limit @@ -247,9 +126,8 @@ print("Next Step Coordinates:", next_step.coord) ``` Name: bellande_limit -Version: 0.3.0 Summary: Computes the next step towards a target node -Home-page: github.com/RonaldsonBellande/bellande_robot_step +Home-page: github.com/RonaldsonBellande/bellande_limit Author: Ronaldson Bellande Author-email: ronaldsonbellande@gmail.com License: GNU General Public License v3.0 diff --git a/run_api.bellos b/run_api.bellos index 5533173..56669d0 100755 --- a/run_api.bellos +++ b/run_api.bellos @@ -5,12 +5,19 @@ curl -X 'POST' \ -d '{ "node0": [0, 0, 0], "node1": [100, 100, 100], + "environment": [1000, 1000, 1000], + "size": [10, 10, 10], "goal": [200, 200, 200], + "obstacles": [ + { + "position": [50, 50, 50], + "dimensions": [20, 20, 20] + } + ], "search_radius": 50, "sample_points": 20, "auth": { "authorization_key": "bellande_web_api_opensource" } }' - echo "" diff --git a/run_api.sh b/run_api.sh index 5533173..56669d0 100755 --- a/run_api.sh +++ b/run_api.sh @@ -5,12 +5,19 @@ curl -X 'POST' \ -d '{ "node0": [0, 0, 0], "node1": [100, 100, 100], + "environment": [1000, 1000, 1000], + "size": [10, 10, 10], "goal": [200, 200, 200], + "obstacles": [ + { + "position": [50, 50, 50], + "dimensions": [20, 20, 20] + } + ], "search_radius": 50, "sample_points": 20, "auth": { "authorization_key": "bellande_web_api_opensource" } }' - echo ""