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

roslaunch defaults to making the current directory $HOME/.ros, but you shouldn't count on that. There are multiple methods to override this behavior. Instead, do as #q11642 suggests and always use a full path name. You can read the HOME environment variable to avoid hard-coding your own login in the code. In python2:

fname = os.getenv('HOME') + '/response.txt'

A completely separate issue is that it is grossly inefficient to open and close a file 50 times per second. I would make f a global variable and open it one time when you start, and close it one time when done.