latest pushes

This commit is contained in:
Ronaldson Bellande 2024-11-21 14:28:02 -05:00
parent da9c405927
commit bc02f4fea6
16 changed files with 217 additions and 11 deletions

4
.gitignore vendored
View File

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

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

@ -0,0 +1,2 @@
python setup.py sdist
twine upload dist/*

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_step",
version="0.3.3",
description="Robots Step",
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_step': ['Bellande_Step'],
},
entry_points={
'console_scripts': [
'bellande_step_executable = bellande_step.bellande_step_executable:main',
'bellande_step_api = bellande_step.bellande_step_api:main',
],
},
project_urls={
"Home": "https://github.com/Robotics-Sensors/bellande_step",
"Homepage": "https://github.com/Robotics-Sensors/bellande_step",
"documentation": "https://github.com/Robotics-Sensors/bellande_step",
"repository": "https://github.com/Robotics-Sensors/bellande_step",
},
)

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

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

View File

Binary file not shown.

View File

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

View File

@ -0,0 +1,78 @@
# 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_bellande_step_request(node0, node1, limit, dimensions):
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd"
# 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)
payload = {
"node0": node0,
"node1": node1,
"limit": limit,
"dimensions": dimensions,
"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 Step API")
parser.add_argument("--node0", required=True, help="First coordinate as JSON-formatted list")
parser.add_argument("--node1", required=True, help="Second coordinate as JSON-formatted list")
parser.add_argument("--limit", type=int, required=True, help="Limit for the algorithm")
parser.add_argument("--dimensions", type=int, required=True, help="Number of dimensions")
args = parser.parse_args()
try:
result = make_bellande_step_request(
args.node0,
args.node1,
args.limit,
args.dimensions
)
print(json.dumps(result, indent=2))
except json.JSONDecodeError as e:
print(f"Error: Invalid JSON format in coordinates - {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,79 @@
# 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_Step')
def run_bellande_step(node0, node1, limit, dimensions):
executable_path = get_executable_path()
passcode = "bellande_step_executable_access_key"
# Convert string representations of coordinates to actual lists
node0_list = json.loads(node0)
node1_list = json.loads(node1)
# Validate input
if len(node1_list) != dimensions or len(node0_list) != dimensions:
raise ValueError(f"Coordinates must have {dimensions} dimensions")
# Prepare the command
command = [
executable_path,
passcode,
json.dumps(node0_list),
json.dumps(node1_list),
str(limit),
str(dimensions)
]
# 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 Step Executable")
parser.add_argument("--node0", help="First coordinate as a JSON-formatted list")
parser.add_argument("--node1", 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.node0,
args.node1,
args.limit,
args.dimensions
)
if __name__ == "__main__":
main()

View File

@ -186,7 +186,7 @@ You want to compute the next step from `node0` towards `node1` while limiting th
```python
# Define Import
from bellande_step.bellande_step_2d import bellande_step_2d, Node2D
from bellande_step.bellande_step_2d import bellande_step_2d
# Define the nodes
node0 = Node2D(0, 0)
@ -209,7 +209,7 @@ You want to compute the next step from `node0` towards `node1` while limiting th
```python
# Define Import
from bellande_step.bellande_step_3d import bellande_step_3d, Node3D
from bellande_step.bellande_step_3d import bellande_step_3d
# Define the nodes
node0 = Node3D(0, 0, 0)

View File

@ -16,6 +16,6 @@
url: https://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@ -16,6 +16,6 @@
url: tcp://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@ -16,6 +16,6 @@
url: tls://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

3
git_scripts/.gitignore vendored Normal file
View File

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

View File

@ -1,5 +1,5 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{

View File

@ -1,5 +1,5 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{