forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request commaai#374 from ShaneSmiskol/release2
Add drive data collection for a longitudinal model
- Loading branch information
Showing
5 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import ftplib | ||
import json | ||
import string | ||
import random | ||
import os | ||
from common.params import Params | ||
|
||
def upload_data(): | ||
filepath = "/data/openpilot/selfdrive/df/df-data" | ||
if os.path.isfile(filepath): | ||
try: | ||
username = ''.join([random.choice(string.lowercase+string.uppercase+string.digits) for i in range(15)]) | ||
try: | ||
with open("/data/data/ai.comma.plus.offroad/files/persistStore/persist-auth", "r") as f: | ||
auth = json.loads(f.read()) | ||
auth = json.loads(auth['commaUser']) | ||
if auth: | ||
username = str(auth['username']) | ||
except: | ||
pass | ||
|
||
params = Params() | ||
car = params.get('CachedFingerprint') | ||
if car is not None: | ||
car = json.loads(car) | ||
username+="-{}".format(car[0]) | ||
|
||
filename = "df-data.{}".format(random.randint(1,99999)) | ||
|
||
ftp = ftplib.FTP("smiskol.com") | ||
ftp.login("eon", "87pYEYF4vFpwvgXU") | ||
with open(filepath, "rb") as f: | ||
try: | ||
ftp.mkd("/{}".format(username)) | ||
except: | ||
pass | ||
ftp.storbinary("STOR /{}/{}".format(username, filename), f) | ||
ftp.quit() | ||
os.remove(filepath) | ||
return True | ||
except: | ||
return False | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters