From d965446abfa310e04dbac530a17ee3d5bbca14f2 Mon Sep 17 00:00:00 2001 From: RonaldsonBellande Date: Sat, 29 Jun 2024 23:35:31 -0400 Subject: [PATCH] cv --- ...de_3d_computer_vision_prediction.launch.py | 74 +++++++++++++++++-- .../script/build.sh | 22 ------ 2 files changed, 68 insertions(+), 28 deletions(-) delete mode 100644 ros_web_api_bellande_3d_computer_vision/script/build.sh diff --git a/ros_web_api_bellande_3d_computer_vision/launch/bellande_3d_computer_vision_prediction.launch.py b/ros_web_api_bellande_3d_computer_vision/launch/bellande_3d_computer_vision_prediction.launch.py index 765428c..922711f 100644 --- a/ros_web_api_bellande_3d_computer_vision/launch/bellande_3d_computer_vision_prediction.launch.py +++ b/ros_web_api_bellande_3d_computer_vision/launch/bellande_3d_computer_vision_prediction.launch.py @@ -1,25 +1,87 @@ +# 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 . + 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 +from launch.substitutions import FindExecutable def ros1_launch_description(): # Get command-line arguments args = sys.argv[1:] - - # Construct the ROS 1 launch commandi + + # Construct the ROS 1 launch command roslaunch_command = ["roslaunch", "ros_web_api_bellande_3d_computer_vision", "bellande_3d_computer_vision_prediction.launch"] + args - + + # Add the pointcloud publisher node + roslaunch_command.extend([ + "ros_web_api_bellande_3d_computer_vision", "pointcloud_pradiction_node", "name:=pointcloud_publisher", + "frame_id:=base_link" + ]) + + # Add the prediction node + roslaunch_command.extend([ + "ros_web_api_bellande_3d_computer_vision", "bellande_3d_computer_vision_prediction.py", "name:=pointcloud_prediction_node" + ]) + + # Add the rviz node + roslaunch_command.extend([ + "rviz", "rviz", "name:=rviz", + "args:=-d $(find ros_web_api_bellande_3d_computer_vision)/rviz/pointcloud_visualization.rviz" + ]) + # Execute the launch command subprocess.call(roslaunch_command) def ros2_launch_description(): - pass + # Create a list to hold all nodes to be launched + nodes_to_launch = [] + + # Add the pointcloud publisher node + nodes_to_launch.append(Node( + package='ros_web_api_bellande_3d_computer_vision', + executable='pointcloud_pradiction_node', + name='pointcloud_publisher', + output='screen', + parameters=[{'frame_id': 'base_link'}] + )) + + # Add the prediction node + nodes_to_launch.append(Node( + package='ros_web_api_bellande_3d_computer_vision', + executable='bellande_3d_computer_vision_prediction.py', + name='pointcloud_prediction_node', + output='screen', + remappings=[('input_pointcloud', '/pointcloud_topic')] + )) + + # Add the rviz node + nodes_to_launch.append(Node( + package='rviz2', + executable='rviz2', + name='rviz', + arguments=['-d', '$(find ros_web_api_bellande_3d_computer_vision)/rviz/pointcloud_visualization.rviz'] + )) + + # Return the LaunchDescription containing all nodes + return LaunchDescription(nodes_to_launch) + if __name__ == "__main__": ros_version = os.getenv("ROS_VERSION") diff --git a/ros_web_api_bellande_3d_computer_vision/script/build.sh b/ros_web_api_bellande_3d_computer_vision/script/build.sh deleted file mode 100644 index 199fe0e..0000000 --- a/ros_web_api_bellande_3d_computer_vision/script/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 ..