Compare commits

...

2 Commits

Author SHA1 Message Date
interfisch 5a1734f181 decrease freewheel breaking 2024-08-27 08:13:17 +02:00
interfisch f09919ca62 add deletion flag and verification 2024-07-22 14:57:18 +02:00
2 changed files with 37 additions and 10 deletions

View File

@ -106,9 +106,9 @@ int16_t max_acceleration_rate=NORMAL_MAX_ACCELERATION_RATE; //maximum cmd send i
//Driving parameters
int16_t minimum_constant_cmd_reduce=1; //reduce cmd every loop by this constant amount when freewheeling/braking
int16_t brake_cmdreduce_proportional=500; //cmd gets reduced by an amount proportional to brake position (ignores freewheeling). cmd_new-=brake_cmdreduce_proportional / second @ full brake. with BREAK_CMDREDUCE_CONSTANT=1000 car would stop with full brake at least after a second (ignoring influence of brake current control/freewheeling)
float startbrakecurrent=2; //Ampere. "targeted brake current @full brake". at what point to start apply brake proportional to brake_pos. for everything above that cmd is reduced by freewheel_break_factor
float startbrakecurrent=2.0; //Ampere. "targeted brake current @full brake". at what point to start apply brake proportional to brake_pos. for everything above that cmd is reduced by freewheel_break_factor
float startbrakecurrent_offset=0.13; //offset start point for breaking, because of reading fluctuations around 0A. set this slightly above idle current reading
float freewheel_break_factor=500.0; //speed cmd units per amp per second. 1A over freewheel_current decreases cmd speed by this amount (on average)
float freewheel_break_factor=200.0; //speed cmd units per amp per second. 1A over freewheel_current decreases cmd speed by this amount (on average). Was 500 until 20240809
float reverse_speed=0.25; //reverse driving speed //0 to 1
int16_t throttle_max=1000; //maximum allowed set speed. used for scaling and limiting. [0,1000]

View File

@ -2,6 +2,10 @@
import serial
import os
import time
import random
import string
import argparse
chunksize=4096
#LOG0002
@ -150,6 +154,20 @@ def delete_file(filename):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Transfers log files from bobbycar over serial')
parser.add_argument('-o', '--output', nargs='?', help="output directory")
parser.add_argument('-d','--delete', action="store_true", help="delete files after transfer")
args = parser.parse_args()
outputfolder="sdcard"
if (args.output is not None):
outputfolder = args.output
if(outputfolder[-1]=='/'):
outputfolder=outputfolder[:-1] #remove last slash
print("Outputfolder:"+outputfolder)
if serialport.isOpen():
establish_connection()
@ -169,7 +187,7 @@ if __name__ == "__main__":
expectedsize=get_filesize(filename)
print("Expecting "+str(expectedsize)+" Byte")
writefilename='sdcard/'+filename
writefilename=outputfolder+'/'+filename
receivedsize=copy_file(filename,writefilename,expectedsize)
if (expectedsize!=receivedsize):
@ -183,12 +201,21 @@ if __name__ == "__main__":
#Delete all files
if (args.delete):
if (failed>0):
print("Copy not successful. Files won't be deleted!")
exit()
deletecheckstring=''.join(random.choices(string.ascii_lowercase, k=3))
deletecheck=input("Enter "+deletecheckstring+" to confirm deletion of "+str(len(filenames))+" files on bobbycar:")
'''
if (deletecheck==deletecheckstring):
log_off()
for filename in filenames:
print("Deleting "+filename)
delete_file(filename)
'''
else:
print("Verification failed!")
serialport.write("echo on\n".encode())