Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
jazzy

Package Summary

Tags No category tags.
Version 0.4.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

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

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
kilted

Package Summary

Tags No category tags.
Version 0.4.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

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

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
rolling

Package Summary

Tags No category tags.
Version 0.4.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

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

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro ardent showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro bouncy showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro crystal showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro eloquent showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro dashing showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro galactic showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro foxy showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
iron

Package Summary

Tags No category tags.
Version 0.3.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro lunar showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro jade showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro indigo showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro hydro showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro kinetic showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro melodic showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange

No version for distro noetic showing humble. Known supported distros are highlighted in the buttons above.
Package symbol

classic_bags package from classic_bags repo

classic_bags

ROS Distro
humble

Package Summary

Tags No category tags.
Version 0.2.0
License BSD 3-clause
Build type AMENT_CMAKE
Use RECOMMENDED

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
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

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

Additional Links

No additional links.

Maintainers

  • David V. Lu!!

Authors

No additional authors.

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

CHANGELOG

Changelog for package classic_bags

0.1.0 (2023-08-09)

  • Initial package
  • Contributors: David V. Lu!!

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged classic_bags at Robotics Stack Exchange