bagpy/bagreader.py
def odometry_data(self, **kwargs):
        '''
        Class method `odometry_data` extracts velocity data from the given file, assuming laser data is of type `nav_msgs/Odometry`.

        Parameters
        -------------
        kwargs
            variable keyword arguments

        Returns
        ---------
        `list`
            A list of strings. Each string will correspond to file path of CSV file that contains extracted data of nav_msgs/Odometry type

        Example
        ----------
        >>> b = bagreader('/home/ivory/CyverseData/ProjectSparkle/sparkle_n_1_update_rate_100.0_max_update_rate_100.0_time_step_0.01_logtime_30.0_2020-03-01-23-52-11.bag') 
        >>> odomdatafile = b.odometry_data()
        >>> print(odomdatafile)

        '''
        tstart = None
        tend = None
        
        type_to_look ="nav_msgs/Odometry"
        table_rows = self.topic_table[self.topic_table['Types']==type_to_look]
        topics_to_read = table_rows['Topics'].values
        message_counts = table_rows['Message Count'].values
        
        column_names = ["Time",
                                "header.seq", 
                                "header.frame_id", 
                                "child_frame_id",
                                "pose.x" , 
                                "pose.y", 
                                "pose.z", 
                                "orientation.x", 
                                "orientation.y", 
                                "orientation.z",
                                "orientation.w",
                                "linear.x",
                                "linear.y",
                                "linear.z",
                                "angular.x",
                                "angular.y",
                                "angular.z"]

        csvlist = []
        for i in range(len(table_rows)):
            tempfile = self.datafolder + "/" + topics_to_read[i].replace("/", "-") + ".csv"
            file_to_write = ntpath.dirname(tempfile) + '/' + ntpath.basename(tempfile)[1:]
            k = 0

            if sys.hexversion >= 0x3000000:
                opencall = open(file_to_write, "w", newline='')
            else:
                opencall = open(file_to_write, 'wb')

            with opencall as f:
                writer = csv.writer(f, delimiter=',')
                writer.writerow(column_names) # write the header
                for topic, msg, t in self.reader.read_messages(topics=topics_to_read[i], start_time=tstart, end_time=tend):
                    new_row = [t.secs + t.nsecs*1e-9, 
                                            msg.header.seq, 
                                            msg.header.frame_id,
                                            msg.child_frame_id,
                                            msg.pose.pose.position.x,
                                            msg.pose.pose.position.y,
                                            msg.pose.pose.position.z,
                                            msg.pose.pose.orientation.x,
                                            msg.pose.pose.orientation.y,
                                            msg.pose.pose.orientation.z,
                                            msg.pose.pose.orientation.w,
                                            msg.twist.twist.linear.x,
                                            msg.twist.twist.linear.y,
                                            msg.twist.twist.linear.z]

                    writer.writerow(new_row)
                
                k = k + 1

            csvlist.append(file_to_write)
        return csvlist

        Class method `odometry_data` extracts velocity data from the given file, assuming laser data is of type `nav_msgs/Odometry`.

        Parameters
        -------------
        kwargs
            variable keyword arguments

        Returns
        ---------
        `list`
            A list of strings. Each string will correspond to file path of CSV file that contains extracted data of nav_msgs/Odometry type

        Example
        ----------
        >>> b = bagreader('/home/ivory/CyverseData/ProjectSparkle/sparkle_n_1_update_rate_100.0_max_update_rate_100.0_time_step_0.01_logtime_30.0_2020-03-01-23-52-11.bag') 
        >>> odomdatafile = b.odometry_data()
        >>> print(odomdatafile)

        
Class method `odometry_data` extracts velocity data from the given file, assuming laser data is of type `nav_msgs/Odometry`.
Parameters

kwargs
variable keyword arguments

Returns

`list`
A list of strings. Each string will correspond to file path of CSV file that contains extracted data of nav_msgs/Odometry type

Example


Class method ` odometry_data ` extracts velocity data from the given file assuming laser data is of type ` nav_msgs / Odometry ` . Parameters kwargs variable keyword arguments Returns ` list ` A list of strings . Each string will correspond to file path of CSV file that contains extracted data of nav_msgs / Odometry type Example
def odometry_data(self, **kwargs):
        tstart = None
        tend = None
        type_to_look ="nav_msgs/Odometry"
        table_rows = self.topic_table[self.topic_table['Types']==type_to_look]
        topics_to_read = table_rows['Topics'].values
        message_counts = table_rows['Message Count'].values
        column_names = ["Time",
                                "header.seq", 
                                "header.frame_id", 
                                "child_frame_id",
                                "pose.x" , 
                                "pose.y", 
                                "pose.z", 
                                "orientation.x", 
                                "orientation.y", 
                                "orientation.z",
                                "orientation.w",
                                "linear.x",
                                "linear.y",
                                "linear.z",
                                "angular.x",
                                "angular.y",
                                "angular.z"]
        csvlist = []
        for i in range(len(table_rows)):
            tempfile = self.datafolder + "/" + topics_to_read[i].replace("/", "-") + ".csv"
            file_to_write = ntpath.dirname(tempfile) + '/' + ntpath.basename(tempfile)[1:]
            k = 0
            if sys.hexversion >= 0x3000000:
                opencall = open(file_to_write, "w", newline='')
            else:
                opencall = open(file_to_write, 'wb')
            with opencall as f:
                writer = csv.writer(f, delimiter=',')
                writer.writerow(column_names) 
                for topic, msg, t in self.reader.read_messages(topics=topics_to_read[i], start_time=tstart, end_time=tend):
                    new_row = [t.secs + t.nsecs*1e-9, 
                                            msg.header.seq, 
                                            msg.header.frame_id,
                                            msg.child_frame_id,
                                            msg.pose.pose.position.x,
                                            msg.pose.pose.position.y,
                                            msg.pose.pose.position.z,
                                            msg.pose.pose.orientation.x,
                                            msg.pose.pose.orientation.y,
                                            msg.pose.pose.orientation.z,
                                            msg.pose.pose.orientation.w,
                                            msg.twist.twist.linear.x,
                                            msg.twist.twist.linear.y,
                                            msg.twist.twist.linear.z]
                    writer.writerow(new_row)
                k = k + 1
            csvlist.append(file_to_write)
        return csvlist
def odometry_data ( self , ** kwargs ) : tstart = None tend = None type_to_look = "nav_msgs/Odometry" table_rows = self . topic_table [ self . topic_table [ 'Types' ] == type_to_look ] topics_to_read = table_rows [ 'Topics' ] . values message_counts = table_rows [ 'Message Count' ] . values column_names = [ "Time" , "header.seq" , "header.frame_id" , "child_frame_id" , "pose.x" , "pose.y" , "pose.z" , "orientation.x" , "orientation.y" , "orientation.z" , "orientation.w" , "linear.x" , "linear.y" , "linear.z" , "angular.x" , "angular.y" , "angular.z" ] csvlist = [ ] for i in range ( len ( table_rows ) ) : tempfile = self . datafolder + "/" + topics_to_read [ i ] . replace ( "/" , "-" ) + ".csv" file_to_write = ntpath . dirname ( tempfile ) + '/' + ntpath . basename ( tempfile ) [ 1 : ] k = 0 if sys . hexversion >= 0x3000000 : opencall = open ( file_to_write , "w" , newline = '' ) else : opencall = open ( file_to_write , 'wb' ) with opencall as f : writer = csv . writer ( f , delimiter = ',' ) writer . writerow ( column_names ) for topic , msg , t in self . reader . read_messages ( topics = topics_to_read [ i ] , start_time = tstart , end_time = tend ) : new_row = [ t . secs + t . nsecs * 1e-9 , msg . header . seq , msg . header . frame_id , msg . child_frame_id , msg . pose . pose . position . x , msg . pose . pose . position . y , msg . pose . pose . position . z , msg . pose . pose . orientation . x , msg . pose . pose . orientation . y , msg . pose . pose . orientation . z , msg . pose . pose . orientation . w , msg . twist . twist . linear . x , msg . twist . twist . linear . y , msg . twist . twist . linear . z ] writer . writerow ( new_row ) k = k + 1 csvlist . append ( file_to_write ) return csvlist
Class method `odometry_data` extracts velocity data from the given file, assuming laser data is of type `nav_msgs/Odometry`.
Class method ` odometry_data ` extracts velocity data from the given file assuming laser data is of type ` nav_msgs / Odometry ` .
'''
        Class method `odometry_data` extracts velocity data from the given file, assuming laser data is of type `nav_msgs/Odometry`.

        Parameters
        -------------
        kwargs
            variable keyword arguments

        Returns
        ---------
        `list`
            A list of strings. Each string will correspond to file path of CSV file that contains extracted data of nav_msgs/Odometry type

        Example
        ----------
        >>> b = bagreader('/home/ivory/CyverseData/ProjectSparkle/sparkle_n_1_update_rate_100.0_max_update_rate_100.0_time_step_0.01_logtime_30.0_2020-03-01-23-52-11.bag') 
        >>> odomdatafile = b.odometry_data()
        >>> print(odomdatafile)

        ''' # write the header
self