3D
This commit is contained in:
		| @@ -39,13 +39,22 @@ if($ENV{ROS_VERSION} EQUAL 1) | ||||
|   ) | ||||
| endif() | ||||
|  | ||||
| # Install Python scripts for both ROS 1 | ||||
| if($ENV{ROS_VERSION} EQUAL 1) | ||||
|   catkin_install_python( | ||||
|     PROGRAMS | ||||
|     src/bellande_3d_computer_vision_prediction.py | ||||
|     DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||||
|   ) | ||||
| endif() | ||||
|  | ||||
| # Install Python scripts, configuration files, and launch files | ||||
| if($ENV{ROS_VERSION} EQUAL "1") | ||||
|     install(PROGRAMS src/bellande_3d_computer_vision_api_2d.py DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) | ||||
|     install(PROGRAMS src/bellande_3d_computer_vision_prediction.py DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) | ||||
|     install(DIRECTORY config/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config) | ||||
|     install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch) | ||||
| elseif($ENV{ROS_VERSION} EQUAL "2") | ||||
|     install(PROGRAMS src/bellande_3d_computer_vision_api_2d.py DESTINATION lib/${PROJECT_NAME}) | ||||
|     install(PROGRAMS src/bellande_3d_computer_vision_prediction.py DESTINATION lib/${PROJECT_NAME}) | ||||
|     install(DIRECTORY config/ DESTINATION share/${PROJECT_NAME}/config) | ||||
|     install(DIRECTORY launch/ DESTINATION share/${PROJECT_NAME}/launch) | ||||
| endif() | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| # Bellande Search Path Web ROS/ROS2 API Intergration | ||||
| # Bellande 3D Computer Vision Web ROS/ROS2 API Intergration | ||||
|  | ||||
| [Bellande Search Path](https://github.com/RonaldsonBellande/bellande_robots_step) | ||||
| [Bellande 3D Computer Vision](https://github.com/RonaldsonBellande/bellande_3d_computer_vision) | ||||
|   | ||||
| @@ -5,5 +5,6 @@ | ||||
|     "object_detection": "/api/Bellande_3D_Computer_Vision/bellande_object_detection", | ||||
|     "instance_segmentation": "/api/Bellande_3D_Computer_Vision/bellande_instance_segmentation", | ||||
|     "sementic_segmentation": "/api/Bellande_3D_Computer_Vision/bellande_sementic_segmentation" | ||||
|   } | ||||
|   }, | ||||
|   "Bellande_Framework_Access_Key": "bellande_web_api_opensource" | ||||
| } | ||||
|   | ||||
| @@ -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_3d_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) | ||||
| @@ -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_3d_computer_vision_prediction" | ||||
|     type="bellande_3d_computer_vision_prediction.py" | ||||
|     name="bellande_3d_computer_vision_prediction_node" output="screen"> | ||||
|   </node> | ||||
| </launch> | ||||
							
								
								
									
										22
									
								
								ros_web_api_bellande_3d_computer_vision/script/build.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ros_web_api_bellande_3d_computer_vision/script/build.sh
									
									
									
									
									
										Normal 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 .. | ||||
							
								
								
									
										11
									
								
								ros_web_api_bellande_3d_computer_vision/setup.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								ros_web_api_bellande_3d_computer_vision/setup.py
									
									
									
									
									
										Executable 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_3d_computer_vision_prediction.py'], | ||||
|     packages=['ros_web_api_bellande_3d_computer_vision'], | ||||
|     package_dir={'': 'src'}, | ||||
| ) | ||||
|  | ||||
| setup(**setup_args) | ||||
| @@ -0,0 +1,29 @@ | ||||
| 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']["prediction"] | ||||
|      | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     ros_version = os.getenv("ROS_VERSION") | ||||
|     if ros_version == "1": | ||||
|         import rospy | ||||
|     elif ros_version == "2": | ||||
|         import rclpy | ||||
|  | ||||
|     main() | ||||
		Reference in New Issue
	
	Block a user