-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsafe_search.sh
executable file
·57 lines (46 loc) · 1.15 KB
/
safe_search.sh
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
#also the organization is horrible. TODO please please fix
source /opt/ros/melodic/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/zebROS_Nano/zebROS_ws/devel/lib/rosbag_scripts/rosbag_scripts_node $var
filename=$(basename $var)
any_data=$(rosbag info $var | grep /frcrobot_rio/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)
echo MatchNumber = $matchNumber
if [ $matchNumber = 0 ]
then
echo Match number is zero -- renaming
cp $var ./bagfiles/practice$(basename $var)
continue
fi
bag_name=Match${matchNumber}
echo Renaming bag file to ${bag_name}.bag
cp $var ./bagfiles/${bag_name}.bag
else
echo This does not have match data -- renaming to practice${var}
cp $var ./bagfiles/practice$(basename $var)
fi
#rm temp_file.txt
done