nclt2ros/transformer/image_data.py
def write_images(self, utime, cam_file):
        """converts the images into a ros image message

        :return: timestamp: ros time object
                 image_msg: ROS image msg
                 tf_static_msg: static transformation
        """

        # create ros timestamp
        timestamp = rospy.Time.from_sec(utime / 1e6)

        # get image and base link
        camera_link = self.ladybug_frame
        base_link = self.body_frame

        cv_img = cv2.imread(cam_file)
        cv_img = cv2.rotate(cv_img, rotateCode=0)  # 90 deg
        img_msg = self.bridge.cv2_to_imgmsg(cv_img, encoding="bgr8")

        img_msg.header.frame_id = camera_link

        # create base_link camera_link static transformer
        img_static_transform_stamped = geometry_msgs.msg.TransformStamped()
        img_static_transform_stamped.header.stamp = timestamp
        img_static_transform_stamped.header.frame_id = base_link
        img_static_transform_stamped.child_frame_id = camera_link

        img_static_transform_stamped.transform.translation.x = 0.035
        img_static_transform_stamped.transform.translation.y = -0.002
        img_static_transform_stamped.transform.translation.z = 1.23

        quat = tf.transformations.quaternion_from_euler(0, 0, 0)
        img_static_transform_stamped.transform.rotation.x = quat[0]
        img_static_transform_stamped.transform.rotation.y = quat[1]
        img_static_transform_stamped.transform.rotation.z = quat[2]
        img_static_transform_stamped.transform.rotation.w = quat[3]

        # publish static transform
        tf_static_msg = tf2_msgs.msg.TFMessage([img_static_transform_stamped])

        return timestamp, img_msg, tf_static_msg
converts the images into a ros image message

        :return: timestamp: ros time object
                 image_msg: ROS image msg
                 tf_static_msg: static transformation
        
converts the images into a ros image message
converts the images into a ros image message
def write_images(self, utime, cam_file):
        timestamp = rospy.Time.from_sec(utime / 1e6)
        camera_link = self.ladybug_frame
        base_link = self.body_frame
        cv_img = cv2.imread(cam_file)
        cv_img = cv2.rotate(cv_img, rotateCode=0)  
        img_msg = self.bridge.cv2_to_imgmsg(cv_img, encoding="bgr8")
        img_msg.header.frame_id = camera_link
        img_static_transform_stamped = geometry_msgs.msg.TransformStamped()
        img_static_transform_stamped.header.stamp = timestamp
        img_static_transform_stamped.header.frame_id = base_link
        img_static_transform_stamped.child_frame_id = camera_link
        img_static_transform_stamped.transform.translation.x = 0.035
        img_static_transform_stamped.transform.translation.y = -0.002
        img_static_transform_stamped.transform.translation.z = 1.23
        quat = tf.transformations.quaternion_from_euler(0, 0, 0)
        img_static_transform_stamped.transform.rotation.x = quat[0]
        img_static_transform_stamped.transform.rotation.y = quat[1]
        img_static_transform_stamped.transform.rotation.z = quat[2]
        img_static_transform_stamped.transform.rotation.w = quat[3]
        tf_static_msg = tf2_msgs.msg.TFMessage([img_static_transform_stamped])
        return timestamp, img_msg, tf_static_msg
def write_images ( self , utime , cam_file ) : timestamp = rospy . Time . from_sec ( utime / 1e6 ) camera_link = self . ladybug_frame base_link = self . body_frame cv_img = cv2 . imread ( cam_file ) cv_img = cv2 . rotate ( cv_img , rotateCode = 0 ) img_msg = self . bridge . cv2_to_imgmsg ( cv_img , encoding = "bgr8" ) img_msg . header . frame_id = camera_link img_static_transform_stamped = geometry_msgs . msg . TransformStamped ( ) img_static_transform_stamped . header . stamp = timestamp img_static_transform_stamped . header . frame_id = base_link img_static_transform_stamped . child_frame_id = camera_link img_static_transform_stamped . transform . translation . x = 0.035 img_static_transform_stamped . transform . translation . y = - 0.002 img_static_transform_stamped . transform . translation . z = 1.23 quat = tf . transformations . quaternion_from_euler ( 0 , 0 , 0 ) img_static_transform_stamped . transform . rotation . x = quat [ 0 ] img_static_transform_stamped . transform . rotation . y = quat [ 1 ] img_static_transform_stamped . transform . rotation . z = quat [ 2 ] img_static_transform_stamped . transform . rotation . w = quat [ 3 ] tf_static_msg = tf2_msgs . msg . TFMessage ( [ img_static_transform_stamped ] ) return timestamp , img_msg , tf_static_msg
converts the images into a ros image message
converts the images into a ros image message
"""converts the images into a ros image message

        :return: timestamp: ros time object
                 image_msg: ROS image msg
                 tf_static_msg: static transformation
        """ # create ros timestamp # get image and base link # 90 deg # create base_link camera_link static transformer # publish static transform
ros time object
image_msg: ROS image msg
tf_static_msg: static transformation
ros time object image_msg : ROS image msg tf_static_msg : static transformation
self
utime
cam_file