computer_vision

This commit is contained in:
Ronaldson Bellande 2024-06-06 03:12:17 -04:00
parent 7c1509e14f
commit 90fd66c2a2
7 changed files with 117 additions and 2 deletions

View File

@ -6,5 +6,5 @@
"instance_segmentation": "/api/Bellande_2D_Computer_Vision/bellande_instance_segmentation",
"sementic_segmentation": "/api/Bellande_2D_Computer_Vision/bellande_sementic_segmentation"
},
"access_key": "bellande_web_api_opensource"
"Bellande_Framework_Access_Key": "bellande_web_api_opensource"
}

View File

@ -0,0 +1,32 @@
import os
import sys
import subprocess
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
def ros1_launch_description():
# Get command-line arguments
args = sys.argv[1:]
# Construct the ROS 1 launch commandi
roslaunch_command = ["roslaunch", "bellande_2d_computer_vision_prediction", "bellande_step_api_2d.launch"] + args
# Execute the launch command
subprocess.call(roslaunch_command)
def ros2_launch_description():
pass
if __name__ == "__main__":
ros_version = os.getenv("ROS_VERSION")
if ros_version == "1":
ros1_launch_description()
elif ros_version == "2":
ros2_launch_description()
else:
print("Unsupported ROS version. Please set the ROS_VERSION environment variable to '1' for ROS 1 or '2' for ROS 2.")
sys.exit(1)

View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<launch>
<node pkg="bellande_2d_computer_vision_prediction"
type="bellande_2d_computer_vision_prediction.py"
name="bellande_2d_computer_vision_prediction_node" output="screen">
</node>
</launch>

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Create and navigate to build directory
mkdir -p build && cd build
# Build package
if [ $ROS_VERSION -eq 1 ]; then
cmake -DROS_VERSION=1 ..
make -j$(nproc)
else
cmake -DROS_VERSION=2 ..
make -j$(nproc)
fi
# Source package setup file
source devel/setup.bash
# Run rosdep
rosdep install --from-paths ../src --ignore-src -y
# Return to package root directory
cd ..

View File

@ -0,0 +1,11 @@
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
scripts=['src/bellande_2d_computer_vision_prediction.py'],
packages=['ros_web_api_bellande_2d_computer_vision'],
package_dir={'': 'src'},
)
setup(**setup_args)

View File

@ -0,0 +1,28 @@
import json
import os
import requests
def main():
# Get the absolute path to the config file
config_file_path = os.path.join(os.path.dirname(__file__), '../config/configs.json')
# Check if the config file exists
if not os.path.exists(config_file_path):
print("Config file not found:", config_file_path)
return
# Read configuration from config.json
with open(config_file_path, 'r') as config_file:
config = json.load(config_file)
url = config['url']
endpoint_path = config['endpoint_path']["2d"]
if __name__ == '__main__':
ros_version = os.getenv("ROS_VERSION")
if ros_version == "1":
import rospy
elif ros_version == "2":
import rclpy
main()

View File

@ -11,5 +11,5 @@
"9d": "/api/Bellande_Step/bellande_step_9d",
"10d": "/api/Bellande_Step/bellande_step_10d"
},
"access_key": "bellande_web_api_opensource"
"Bellande_Framework_Access_Key": "bellande_web_api_opensource"
}