Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extract topic to csv file

import rosbag
from geometry_msgs.msg import Point
import pandas as pd

# The bag file should be in the same directory as your terminal
bag = rosbag.Bag('./recorded-data.bag')
topic = '/your_topic'
column_names = ['x', 'y']
df = pd.DataFrame(columns=column_names)

for topic, msg, t in bag.read_messages(topics=topic):
    x = msg.x
    y = msg.y

    df = df.append(
        {'x': x,
         'y': y},
        ignore_index=True
    )

df.to_csv('out.csv')
Comment

PREVIOUS NEXT
Code Example
Python :: matplotlib set y lim 
Python :: python find second occurrence in string 
Python :: google translate python 
Python :: how to shutdown your computer using python 
Python :: python timestamp shift one day 
Python :: python create environment variable 
Python :: pandas datetime to date 
Python :: create zero array in python 
Python :: import c# dll in python 
Python :: python json to dict and back 
Python :: create a df with column names 
Python :: ANSHUL 
Python :: pythons os module choose random file 
Python :: Python program to find Cumulative sum of a list 
Python :: How to Add a Progress Bar into Pandas Apply 
Python :: redis get all keys and values python 
Python :: how to ask someone for their name in python 
Python :: python date now plus days 
Python :: TypeError: Unicode-objects must be encoded before hashing 
Python :: pandas create dataframe of ones 
Python :: pandas dataframe select rows not in list 
Python :: hand tracking module 
Python :: python test if value is np.nan 
Python :: python divide one column by another 
Python :: pt_core_news_sm spacy download 
Python :: ValueError: There may be at most 1 Subject headers in a message 
Python :: python json parse 
Python :: python scond max function 
Python :: python distance calculator 
Python :: sacar la posicion en una lista python 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =