Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 553 → Rev 554

/VibrationTest/trunk/VibrationTest/VibrationTest.py
22,12 → 22,12
print "VibrationTest.py COMPORT MOTORS SPEEDS CHANNELS [-m MINSPEED] [-s NBSAMPLES] [-n NAME] [-d FILENAME] [-v]"
print " COMPORT Serial port to use. e.g. COM4"
print " MOTORS Motors to activate during test. Multiple motors can be used at the same time. e.g. 1,2,3,4"
print " SPEEDS Indicates at what speeds the motors need to be tested. e.g. 50,80,110,140,170"
print " SPEEDS Indicates at what speeds the motors need to be tested. "
print " Format 1: e.g. 50,110,140 Tests at speeds 50, 110 and 140"
print " Format 2: e.g. 100-200:50 Tests at speeds 100, 150 and 200"
print " CHANNELS Channels to monitor. e.g. 5,6,7"
i = 0
for channelName in CHANNEL_NAMES:
for i,channelName in enumerate(CHANNEL_NAMES):
print " Channel %d = %s" % (i, channelName)
i += 1
print " -m MINSPEED Minimum speed of the motor(s)"
print " -s NBSAMPLES Number of samples"
print " -n NAME Name of the test"
34,20 → 34,37
print " -d FILENAME File to which the measured values will be logged in"
print " -v Verbose"
print
def exit_usage():
usage()
sys.exit(2)
 
 
if __name__ == '__main__':
 
#print sys.argv
if len(sys.argv)<5:
usage()
sys.exit(2)
exit_usage()
 
parComPort = sys.argv[1]
parMotors = sys.argv[2].split(',')
parSpeeds = sys.argv[3].split(',')
parChannels = sys.argv[4].split(',')
 
par = sys.argv[3]
if par.count("-") == 1:
# assume from-to:step format
par = par.split("-")
if len(par) != 2:
exit_usage()
par[1] = par[1].split(":")
if len(par[1]) != 2:
exit_usage()
parSpeeds = range(int(par[0]),int(par[1][0])+int(par[1][1]),int(par[1][1]))
else:
parSpeeds = par.split(',')
try:
opts, args = getopt.getopt(sys.argv[5:], "s:n:d:m:v")
except Exception, err: