0
$\begingroup$

Rosanswers logo

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:

#!/usr/bin/python
import rospy
import rosbag
from std_msgs.msg import Int32, String

rospy.init_node("bagtest")
rate = rospy.Rate(2) 

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

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

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

bag.close()


while not rospy.is_shutdown():

print("this is my first node")
rate.sleep()

The launch file looks like this:

<launch>
<node pkg="data_acquisition_package" type="testbag.py" name="bagtest" output="screen"></node>
</launch>

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 !


Originally posted by Shamuquito on ROS Answers with karma: 16 on 2020-05-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by Shamuquito with karma: 16 on 2020-05-09

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.