nclt2ros/transformer/hokuyo_data.py
def write_hokuyo_30m_to_laserscan(self, utime, data):
        """writes the data into a LaserScan message

        :param utime: timestamp in microseconds
        :param  data: list containing the data

        :return: timestamp: ros timestamp
                      scan: LaserScan message
        """
        try:
            # create ros timestamp
            timestamp = rospy.Time.from_sec(utime / 1e6)

            # get hokuyo and base link
            hokuyo_utm_link = self.hok_utm_frame
            base_link       = self.body_frame

            # create LaserScan message
            scan = LaserScan()
            scan.header.stamp = timestamp
            scan.header.frame_id = hokuyo_utm_link

            scan.angle_min = -np.pi / 2
            scan.angle_max = np.pi / 2
            scan.angle_increment = 0.004363
            scan.time_increment = 9.250e-5
            scan.scan_time = 0.1
            scan.range_min = 0
            scan.range_max = 100.0

            scan.ranges = data

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

            hok_static_transform_stamped.transform.translation.x = 0.28
            hok_static_transform_stamped.transform.translation.y = 0
            hok_static_transform_stamped.transform.translation.z = 0.44

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

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

            return timestamp, scan, tf_static_msg

        except Exception as e:
            print(e)
writes the data into a LaserScan message

        :param utime: timestamp in microseconds
        :param  data: list containing the data

        :return: timestamp: ros timestamp
                      scan: LaserScan message
        
writes the data into a LaserScan message
writes the data into a LaserScan message
def write_hokuyo_30m_to_laserscan(self, utime, data):
        try:
            timestamp = rospy.Time.from_sec(utime / 1e6)
            hokuyo_utm_link = self.hok_utm_frame
            base_link       = self.body_frame
            scan = LaserScan()
            scan.header.stamp = timestamp
            scan.header.frame_id = hokuyo_utm_link
            scan.angle_min = -np.pi / 2
            scan.angle_max = np.pi / 2
            scan.angle_increment = 0.004363
            scan.time_increment = 9.250e-5
            scan.scan_time = 0.1
            scan.range_min = 0
            scan.range_max = 100.0
            scan.ranges = data
            hok_static_transform_stamped = geometry_msgs.msg.TransformStamped()
            hok_static_transform_stamped.header.stamp = timestamp
            hok_static_transform_stamped.header.frame_id = base_link
            hok_static_transform_stamped.child_frame_id = hokuyo_utm_link
            hok_static_transform_stamped.transform.translation.x = 0.28
            hok_static_transform_stamped.transform.translation.y = 0
            hok_static_transform_stamped.transform.translation.z = 0.44
            quat = tf.transformations.quaternion_from_euler(0, 0, -0.785)
            hok_static_transform_stamped.transform.rotation.x = quat[0]
            hok_static_transform_stamped.transform.rotation.y = quat[1]
            hok_static_transform_stamped.transform.rotation.z = quat[2]
            hok_static_transform_stamped.transform.rotation.w = quat[3]
            tf_static_msg = tf2_msgs.msg.TFMessage([hok_static_transform_stamped])
            return timestamp, scan, tf_static_msg
        except Exception as e:
            print(e)
def write_hokuyo_30m_to_laserscan ( self , utime , data ) : try : timestamp = rospy . Time . from_sec ( utime / 1e6 ) hokuyo_utm_link = self . hok_utm_frame base_link = self . body_frame scan = LaserScan ( ) scan . header . stamp = timestamp scan . header . frame_id = hokuyo_utm_link scan . angle_min = - np . pi / 2 scan . angle_max = np . pi / 2 scan . angle_increment = 0.004363 scan . time_increment = 9.250e-5 scan . scan_time = 0.1 scan . range_min = 0 scan . range_max = 100.0 scan . ranges = data hok_static_transform_stamped = geometry_msgs . msg . TransformStamped ( ) hok_static_transform_stamped . header . stamp = timestamp hok_static_transform_stamped . header . frame_id = base_link hok_static_transform_stamped . child_frame_id = hokuyo_utm_link hok_static_transform_stamped . transform . translation . x = 0.28 hok_static_transform_stamped . transform . translation . y = 0 hok_static_transform_stamped . transform . translation . z = 0.44 quat = tf . transformations . quaternion_from_euler ( 0 , 0 , - 0.785 ) hok_static_transform_stamped . transform . rotation . x = quat [ 0 ] hok_static_transform_stamped . transform . rotation . y = quat [ 1 ] hok_static_transform_stamped . transform . rotation . z = quat [ 2 ] hok_static_transform_stamped . transform . rotation . w = quat [ 3 ] tf_static_msg = tf2_msgs . msg . TFMessage ( [ hok_static_transform_stamped ] ) return timestamp , scan , tf_static_msg except Exception as e : print ( e )
writes the data into a LaserScan message
writes the data into a LaserScan message
"""writes the data into a LaserScan message

        :param utime: timestamp in microseconds
        :param  data: list containing the data

        :return: timestamp: ros timestamp
                      scan: LaserScan message
        """ # create ros timestamp # get hokuyo and base link # create LaserScan message # create base_link hokuyo_utm_link static transformer # publish static transform
ros timestamp
scan: LaserScan message
ros timestamp scan : LaserScan message
self
utime
timestamp in microseconds
timestamp in microseconds
data
list containing the data
list containing the data