ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello @congphase,

I think with this code you can able to read the csv file row one by one and publish it.

import csv
# Code inside your while loop
with open('csv_file_name.csv', 'r') as file:
    reader = csv.reader(file)
    for row in reader:
        print(row)

You can also use pandas, NumPy so many libraries. You just have to install this using the pip command.

Hello @congphase,

I think with this code you can able to read the csv file row one by one and publish it.

import csv
# Code inside your while loop
with open('csv_file_name.csv', 'r') as file:
    reader = csv.reader(file)
    for row in reader:
        print(row)

You can also use pandas, NumPy so many libraries. You just have to install this using the pip command.

I hope you got your answer if you have any question or issue with the answer please! drop commet.

Hello @congphase,

I think with this code you can able to read the csv file row one by one and publish it. Note: for example you want the data for rosbagTimestamp it is presented at 0 location so to obtain that data you need to make print(row[0]) similarly with others.

import csv
# Code inside your while loop
with open('csv_file_name.csv', 'r') as file:
    reader = csv.reader(file)
    for row in reader:
        print(row)

You can also use pandas, NumPy so many libraries. You just have to install this using the pip command.

I hope you got your answer if you have any question questions or issue with the answer please! drop commet.comment.