-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsafe_search.sh
More file actions
executable file
·64 lines (53 loc) · 1.43 KB
/
safe_search.sh
File metadata and controls
executable file
·64 lines (53 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#also the organization is horrible. TODO please please fix
source /opt/ros/kinetic/setup.bash
IFS='
'
count=1
if [ $# -eq 0 ]
then
echo Input a bag file
fi
for var in "$@"
do
echo For bag file ${var}:
if [[ $var == *bag.active ]]
then
echo Reindexing
rosbag reindex $var
fi
if [[ $var == *.orig.active ]]
then
echo orig.active found -- skipping
continue
fi
echo Writing data to file
$HOME/2018RobotCode/zebROS_ws/devel/lib/rosbag_scripts/rosbag_scripts_node $var
filename=$(basename $var)
any_data=$(rosbag info $var | grep /frcrobot/match_data)
if [ ! -z "$any_data" -a "$any_data" != " " ]
then
echo This has match data
matchNumber=$(grep -m1 matchNumber temp_file.txt | cut -c14-15)
if [ $matchNumber = 0 ]
then
echo Match number is zero -- renaming
mv $var $HOME/2018RobotCode/practice$(basename $var)
continue
fi
alliance_data=$(grep this temp_file.txt)
if [ ! -z "$alliance_data" -a "$alliance_data" != " " ]
then
echo This has alliance data.
bag_name=Match${matchNumber}
echo Renaming bag file to ${bag_name}_${count}.bag
cp $var $HOME/2018RobotCode/${bag_name}.bag
else
echo This does not have alliance data but match numer != 0 -- renaming to prematch${var}
cp $var $HOME/2018RobotCode/prematch$(basename $var)
fi
else
echo This does not have match data -- renaming to practice${var}
cp $var $HOME/2018RobotCode/practice$(basename $var)
fi
#rm temp_file.txt
done