Skip to content

Commit

Permalink
#35 Added a launch file and updated cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
aqil18 committed Dec 8, 2024
1 parent 9bac7ff commit 909555a
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ros2_ws/src/cpp_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,46 @@ find_package(ament_cmake REQUIRED)
# further dependencies manually.
# find_package(<dependency> REQUIRED)

find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(launch REQUIRED)
find_package(launch_ros REQUIRED)

add_executable(camera_node src/camera_node.cpp)
ament_target_dependencies(camera_node
rclcpp
std_msgs
sensor_msgs
)

add_executable(proxy_node src/proxy_node.cpp)
ament_target_dependencies(proxy_node
rclcpp
std_msgs
)

add_executable(inference_node src/inference_node.cpp)
ament_target_dependencies(inference_node
rclcpp
std_msgs
)

add_executable(extermination_node src/extermination_node.cpp)
ament_target_dependencies(extermination_node
rclcpp
std_msgs
)

install(TARGETS
camera_node
proxy_node
inference_node
extermination_node
DESTINATION lib/${PROJECT_NAME}
)


if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
Expand Down
72 changes: 72 additions & 0 deletions ros2_ws/src/cpp_package/launch/launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node

def generate_launch_description():
return LaunchDescription([
# Declare launch arguments to allow for parameter substitution
DeclareLaunchArgument('camera_side', default_value='left', description='Choose left or right camera'),
DeclareLaunchArgument('shift_constant', default_value='0', description='Shift value for ROI'),
DeclareLaunchArgument('roi_dimensions', default_value='[0, 0, 100, 100]', description='ROI dimensions as [x1, y1, x2, y2]'),

# Proxy Node argument
DeclareLaunchArgument('usb_port', default_value='/dev/ttyACM0', description='USB port for the serial connection'),

# Inference Node arguments
DeclareLaunchArgument('weights_path', default_value='./src/cpp_package/cpp_package/scripts/best.onnx', description='Path to the weights file'),
DeclareLaunchArgument('precision', default_value='fp32', description='Precision for the inference model (e.g., fp32, fp16)'),

# Extermination Node arguments
DeclareLaunchArgument('use_display_node', default_value='True', description='Enable display node for visualization'),
DeclareLaunchArgument('camera_side_exterm', default_value='left', description='Camera side for extermination node (left or right)'),

# Camera Node
Node(
package='cpp_package', # Replace with your package name
executable='CameraNode', # The C++ executable name
name='camera_node',
parameters=[
{'camera_side': LaunchConfiguration('camera_side')},
{'shift_constant': LaunchConfiguration('shift_constant')},
{'roi_dimensions': LaunchConfiguration('roi_dimensions')}
],
output='screen'
),

# Proxy Node
Node(
package='cpp_package', # Replace with your package name
executable='ProxyNode', # The C++ executable name
name='proxy_node',
parameters=[
{'usb_port': LaunchConfiguration('usb_port')}
],
output='screen'
),

# Inference Node
Node(
package='cpp_package', # Replace with your package name
executable='InferenceNode', # The C++ executable name
name='inference_node',
parameters=[
{'weights_path': LaunchConfiguration('weights_path')},
{'precision': LaunchConfiguration('precision')},
{'camera_side': LaunchConfiguration('camera_side')}
],
output='screen'
),

# Extermination Node
Node(
package='cpp_package', # Replace with your package name
executable='ExterminationNode', # The C++ executable name
name='extermination_node',
parameters=[
{'use_display_node': LaunchConfiguration('use_display_node')},
{'camera_side': LaunchConfiguration('camera_side_exterm')}
],
output='screen'
)
])
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 909555a

Please sign in to comment.