Compare commits
2 Commits
156455f363
...
24a5a97cfb
Author | SHA1 | Date |
---|---|---|
interfisch | 24a5a97cfb | |
interfisch | 3c5cd0b1c3 |
|
@ -563,10 +563,10 @@ void calculateSetSpeed(unsigned long timediff){
|
|||
|
||||
|
||||
|
||||
if (control_buttonA && !control_buttonB && !reverse_enabled && throttle_pos<=0) { //Right button (A) only. and throttle touched
|
||||
if (control_buttonA && !control_buttonB && !reverse_enabled && throttle_pos>0) { //Right button (A) only. and throttle touched
|
||||
tanksteering_differential+=tanksteering_rate_increase*(timediff/1000.0);
|
||||
tanksteering_differential=constrain(tanksteering_differential,-1.0,1.0); //constrain between 0 and 1
|
||||
}else if(control_buttonB && !control_buttonA && !reverse_enabled && throttle_pos<=0) { //Left button (B) only. and throttle touched
|
||||
}else if(control_buttonB && !control_buttonA && !reverse_enabled && throttle_pos>0) { //Left button (B) only. and throttle touched
|
||||
tanksteering_differential-=tanksteering_rate_increase*(timediff/1000.0);
|
||||
tanksteering_differential=constrain(tanksteering_differential,-1.0,1.0); //constrain between 0 and 1
|
||||
}else{ //buttons released
|
||||
|
|
|
@ -2,12 +2,16 @@ import numpy as np
|
|||
from datetime import datetime
|
||||
import time
|
||||
import argparse
|
||||
import os.path
|
||||
|
||||
parser = argparse.ArgumentParser(description='Copys, renames and fixes logfiles written by bobbycar sd logger.')
|
||||
parser.add_argument('--input', type=argparse.FileType('r'), nargs='+')
|
||||
parser.add_argument('--output', nargs='?', type=argparse.FileType('w'))
|
||||
parser.add_argument('-i', '--input', type=argparse.FileType('r'), nargs='+', required=True, help="list of input log files")
|
||||
parser.add_argument('-o', '--output', nargs='?', type=argparse.FileType('w'), help="output filename")
|
||||
parser.add_argument('-c','--consecutive', action="store_true", help="add consecutive files to input. If the input file ends with a number the following logfiles will be added.")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
||||
ok=True
|
||||
|
||||
def getTimestamp(plines):
|
||||
|
@ -71,9 +75,49 @@ def filterLines(plines,plinesStarttime=None):
|
|||
return plines,pheader,pcommentlinesMask,pdatalines,pdatalinesFail,pdatalinesOK,pheaderSize,plinesOK,plinesStarttime
|
||||
|
||||
|
||||
inputFilenames=[]
|
||||
|
||||
if (args.consecutive):
|
||||
if(len(args.input)!=1):
|
||||
parser.error("in consequtive mode exactly one input file is required")
|
||||
exit()
|
||||
|
||||
nextFilename=args.input[0].name
|
||||
while os.path.isfile(nextFilename):
|
||||
print(nextFilename+" exists")
|
||||
inputFilenames.append(nextFilename)
|
||||
|
||||
digitStartpos=len(nextFilename)-1
|
||||
digitEndpos=len(nextFilename)
|
||||
|
||||
|
||||
|
||||
while (not nextFilename[digitStartpos:digitEndpos].isdigit() and digitStartpos>0 and digitEndpos>0):
|
||||
digitStartpos-=1
|
||||
digitEndpos-=1
|
||||
|
||||
while (nextFilename[digitStartpos:digitEndpos].isdigit() and digitStartpos>0 and digitEndpos>0):
|
||||
digitStartpos-=1
|
||||
|
||||
digitStartpos+=1
|
||||
|
||||
|
||||
number=int(nextFilename[digitStartpos:digitEndpos])+1
|
||||
nextFilename=nextFilename[0:digitStartpos]+str(number).zfill(digitEndpos-digitStartpos)+nextFilename[digitEndpos:]
|
||||
|
||||
|
||||
|
||||
print("")
|
||||
print(inputFilenames)
|
||||
|
||||
|
||||
else:
|
||||
inputFilenames=[x.name for x in args.input]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
outputFilename=None
|
||||
if args.output is not None:
|
||||
outputFilename=args.output.name
|
||||
|
|
Loading…
Reference in New Issue