Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
reindex_active_rosbags Namespace Reference

Functions

def reindex_bag_files (source_folder)
 
def main ()
 

Function Documentation

◆ main()

def reindex_active_rosbags.main ( )

Definition at line 69 of file reindex_active_rosbags.py.

69def main():
70 if len(sys.argv) < 2:
71 print("Need 1 arguments: process_bag.py <path to source folder with .bag.active files> ")
72 exit()
73
74 source_folder = sys.argv[1]
75
76 reindex_bag_files(source_folder)
77
78 return
79
def reindex_bag_files(source_folder)

References main(), and reindex_bag_files().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reindex_bag_files()

def reindex_active_rosbags.reindex_bag_files (   source_folder)

Definition at line 24 of file reindex_active_rosbags.py.

24def reindex_bag_files(source_folder):
25 # List of bag files to re-index
26 # Note: This example list includes .bag.active files from TIM use case testing 5/25-5/27
27 files_to_reindex = ["_2021-05-25-17-47-01.bag.active",
28 "_2021-05-25-17-53-47.bag.active",
29 "_2021-05-25-18-14-12.bag.active",
30 "_2021-05-25-18-19-06.bag.active",
31 "_2021-05-25-18-24-50.bag.active",
32 "_2021-05-25-18-54-32.bag.active",
33 "_2021-05-25-19-06-02.bag.active",
34 "_2021-05-25-19-19-45.bag.active",
35 "_2021-05-25-20-32-22.bag.active",
36 "_2021-05-25-20-49-05.bag.active",
37 "_2021-05-26-13-09-39.bag.active",
38 "_2021-05-26-13-33-10.bag.active",
39 "_2021-05-26-17-26-06.bag.active",
40 "_2021-05-26-19-45-45.bag.active",
41 "_2021-05-27-20-34-31.bag.active"]
42
43 # Logic to re-index bag files
44 for filename in files_to_reindex:
45 print("Reindexing " + str(filename))
46
47 # Issue command to re-index the bag file
48 # References example from https://github.com/bierschi/reindexBags
49 command = "rosbag reindex " + str(filename)
50 reindex_proc = subprocess.Popen(command, stdin=subprocess.PIPE, shell=True, cwd=source_folder,
51 executable='/bin/bash')
52 reindex_proc.wait()
53
54 # If a .orig.active file was created, then the .bag.active file was re-indexed
55 temp_file_name = str(filename[:-7]) + ".orig.active"
56 if (temp_file_name in os.listdir(source_folder)):
57
58 # Not removing the .bag.orig.active file for now, can delete manually afterwards in case the re-indexed file is corrupted
59 #os.remove(temp_file_name)
60
61 # Rename the re-indexed .bag.active to '.bag' only
62 os.rename(filename, filename[:-7])
63
64 # Print finished statement
65 print("Finished re-indexing " + str(filename))
66
67 return
68

Referenced by main().

Here is the caller graph for this function: