Commit 160556fa authored by Inès EL HADRI's avatar Inès EL HADRI 💤

Get depth as Float32MultiArray

parent 9e82dc26
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import rclpy import rclpy
from rclpy.node import Node from rclpy.node import Node
from sensor_msgs.msg import Image from sensor_msgs.msg import Image
from std_msgs.msg import String from std_msgs.msg import String, Float32MultiArray
import numpy as np import numpy as np
import sys, cv2, pathlib, statistics import sys, cv2, pathlib, statistics
from cv_bridge import CvBridge from cv_bridge import CvBridge
...@@ -22,7 +22,7 @@ class CameraVision(Node): ...@@ -22,7 +22,7 @@ class CameraVision(Node):
# Initialize subscribers # Initialize subscribers
self.create_subscription(Image, 'cam_rgb', self.rgb_callback, 10) self.create_subscription(Image, 'cam_rgb', self.rgb_callback, 10)
self.create_subscription(Image, 'cam_depth_dist', self.depth_callback, 10) self.create_subscription(Float32MultiArray, 'cam_depth_dist', self.depth_callback, 10)
# Initialize subcriber variables # Initialize subcriber variables
self._rgb_img = None self._rgb_img = None
...@@ -42,6 +42,7 @@ class CameraVision(Node): ...@@ -42,6 +42,7 @@ class CameraVision(Node):
# Callbacks # Callbacks
def rgb_callback(self, img): def rgb_callback(self, img):
print('coucou')
self._rgb_img = self._bridge.imgmsg_to_cv2(img, desired_encoding='passthrough') self._rgb_img = self._bridge.imgmsg_to_cv2(img, desired_encoding='passthrough')
def depth_callback(self, img): def depth_callback(self, img):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment