Rename rosbag1 connection cid to id
This commit is contained in:
@@ -106,13 +106,13 @@ def convert_1to2(src: Path, dst: Path) -> None:
|
||||
candidate = upgrade_connection(rconn)
|
||||
existing = next((x for x in writer.connections.values() if x == candidate), None)
|
||||
wconn = existing if existing else writer.add_connection(**asdict(candidate))
|
||||
connmap[rconn.cid] = wconn
|
||||
connmap[rconn.id] = wconn
|
||||
typs.update(get_types_from_msg(rconn.msgdef, rconn.msgtype))
|
||||
register_types(typs)
|
||||
|
||||
for rconn, timestamp, data in reader.messages():
|
||||
data = ros1_to_cdr(data, rconn.msgtype)
|
||||
writer.write(connmap[rconn.cid], timestamp, data)
|
||||
writer.write(connmap[rconn.id], timestamp, data)
|
||||
|
||||
|
||||
def convert_2to1(src: Path, dst: Path) -> None:
|
||||
|
||||
@@ -53,7 +53,7 @@ class RecordType(IntEnum):
|
||||
class Connection(NamedTuple):
|
||||
"""Connection information."""
|
||||
|
||||
cid: int
|
||||
id: int
|
||||
topic: str
|
||||
msgtype: str
|
||||
msgdef: str
|
||||
@@ -436,7 +436,7 @@ class Reader:
|
||||
count = reduce(
|
||||
lambda x, y: x + y,
|
||||
(
|
||||
y.connection_counts.get(x.cid, 0)
|
||||
y.connection_counts.get(x.id, 0)
|
||||
for x in connections
|
||||
for y in self.chunk_infos
|
||||
),
|
||||
@@ -607,7 +607,7 @@ class Reader:
|
||||
if not connections:
|
||||
connections = self.connections.values()
|
||||
|
||||
indexes = [self.indexes[x.cid] for x in connections]
|
||||
indexes = [self.indexes[x.id] for x in connections]
|
||||
for entry in heapq.merge(*indexes):
|
||||
if start and entry.time < start:
|
||||
continue
|
||||
|
||||
@@ -261,7 +261,7 @@ class Writer:
|
||||
bio = self.chunks[-1].data
|
||||
self.write_connection(connection, bio)
|
||||
|
||||
self.connections[connection.cid] = connection
|
||||
self.connections[connection.id] = connection
|
||||
return connection
|
||||
|
||||
def write(self, connection: Connection, timestamp: int, data: bytes) -> None:
|
||||
@@ -283,7 +283,7 @@ class Writer:
|
||||
raise WriterError(f'There is no connection {connection!r}.') from None
|
||||
|
||||
chunk = self.chunks[-1]
|
||||
chunk.connections[connection.cid].append((timestamp, chunk.data.tell()))
|
||||
chunk.connections[connection.id].append((timestamp, chunk.data.tell()))
|
||||
|
||||
if timestamp < chunk.start:
|
||||
chunk.start = timestamp
|
||||
@@ -292,7 +292,7 @@ class Writer:
|
||||
chunk.end = timestamp
|
||||
|
||||
header = Header()
|
||||
header.set_uint32('conn', connection.cid)
|
||||
header.set_uint32('conn', connection.id)
|
||||
header.set_time('time', timestamp)
|
||||
|
||||
header.write(chunk.data, RecordType.MSGDATA)
|
||||
@@ -305,7 +305,7 @@ class Writer:
|
||||
def write_connection(connection: Connection, bio: BinaryIO) -> None:
|
||||
"""Write connection record."""
|
||||
header = Header()
|
||||
header.set_uint32('conn', connection.cid)
|
||||
header.set_uint32('conn', connection.id)
|
||||
header.set_string('topic', connection.topic)
|
||||
header.write(bio, RecordType.CONNECTION)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user