diff --git a/launch/base_gesture_control.launch.py b/launch/base_gesture_control.launch.py index da671e3..d492a65 100644 --- a/launch/base_gesture_control.launch.py +++ b/launch/base_gesture_control.launch.py @@ -34,11 +34,33 @@ def generate_launch_description(): parameters=[ {"fire_ext_max_capacity": 100}, ], + remappings=[ + ('image', '/camera_node/image_raw') + ] ) + camera_node = Node( + package='camera_ros', + executable='camera_node', + name='camera_node', + #namespace='camera', + output='screen', + parameters=[{ + # Camera selection index (0 for the first detected libcamera device) + 'camera': 0, + # Image streams configuration + 'width': 640, + 'height': 480, + 'frame_rate': 10.0, + # Available options depend on your camera (e.g., 'sensor', 'video', 'still') + 'role': 'video', + }] + ) + return LaunchDescription( launch_args + [ base_gesture_control_node, + camera_node ] ) diff --git a/unity_robot_controller/base_gesture_control_node.py b/unity_robot_controller/base_gesture_control_node.py index c899161..026bc4f 100644 --- a/unity_robot_controller/base_gesture_control_node.py +++ b/unity_robot_controller/base_gesture_control_node.py @@ -9,10 +9,10 @@ import cv2 import numpy as np from sensor_msgs.msg import Image -from skeleton.mediapipe_detector import MediaPipeDetector -from gesture_control.special_gestures import SpecialGestureDetector -from gesture_control.arm_control import ArmController -from ml_gestures_dynamic.predict import DynamicGesturePredictor +from unity_robot_controller.gesture_rec.skeleton.mediapipe_detector import MediaPipeDetector +from unity_robot_controller.gesture_rec.gesture_control.special_gestures import SpecialGestureDetector +from unity_robot_controller.gesture_rec.gesture_control.arm_control import ArmController +#from unity_robot_controller.gesture_rec.ml_gestures_dynamic.predict import DynamicGesturePredictor class BaseGestureControlNode(Node): @@ -25,9 +25,6 @@ class BaseGestureControlNode(Node): self.bridge = CvBridge() self.cv_image = None - - # subscriptions - self.create_subscription(Image, 'image', self.image_cb, 10) #ros params? ARM_CONTROL = { @@ -41,9 +38,9 @@ class BaseGestureControlNode(Node): SPECIAL_GESTURE_MODE = 'geometric' # 'ml' или 'geometric' ML_GESTURE_MODEL = "path/to/special_gestures_rf.pkl" - ML_GESTURE_CLASSES ['dome', 'cross', 'none'] + ML_GESTURE_CLASSES = ['dome', 'cross', 'none'] - DG_ENABLED = True + DG_ENABLED = False DG_MODEL_PATH = "path/to/dynamic_model.h5" DG_CLASSES_PATH = "path/to/dynamic_model_classes.pkl" DG_WINDOW_SIZE = 14 @@ -80,9 +77,13 @@ class BaseGestureControlNode(Node): self.image_pub = self.create_publisher(Image, 'skeleton_image', 10) + # subscriptions + self.create_subscription(Image, 'image', self.image_cb, 10) + + def image_cb(self, msg): try: - self.cv_image = self.bridge.imgmsg_to_cv2(raw_msg, desired_encoding='bgr8') + self.cv_image = self.bridge.imgmsg_to_cv2(msg, desired_encoding='bgr8') except Exception as e: self.get_logger().error(f"Failed to convert image: {e}") self.cv_image = None @@ -123,7 +124,7 @@ class BaseGestureControlNode(Node): # Команда тушения if self.enabled: if special == 'dome' and not self.dome_processed: - self.URC.send_fire_ext_burst_cmd(): + self.URC.send_fire_ext_burst_cmd() self.dome_processed = True elif special != 'dome': self.dome_processed = False diff --git a/unity_robot_controller/gesture_rec b/unity_robot_controller/gesture_rec index 0415ff9..b0f04da 160000 --- a/unity_robot_controller/gesture_rec +++ b/unity_robot_controller/gesture_rec @@ -1 +1 @@ -Subproject commit 0415ff9f429d9f23bd14897447a0d555955eb17a +Subproject commit b0f04daa7859fda4bdf28854ff4f6f3a882a5c38