ethz-asl / asctec_mav_framework

Framework for data aquisition and position control to be used with the highlevel processor of Ascending Technologies helicopters
http://www.ros.org/wiki/asctec_mav_framework
36 stars 40 forks source link

Command-line argument to specify waypoint file #43

Closed sfolgar closed 9 years ago

sfolgar commented 9 years ago

By default, waypoint_nav has a hard-coded reference to sampleways.txt. This quick fix allows it to receive the path of a waypoint file as its first command-line argument.

markusachtelik commented 9 years ago

thanks a lot for adding this! Can you add a check whether the file exists? ;) good to merge then.

sfolgar commented 9 years ago

Done, although I'm sure there should be a more idiomatic way of checking this in python.

ffurrer commented 9 years ago

A more pythonic way would be something like this:

try:
    with open(file) as f :
        text = f.readlines()
except EnvironmentError:  # IOError, OSError, ...
    print("Some Error")
# you could also catch the individual exceptions here, instead of the generalized one above

see https://docs.python.org/2/tutorial/inputoutput.html#methods-of-file-objects

But it is also fine as you did it