Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import rosbag2_transport Python module on demand #190

Merged
merged 2 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ros2bag/ros2bag/verb/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

from ros2bag.verb import VerbExtension

from rosbag2_transport import rosbag2_transport_py


class InfoVerb(VerbExtension):
"""ros2 bag info."""
Expand All @@ -34,5 +32,5 @@ def main(self, *, args): # noqa: D102
bag_file = args.bag_file
if not os.path.exists(bag_file):
return "[ERROR] [ros2bag]: bag file '{}' does not exist!".format(bag_file)

from rosbag2_transport import rosbag2_transport_py
rosbag2_transport_py.info(uri=bag_file, storage_id=args.storage)
3 changes: 1 addition & 2 deletions ros2bag/ros2bag/verb/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from ros2bag.verb import VerbExtension
from ros2cli.node import NODE_NAME_PREFIX
from rosbag2_transport import rosbag2_transport_py


class PlayVerb(VerbExtension):
Expand All @@ -38,7 +37,7 @@ def main(self, *, args): # noqa: D102
bag_file = args.bag_file
if not os.path.exists(bag_file):
return "[ERROR] [ros2bag] bag file '{}' does not exist!".format(bag_file)

from rosbag2_transport import rosbag2_transport_py
rosbag2_transport_py.play(
uri=bag_file,
storage_id=args.storage,
Expand Down
5 changes: 4 additions & 1 deletion ros2bag/ros2bag/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ros2cli.node.strategy import NodeStrategy
from ros2cli.node.strategy import add_arguments
from ros2cli.node import NODE_NAME_PREFIX
from rosbag2_transport import rosbag2_transport_py


class RecordVerb(VerbExtension):
Expand Down Expand Up @@ -73,6 +72,8 @@ def main(self, *, args): # noqa: D102
self.create_bag_directory(uri)

if args.all:
from rosbag2_transport import rosbag2_transport_py

rosbag2_transport_py.record(
uri=uri,
storage_id=args.storage,
Expand All @@ -82,6 +83,8 @@ def main(self, *, args): # noqa: D102
no_discovery=args.no_discovery,
polling_interval=args.polling_interval)
elif args.topics and len(args.topics) > 0:
from rosbag2_transport import rosbag2_transport_py

rosbag2_transport_py.record(
uri=uri,
storage_id=args.storage,
Expand Down