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

Fix import statement and usage for rclpy.node.Node #189

Merged
merged 1 commit into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
import rclpy
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
from rclpy.executors import MultiThreadedExecutor
from rclpy.node import Node
from std_msgs.msg import String


class DoubleTalker(rclpy.Node):
class DoubleTalker(Node):
"""Publish messages to a topic using two publishers at different rates."""

def __init__(self):
Expand Down
7 changes: 4 additions & 3 deletions rclpy/executors/examples_rclpy_executors/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
# limitations under the License.

import rclpy
from rclpy.node import Node
from std_msgs.msg import String


class Listener(rclpy.Node):
class Listener(Node):
"""
A node with a single subscriber.

This class creates a node which prints messages it receives on a topic. Creating a node by
inheriting from rclpy.Node is recommended because it allows it to be imported and used by
inheriting from Node is recommended because it allows it to be imported and used by
other scripts.
"""

def __init__(self):
# Calls rclpy.Node.__init__('listener')
# Calls Node.__init__('listener')
super().__init__('listener')
self.sub = self.create_subscription(String, 'chatter', self.chatter_callback)

Expand Down
7 changes: 4 additions & 3 deletions rclpy/executors/examples_rclpy_executors/talker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
# limitations under the License.

import rclpy
from rclpy.node import Node
from std_msgs.msg import String


class Talker(rclpy.Node):
class Talker(Node):
"""
A node with a single publisher.

This class creates a node which regularly publishes messages on a topic. Creating a node by
inheriting from rclpy.Node is recommended because it allows it to be imported and used by
inheriting from Node is recommended because it allows it to be imported and used by
other scripts.
"""

def __init__(self):
# Calls rclpy.Node.__init__('talker')
# Calls Node.__init__('talker')
super().__init__('talker')
self.i = 0
self.pub = self.create_publisher(String, 'chatter')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
from example_interfaces.srv import AddTwoInts

import rclpy
from rclpy.node import Node


class MinimalClientAsync(rclpy.Node):
class MinimalClientAsync(Node):

def __init__(self):
super().__init__('minimal_client_async')
Expand Down
3 changes: 2 additions & 1 deletion rclpy/services/minimal_service/service_member_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
from example_interfaces.srv import AddTwoInts

import rclpy
from rclpy.node import Node


class MinimalService(rclpy.Node):
class MinimalService(Node):

def __init__(self):
super().__init__('minimal_service')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.

import rclpy
from rclpy.node import Node

from std_msgs.msg import String


class MinimalPublisher(rclpy.Node):
class MinimalPublisher(Node):

def __init__(self):
super().__init__('minimal_publisher')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.

import rclpy
from rclpy.node import Node

from std_msgs.msg import String


class MinimalSubscriber(rclpy.Node):
class MinimalSubscriber(Node):

def __init__(self):
super().__init__('minimal_subscriber')
Expand Down