latest pushes

This commit is contained in:
Ronaldson Bellande 2024-11-24 02:07:01 -05:00
parent 4fc302064f
commit 5423c8bcd9
19 changed files with 566 additions and 4 deletions

17
LICENSE Normal file
View File

@ -0,0 +1,17 @@
Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
This is a human-readable summary of (and not a substitute for) the license. See the full license text for more details.

1
Package/python/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist

4
Package/python/publish.sh Executable file
View File

@ -0,0 +1,4 @@
cp ../../README.md ./
python setup.py sdist
twine upload dist/*
rm -r ./README.md

44
Package/python/setup.py Normal file
View File

@ -0,0 +1,44 @@
from setuptools import setup, find_packages
with open("./README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="bellande_limit",
version="0.1.2",
description="Robots Limit",
long_description=long_description,
long_description_content_type="text/markdown",
author="RonaldsonBellande",
author_email="ronaldsonbellande@gmail.com",
packages=find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True,
install_requires=[
"numpy",
],
classifiers=[
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
],
keywords=["package", "setuptools"],
python_requires=">=3.0",
extras_require={
"dev": ["pytest", "pytest-cov[all]", "mypy", "black"],
},
package_data={
'bellande_limit': ['Bellande_Limit'],
},
entry_points={
'console_scripts': [
'bellande_limit_executable = bellande_limit.bellande_limit_executable:main',
'bellande_limit_api = bellande_limit.bellande_limit_api:main',
],
},
project_urls={
"Home": "https://github.com/Robotics-Sensors/bellande_limit",
"Homepage": "https://github.com/Robotics-Sensors/bellande_limit",
"documentation": "https://github.com/Robotics-Sensors/bellande_limit",
"repository": "https://github.com/Robotics-Sensors/bellande_limit",
},
)

1
Package/python/src/.gitignore vendored Normal file
View File

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

View File

View File

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

View File

@ -0,0 +1,96 @@
# 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 <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
import requests
import argparse
import json
import sys
def make_node_importance_request(node, nodes, important_nodes, adjacent_segments, grid_steps, min_segment_coverage=0.5):
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Node_Importance/node_importance"
# Convert string inputs to Python objects if they're strings
if isinstance(node, str):
node = json.loads(node)
if isinstance(nodes, str):
nodes = json.loads(nodes)
if isinstance(important_nodes, str):
important_nodes = json.loads(important_nodes)
if isinstance(adjacent_segments, str):
adjacent_segments = json.loads(adjacent_segments)
if isinstance(grid_steps, str):
grid_steps = json.loads(grid_steps)
payload = {
"node": node,
"nodes": nodes,
"important_nodes": important_nodes,
"adjacent_segments": adjacent_segments,
"grid_steps": grid_steps,
"min_segment_coverage": min_segment_coverage,
"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 Node Importance API")
parser.add_argument("--node", required=True,
help="Node to evaluate as JSON object with 'coords' and 'segment'")
parser.add_argument("--nodes", required=True,
help="List of recent nodes as JSON array of objects with 'coords' and 'segment'")
parser.add_argument("--important-nodes", required=True,
help="Dictionary of important nodes by segment as JSON object")
parser.add_argument("--adjacent-segments", required=True,
help="Dictionary of adjacent segments as JSON object")
parser.add_argument("--grid-steps", required=True,
help="Grid step sizes for each dimension as JSON array")
parser.add_argument("--min-segment-coverage", type=float, default=0.5,
help="Minimum required segment coverage ratio")
args = parser.parse_args()
try:
result = make_node_importance_request(
args.node,
args.nodes,
args.important_nodes,
args.adjacent_segments,
args.grid_steps,
args.min_segment_coverage
)
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()

View File

@ -0,0 +1,104 @@
# 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 <https://www.gnu.org/licenses/>.
#!/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_Node_Importance')
def run_node_importance(node, nodes, important_nodes, adjacent_segments, grid_steps, min_segment_coverage=0.5):
executable_path = get_executable_path()
passcode = "bellande_node_importance_executable_access_key"
# Convert string representations to actual objects
node_obj = json.loads(node)
nodes_list = json.loads(nodes)
important_nodes_dict = json.loads(important_nodes)
adjacent_segments_dict = json.loads(adjacent_segments)
grid_steps_list = json.loads(grid_steps)
# Validate input dimensions
dimensions = len(node_obj['coords'])
if not all(len(n['coords']) == dimensions for n in nodes_list):
raise ValueError(f"All nodes must have {dimensions} dimensions")
# Validate important nodes dimensions
for segment_nodes in important_nodes_dict.values():
if not all(len(n['coords']) == dimensions for n in segment_nodes):
raise ValueError(f"All important nodes must have {dimensions} dimensions")
# Validate grid steps
if len(grid_steps_list) != dimensions:
raise ValueError(f"Grid steps must have {dimensions} dimensions")
# Prepare the command
command = [
executable_path,
passcode,
json.dumps(node_obj),
json.dumps(nodes_list),
json.dumps(important_nodes_dict),
json.dumps(adjacent_segments_dict),
json.dumps(grid_steps_list),
str(min_segment_coverage)
]
# 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 Node Importance Executable")
parser.add_argument("--node", required=True,
help="Node to evaluate as JSON object with 'coords' and 'segment'")
parser.add_argument("--nodes", required=True,
help="List of recent nodes as JSON array of objects with 'coords' and 'segment'")
parser.add_argument("--important-nodes", required=True,
help="Dictionary of important nodes by segment as JSON object")
parser.add_argument("--adjacent-segments", required=True,
help="Dictionary of adjacent segments as JSON object")
parser.add_argument("--grid-steps", required=True,
help="Grid step sizes for each dimension as JSON array")
parser.add_argument("--min-segment-coverage", type=float, default=0.5,
help="Minimum required segment coverage ratio")
args = parser.parse_args()
run_node_importance(
args.node,
args.nodes,
args.important_nodes,
args.adjacent_segments,
args.grid_steps,
args.min_segment_coverage
)
if __name__ == "__main__":
main()

109
README.md
View File

@ -9,8 +9,8 @@
# Author, Creator and Maintainer # Author, Creator and Maintainer
- **Ronaldson Bellande** - **Ronaldson Bellande**
## Bellande Limit Executables & Models ## Bellande Node Importance Executables & Models
- [![Bellande Limit Models & Executables ](https://img.shields.io/badge/Bellande%20Node%20Importance-Models/Executables-0099cc?style=for-the-badge)](https://github.com/Artificial-Intelligence-Computer-Vision/bellande_node_importance_models_executables) - [![Bellande Node Importance Models & Executables ](https://img.shields.io/badge/Bellande%20Node%20Importance-Models/Executables-0099cc?style=for-the-badge)](https://github.com/Artificial-Intelligence-Computer-Vision/bellande_node_importance_models_executables)
# API HTTP Usability (BELLANDE FORMAT) # API HTTP Usability (BELLANDE FORMAT)
``` ```
@ -32,7 +32,7 @@
url: https://bellande-robotics-sensors-research-innovation-center.org url: https://bellande-robotics-sensors-research-innovation-center.org
endpoint_path: endpoint_path:
bellande_limit: /api/Bellande_Limit/bellande_node_importance bellande_node_importance: /api/Bellande_Node_Importance/node_importance
Bellande_Framework_Access_Key: bellande_web_api_opensource Bellande_Framework_Access_Key: bellande_web_api_opensource
``` ```
@ -58,8 +58,109 @@ Bellande_Framework_Access_Key: bellande_web_api_opensource
], ],
"url": "https://bellande-robotics-sensors-research-innovation-center.org", "url": "https://bellande-robotics-sensors-research-innovation-center.org",
"endpoint_path": { "endpoint_path": {
"bellande_limit": "/api/Bellande_Limit/bellande_node_importance" "bellande_node_importance": "/api/Bellande_Node_Importance/node_importance"
}, },
"Bellande_Framework_Access_Key": "bellande_web_api_opensource" "Bellande_Framework_Access_Key": "bellande_web_api_opensource"
} }
``` ```
# API Payload Example
```
{
"node": {
"coords": [5.0, 5.0, 5.0],
"segment": 1
},
"nodes": [
{"coords": [4.0, 4.0, 4.0], "segment": 1},
{"coords": [6.0, 6.0, 6.0], "segment": 1}
],
"important_nodes": {
"1": [{"coords": [4.0, 4.0, 4.0], "segment": 1}],
"2": [{"coords": [15.0, 15.0, 15.0], "segment": 2}]
},
"adjacent_segments": {
"1": [2],
"2": [1]
},
"grid_steps": [10.0, 10.0, 10.0],
"min_segment_coverage": 0.5,
"auth": {
"authorization_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://bellande-robotics-sensors-research-innovation-center.org/api/bellande_node_importance_experiment)
# Quick Bellande API Testing
```
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Node_Importance/node_importance' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"node": {
"coords": [5.0, 5.0, 5.0],
"segment": 1
},
"nodes": [
{"coords": [4.0, 4.0, 4.0], "segment": 1},
{"coords": [6.0, 6.0, 6.0], "segment": 1}
],
"important_nodes": {
"1": [{"coords": [4.0, 4.0, 4.0], "segment": 1}],
"2": [{"coords": [15.0, 15.0, 15.0], "segment": 2}]
},
"adjacent_segments": {
"1": [2],
"2": [1]
},
"grid_steps": [10.0, 10.0, 10.0],
"min_segment_coverage": 0.5,
"auth": {
"authorization_key": "bellande_web_api_opensource"
}
}'
```
## Website PYPI
- https://pypi.org/project/bellande_node_importance
### Installation
- `$ pip install bellande_node_importance`
### Usage
```
bellande_node_importance_api \
--node '{"coords": [5.0, 5.0, 5.0], "segment": 1}' \
--nodes '[{"coords": [4.0, 4.0, 4.0], "segment": 1}, {"coords": [6.0, 6.0, 6.0], "segment": 1}]' \
--important-nodes '{"1": [{"coords": [4.0, 4.0, 4.0], "segment": 1}], "2": [{"coords": [15.0, 15.0, 15.0], "segment": 2}]}' \
--adjacent-segments '{"1": [2], "2": [1]}' \
--grid-steps '[10.0, 10.0, 10.0]' \
--min-segment-coverage 0.5
```
### Upgrade (if not upgraded)
- `$ pip install --upgrade bellande_node_importance`
```
Name: bellande_node_importance
Summary: Determines node importance in n-dimensional space based on coverage and connectivity
Home-page: github.com/RonaldsonBellande/bellande_node_importance
Author: Ronaldson Bellande
Author-email: ronaldsonbellande@gmail.com
License: GNU General Public License v3.0
```
## Published Paper
```
Coming Soon
```
## Preprint
- [![Preprint](https://img.shields.io/badge/Preprint-Bellande%20Node%20Importance-0099cc?style=for-the-badge)](https://dapp.orvium.io/deposits/6650ccb8afb407dc8beb0ff2/view)
## License
This Algorithm or Models is distributed under the [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/), see [LICENSE](https://github.com/RonaldsonBellande/bellande_node_importance/blob/main/LICENSE) and [NOTICE](https://github.com/RonaldsonBellande/bellande_node_importance/blob/main/LICENSE) for more information.

View File

@ -0,0 +1,21 @@
# 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 <https://www.gnu.org/licenses/>.
# GNU General Public License v3.0 or later
url: https://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_limit: /api/Bellande_Limit/bellande_limit
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@ -0,0 +1,21 @@
# 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 <https://www.gnu.org/licenses/>.
# GNU General Public License v3.0 or later
url: tcp://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_limit: /api/Bellande_Limit/bellande_limit
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@ -0,0 +1,21 @@
# 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 <https://www.gnu.org/licenses/>.
# GNU General Public License v3.0 or later
url: tls://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_limit: /api/Bellande_Limit/bellande_limit
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@ -0,0 +1,23 @@
{
"license": [
"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 <https://www.gnu.org/licenses/>.",
"GNU General Public License v3.0 or later"
],
"url": "https://bellande-robotics-sensors-research-innovation-center.org",
"endpoint_path": {
"bellande_limit": "/api/Bellande_Limit/bellande_limit"
},
"Bellande_Framework_Access_Key": "bellande_web_api_opensource"
}

View File

@ -0,0 +1,23 @@
{
"license": [
"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 <https://www.gnu.org/licenses/>.",
"GNU General Public License v3.0 or later"
],
"url": "tcp://bellande-robotics-sensors-research-innovation-center.org",
"endpoint_path": {
"bellande_limit": "/tcp/Bellande_Limit/bellande_limit"
},
"Bellande_Framework_Access_Key": "bellande_tcp_api_opensource"
}

View File

@ -0,0 +1,23 @@
{
"license": [
"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 <https://www.gnu.org/licenses/>.",
"GNU General Public License v3.0 or later"
],
"url": "tls://bellande-robotics-sensors-research-innovation-center.org",
"endpoint_path": {
"bellande_limit": "/tls/Bellande_Limit/bellande_limit"
},
"Bellande_Framework_Access_Key": "bellande_tls_api_opensource"
}

3
git_scripts/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
fix_errors.sh
push.sh
repository_recal.sh

28
run_api.bellos Executable file
View File

@ -0,0 +1,28 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Node_Importance/node_importance' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"node": {
"coords": [5.0, 5.0, 5.0],
"segment": 1
},
"nodes": [
{"coords": [4.0, 4.0, 4.0], "segment": 1},
{"coords": [6.0, 6.0, 6.0], "segment": 1}
],
"important_nodes": {
"1": [{"coords": [4.0, 4.0, 4.0], "segment": 1}],
"2": [{"coords": [15.0, 15.0, 15.0], "segment": 2}]
},
"adjacent_segments": {
"1": [2],
"2": [1]
},
"grid_steps": [10.0, 10.0, 10.0],
"min_segment_coverage": 0.5,
"auth": {
"authorization_key": "bellande_web_api_opensource"
}
}'
echo ""

28
run_api.sh Executable file
View File

@ -0,0 +1,28 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Node_Importance/node_importance' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"node": {
"coords": [5.0, 5.0, 5.0],
"segment": 1
},
"nodes": [
{"coords": [4.0, 4.0, 4.0], "segment": 1},
{"coords": [6.0, 6.0, 6.0], "segment": 1}
],
"important_nodes": {
"1": [{"coords": [4.0, 4.0, 4.0], "segment": 1}],
"2": [{"coords": [15.0, 15.0, 15.0], "segment": 2}]
},
"adjacent_segments": {
"1": [2],
"2": [1]
},
"grid_steps": [10.0, 10.0, 10.0],
"min_segment_coverage": 0.5,
"auth": {
"authorization_key": "bellande_web_api_opensource"
}
}'
echo ""