File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,8 @@ def command_line_arguments():
53
53
parser .add_argument (
54
54
"--type" ,
55
55
"-t" ,
56
- help = "Name of the type used to serialize data." ,
56
+ help = "Name of the type used to serialize data. Default is SensorView. " ,
57
57
choices = ["SensorView" , "GroundTruth" , "SensorData" ],
58
- default = "SensorView" ,
59
58
type = str ,
60
59
required = False ,
61
60
)
@@ -122,12 +121,35 @@ def command_line_arguments():
122
121
VALIDATION_RULES = osi_rules .OSIRules ()
123
122
124
123
124
+ def detect_message_type (path : str ):
125
+ """Automatically detect the message type from the file name.
126
+ If it cannot be detected, the function return SensorView as default.
127
+
128
+ Args:
129
+ path (str): Path incl. filename of the trace file
130
+
131
+ Returns:
132
+ Str: Message type as string, e.g. SensorData, SensorView etc.
133
+ """
134
+ filename = os .path .basename (path )
135
+ if filename .find ("_sd_" ) != - 1 :
136
+ return "SensorData"
137
+ if filename .find ("_sv_" ) != - 1 :
138
+ return "SensorView"
139
+ if filename .find ("_gt_" ) != - 1 :
140
+ return "GroundTruth"
141
+ return "SensorView"
142
+
143
+
125
144
def main ():
126
145
"""Main method"""
127
146
128
147
# Handling of command line arguments
129
148
args = command_line_arguments ()
130
149
150
+ if not args .type :
151
+ args .type = detect_message_type (args .data )
152
+
131
153
# Instantiate Logger
132
154
print ("Instantiate logger ..." )
133
155
directory = args .output
You can’t perform that action at this time.
0 commit comments