-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tools which could help with the data collection sketch
- Loading branch information
1 parent
7f66a2e
commit ac41393
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Arduino_BHY2/examples/SyncAndCollectIMUData/tools/README.md
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,31 @@ | ||
# process_nicla_bhy2_log_base64.py | ||
This script is used to convert the log encoded in base64 to ascii | ||
## Usage | ||
``` | ||
./process_nicla_bhy2_log_base64.py [log_file_name] | ||
``` | ||
## Example | ||
./process_nicla_bhy2_log_base64.py log_nicla_bhy2.txt | ||
|
||
|
||
# check_for_data_loss.sh | ||
This script is used to check for any potential data loss during the transfer, | ||
and it reports some errors if it does find any data loss | ||
|
||
## Usage | ||
``` | ||
./check_for_data_loss.sh [OPTION] [log_file_name] | ||
``` | ||
|
||
## Example | ||
- Example 1 | ||
``` | ||
./check_for_data_loss.sh -b ./minicom.log | ||
``` | ||
The above command check for the data loss using the log "./minicom.log" which is base on base64 encoding | ||
- Example 2 | ||
``` | ||
./check_for_data_loss.sh -a ./minicom.log | ||
``` | ||
The above command check for the data loss using the log "./minicom.log" which is base on ascii encoding | ||
48 changes: 48 additions & 0 deletions
48
Arduino_BHY2/examples/SyncAndCollectIMUData/tools/check_for_data_loss.sh
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,48 @@ | ||
#!/bin/sh | ||
|
||
|
||
log_encoding_is_base64=false | ||
|
||
if [ ":""$1" = ":-b" ] ; then | ||
log_encoding_is_base64=true | ||
echo "log is using base64 encoding" | ||
elif [ ":""$1" = ":-a" ] ; then | ||
log_encoding_is_base64=false | ||
echo "log is using ascii encoding" | ||
else | ||
echo "usage: ./check_for_data_loss.sh [OPTION] [log_filename]" | ||
echo "\t[OPTION]:" | ||
echo "\t\t" "-a" | ||
echo "\t\t" "\t:log use ascii encoding" | ||
echo "\t\t" "-b" | ||
echo "\t\t" "\t:log use base64 encoding" | ||
|
||
echo "\texample: ./check_for_data_loss.sh -b minicom.cap" | ||
return | ||
fi | ||
|
||
if [ ":""$2" = ":" ] ; then | ||
log_file="./minicom.cap" | ||
else | ||
log_file="$2" | ||
fi | ||
|
||
|
||
tmp_file="./tmp.csv" | ||
log_file_cp="${log_file}.cp" | ||
log_file_in="${log_file_cp}.tmp" | ||
|
||
echo "log_file:$log_file" | ||
|
||
|
||
if [ $log_encoding_is_base64 = true ] ; then | ||
cp $log_file $log_file_cp | ||
./process_nicla_bhy2_log_base64.py $log_file_cp > $log_file_in | ||
else | ||
cp $log_file $log_file_in | ||
fi | ||
|
||
echo "log_id,seq,ax,ay,az,gx,gy,gz" > $tmp_file | ||
|
||
sed 's/.*\([a-zA-Z]\)\([0-9]\)/\1,\2/g' $log_file_in >> $tmp_file | ||
./check_for_data_loss.py $tmp_file |