ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Bag file recorded from ROS node

asked 2020-05-09 15:12:12 -0600

Shamuquito gravatar image

Hello. I have a simple question about if its possible to record topics from within a rosnode. The goal is to autonomously have a robot collecting data for a period of time given specific locations of the environment.

My node looks like this so far but the file seems not to be created:

import rospy
import rosbag
from std_msgs.msg import Int32, String

rate = rospy.Rate(2) 

bag = rosbag.Bag('test13.bag','w')

#Set up message from String
s = String() = 'foo'
#Set up message from Int32
i = Int32() = 42

bag.write('chatter', s)
bag.write('numbers', i)


while not rospy.is_shutdown():

print("this is my first node")

The launch file looks like this:

<node pkg="data_acquisition_package" type="" name="bagtest" output="screen"></node>

If this is not supposed to work, is there any other example of how to start recording topics given specific situations in the environment ?

Thank you in advance !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-09 19:09:54 -0600

Shamuquito gravatar image

Actually files are stored properly. My mistake. They are located in /home/.ros

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-05-09 15:09:13 -0600

Seen: 126 times

Last updated: May 09 '20