Repo symbol

classic_bags repository

classic_bags

Repository Summary

Checkout URI https://github.com/MetroRobots/classic_bags.git
VCS Type git
VCS Version humble
Last Updated 2024-07-11
Dev Status DEVELOPED
Released RELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
classic_bags 0.2.0

README

classic_bags

Simplified ROS 2 interface in the style of ROS 1 for reading and writing bag files

Reading Python

ROS 1 Code

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

ROS 2 Code

import classic_bags
bag = classic_bags.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
# bag.close() Closing bag is not necessary

Writing Python

ROS 1 Code

import rosbag
from std_msgs.msg import Int32, String

bag = rosbag.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()

ROS 2 Code

import classic_bags
from std_msgs.msg import Int32, String

bag = classic_bags.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()  # Closing is not strictly necessary

Alternate ROS 2 Code

import classic_bags
from std_msgs.msg import String
import rclpy.time
import builtin_interfaces.msg


with classic_bags.Bag('test.bag', 'w') as bag:
    s = String()
    s.data = 'foo'

    # The third argument of the write method is the timestamp

    # Floats are interpreted as seconds since epoch
    bag.write('chatter', s, 456606000.5)

    # Ints are interpreted as nanoseconds since epoch
    bag.write('chatter', s, 456606000600000000)

    # You can also use rclpy.time.Time
    pytime = rclpy.time.Time(seconds=456606000, nanoseconds=700000000)
    bag.write('chatter', s, pytime)

    # Or a timestamp from a message
    msgtime = builtin_interfaces.msg.Time()
    msgtime.sec = 456606000
    msgtime.nanosec = 800000000
    bag.write('chatter', s, msgtime)

    # If none is specified, the system time will be used
    bag.write('chatter', s)

File truncated at 100 lines see the full file

Repo symbol

classic_bags repository

classic_bags

Repository Summary

Checkout URI https://github.com/MetroRobots/classic_bags.git
VCS Type git
VCS Version main
Last Updated 2025-07-08
Dev Status DEVELOPED
Released RELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
classic_bags 0.4.0

README

classic_bags

Simplified ROS 2 interface in the style of ROS 1 for reading and writing bag files

Reading Python

ROS 1 Code

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

ROS 2 Code

import classic_bags
bag = classic_bags.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
# bag.close() Closing bag is not necessary

Writing Python

ROS 1 Code

import rosbag
from std_msgs.msg import Int32, String

bag = rosbag.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()

ROS 2 Code

import classic_bags
from std_msgs.msg import Int32, String

bag = classic_bags.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()  # Closing is not strictly necessary

Alternate ROS 2 Code

import classic_bags
from std_msgs.msg import String
import rclpy.time
import builtin_interfaces.msg


with classic_bags.Bag('test.bag', 'w') as bag:
    s = String()
    s.data = 'foo'

    # The third argument of the write method is the timestamp

    # Floats are interpreted as seconds since epoch
    bag.write('chatter', s, 456606000.5)

    # Ints are interpreted as nanoseconds since epoch
    bag.write('chatter', s, 456606000600000000)

    # You can also use rclpy.time.Time
    pytime = rclpy.time.Time(seconds=456606000, nanoseconds=700000000)
    bag.write('chatter', s, pytime)

    # Or a timestamp from a message
    msgtime = builtin_interfaces.msg.Time()
    msgtime.sec = 456606000
    msgtime.nanosec = 800000000
    bag.write('chatter', s, msgtime)

    # If none is specified, the system time will be used
    bag.write('chatter', s)

File truncated at 100 lines see the full file

Repo symbol

classic_bags repository

classic_bags

Repository Summary

Checkout URI https://github.com/MetroRobots/classic_bags.git
VCS Type git
VCS Version main
Last Updated 2025-07-08
Dev Status DEVELOPED
Released RELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
classic_bags 0.4.0

README

classic_bags

Simplified ROS 2 interface in the style of ROS 1 for reading and writing bag files

Reading Python

ROS 1 Code

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

ROS 2 Code

import classic_bags
bag = classic_bags.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
# bag.close() Closing bag is not necessary

Writing Python

ROS 1 Code

import rosbag
from std_msgs.msg import Int32, String

bag = rosbag.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()

ROS 2 Code

import classic_bags
from std_msgs.msg import Int32, String

bag = classic_bags.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()  # Closing is not strictly necessary

Alternate ROS 2 Code

import classic_bags
from std_msgs.msg import String
import rclpy.time
import builtin_interfaces.msg


with classic_bags.Bag('test.bag', 'w') as bag:
    s = String()
    s.data = 'foo'

    # The third argument of the write method is the timestamp

    # Floats are interpreted as seconds since epoch
    bag.write('chatter', s, 456606000.5)

    # Ints are interpreted as nanoseconds since epoch
    bag.write('chatter', s, 456606000600000000)

    # You can also use rclpy.time.Time
    pytime = rclpy.time.Time(seconds=456606000, nanoseconds=700000000)
    bag.write('chatter', s, pytime)

    # Or a timestamp from a message
    msgtime = builtin_interfaces.msg.Time()
    msgtime.sec = 456606000
    msgtime.nanosec = 800000000
    bag.write('chatter', s, msgtime)

    # If none is specified, the system time will be used
    bag.write('chatter', s)

File truncated at 100 lines see the full file

Repo symbol

classic_bags repository

classic_bags

Repository Summary

Checkout URI https://github.com/MetroRobots/classic_bags.git
VCS Type git
VCS Version main
Last Updated 2025-07-08
Dev Status DEVELOPED
Released RELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
classic_bags 0.4.0

README

classic_bags

Simplified ROS 2 interface in the style of ROS 1 for reading and writing bag files

Reading Python

ROS 1 Code

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

ROS 2 Code

import classic_bags
bag = classic_bags.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
# bag.close() Closing bag is not necessary

Writing Python

ROS 1 Code

import rosbag
from std_msgs.msg import Int32, String

bag = rosbag.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()

ROS 2 Code

import classic_bags
from std_msgs.msg import Int32, String

bag = classic_bags.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()  # Closing is not strictly necessary

Alternate ROS 2 Code

import classic_bags
from std_msgs.msg import String
import rclpy.time
import builtin_interfaces.msg


with classic_bags.Bag('test.bag', 'w') as bag:
    s = String()
    s.data = 'foo'

    # The third argument of the write method is the timestamp

    # Floats are interpreted as seconds since epoch
    bag.write('chatter', s, 456606000.5)

    # Ints are interpreted as nanoseconds since epoch
    bag.write('chatter', s, 456606000600000000)

    # You can also use rclpy.time.Time
    pytime = rclpy.time.Time(seconds=456606000, nanoseconds=700000000)
    bag.write('chatter', s, pytime)

    # Or a timestamp from a message
    msgtime = builtin_interfaces.msg.Time()
    msgtime.sec = 456606000
    msgtime.nanosec = 800000000
    bag.write('chatter', s, msgtime)

    # If none is specified, the system time will be used
    bag.write('chatter', s)

File truncated at 100 lines see the full file

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

classic_bags

Repository Summary

Checkout URI https://github.com/MetroRobots/classic_bags.git
VCS Type git
VCS Version iron
Last Updated 2024-07-11
Dev Status DEVELOPED
Released RELEASED
Tags No category tags.
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
classic_bags 0.3.0

README

classic_bags

Simplified ROS 2 interface in the style of ROS 1 for reading and writing bag files

Reading Python

ROS 1 Code

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

ROS 2 Code

import classic_bags
bag = classic_bags.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
# bag.close() Closing bag is not necessary

Writing Python

ROS 1 Code

import rosbag
from std_msgs.msg import Int32, String

bag = rosbag.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()

ROS 2 Code

import classic_bags
from std_msgs.msg import Int32, String

bag = classic_bags.Bag('test.bag', 'w')

try:
    s = String()
    s.data = 'foo'

    i = Int32()
    i.data = 42

    bag.write('chatter', s)
    bag.write('numbers', i)
finally:
    bag.close()  # Closing is not strictly necessary

Alternate ROS 2 Code

import classic_bags
from std_msgs.msg import String
import rclpy.time
import builtin_interfaces.msg


with classic_bags.Bag('test.bag', 'w') as bag:
    s = String()
    s.data = 'foo'

    # The third argument of the write method is the timestamp

    # Floats are interpreted as seconds since epoch
    bag.write('chatter', s, 456606000.5)

    # Ints are interpreted as nanoseconds since epoch
    bag.write('chatter', s, 456606000600000000)

    # You can also use rclpy.time.Time
    pytime = rclpy.time.Time(seconds=456606000, nanoseconds=700000000)
    bag.write('chatter', s, pytime)

    # Or a timestamp from a message
    msgtime = builtin_interfaces.msg.Time()
    msgtime.sec = 456606000
    msgtime.nanosec = 800000000
    bag.write('chatter', s, msgtime)

    # If none is specified, the system time will be used
    bag.write('chatter', s)

File truncated at 100 lines see the full file

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository

Repo symbol

classic_bags repository