2 Copyright (c) 2016, Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Marek Felix, Meissner Pascal, Trautmann Jeremias, Wittenbeck Valerij 6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 8 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 10 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 12 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 order = [
"Zustand",
"state",
"ObjectSearchInit",
"DirectSearchInit",
"SearchInit",
"SceneRecognition",
"PosePrediction",
"CropBoxGeneration",
"NBVSetPointCloud",
"GetGoalCameraPose",
"NextBestView",
"GenerateRandomPose",
"MoveBase",
"FakeMoveBase",
"MovePTU",
"PTUPoseCorrection",
"FrustumViz",
"VisualizeWaypoints",
"ObjectDetection",
"NextBestViewUpdate",
"CropboxStateRecording",
"GridInitStateRecording",
"CheckSearchFinished",
"Total",
"MovedDistance"]
22 toRemove = [
"ObjectSearchInit",
"DirectSearchInit",
"SearchInit",
"FrustumViz",
"VisualizeWaypoints",
"CheckSearchFinished",
"Total"]
32 content = [x.strip()
for x
in content]
39 for each
in line.split(
','):
45 newLine +=
"{0:.2f}".format(float(each))
46 if line.startswith(
"MovedDistance")
and countEach >= 2:
52 newContent.append(newLine)
56 for removeLine
in toRemove:
57 if line.startswith(removeLine):
65 if line.startswith(
"Zustand")
or line.startswith(
"state")
or line.startswith(
"MovedDistance")
or line.startswith(
"Total"):
68 eachs = line.split(
',')
69 totalSum += float(eachs[2])
71 return "Total,-," +
"{0:.2f}".format(totalSum / 60.0) +
" min,-\n" 74 with open(file,
'r') as f: 75 content = f.readlines() 78 content = [line for line
in content
if not isToRemove(line)]
82 for newOrder
in order:
84 if line.startswith(newOrder):
85 reorderedContent.append(line)
90 for reordereLine
in reorderedContent:
91 if line == reordereLine:
95 print (
"Unknown, will be append to end: %s" % line)
96 reorderedContent.append(line)
98 with open(file,
'w')
as f:
99 for line
in reorderedContent:
103 for root, dirs, files
in os.walk(path):
105 if ".csv" in name
and "mean" in name:
108 if __name__ ==
'__main__':
109 print "This tool will reorder the states of the generated logs by analysis.py, according to the order in the script. Furthermore, some states will be deleted, a state for total will be added and all values will be rounded to two digits." 110 print "Enter the path to the top log folder" 111 path = str(raw_input(
"Enter path: "))
def roundAllValues(content)
def calculateTotal(content)