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

How to write to a text file in python in a ROS node?

asked 2016-06-01 10:20:23 -0600

Ros User gravatar image

updated 2022-03-26 11:25:14 -0600

lucasw gravatar image

I need to record a topic message called "message" only when a "message sent" button is pressed. I have made a separate node for GUI that has "message sent" button. I also wrote the "message" topic to a text file when "message sent" button was activated. The program works fine when this node is run separately, it also writes the message to the designated text file. But when I run this node along with other nodes by including it in a launch file, the text file does not seem to be created. Is there any specific reason for this to happen? How can this problem be solved?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-06-01 10:43:35 -0600

Thomas D gravatar image

When using roslaunch the nodes are run from $ROS_HOME which is almost always ~/.ros. So, if you are writing x.txt you should be able to find it at ~/.ros/x.txt.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-01 10:20:23 -0600

Seen: 2,004 times

Last updated: Jun 01 '16