AS: adding first phase of orientation
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: py-pubsub
|
||||
Version: 0.0.0
|
||||
Summary: pubsub
|
||||
Home-page: UNKNOWN
|
||||
Maintainer: root
|
||||
Maintainer-email: root@todo.todo
|
||||
License: Apache-2.0
|
||||
Platform: UNKNOWN
|
||||
License-File: LICENSE
|
||||
|
||||
UNKNOWN
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
LICENSE
|
||||
package.xml
|
||||
setup.cfg
|
||||
setup.py
|
||||
../../build/py_pubsub/py_pubsub.egg-info/PKG-INFO
|
||||
../../build/py_pubsub/py_pubsub.egg-info/SOURCES.txt
|
||||
../../build/py_pubsub/py_pubsub.egg-info/dependency_links.txt
|
||||
../../build/py_pubsub/py_pubsub.egg-info/entry_points.txt
|
||||
../../build/py_pubsub/py_pubsub.egg-info/requires.txt
|
||||
../../build/py_pubsub/py_pubsub.egg-info/top_level.txt
|
||||
../../build/py_pubsub/py_pubsub.egg-info/zip-safe
|
||||
py_pubsub/__init__.py
|
||||
py_pubsub/publisher_member_function.py
|
||||
py_pubsub/subscriber_member_function.py
|
||||
resource/py_pubsub
|
||||
test/test_copyright.py
|
||||
test/test_flake8.py
|
||||
test/test_pep257.py
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[console_scripts]
|
||||
listener = py_pubsub.subscriber_member_function:main
|
||||
talker = py_pubsub.publisher_member_function:main
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
setuptools
|
||||
@@ -0,0 +1 @@
|
||||
py_pubsub
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,39 @@
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
|
||||
from tutorial_interfaces.msg import Num
|
||||
|
||||
|
||||
class MinimalPublisher(Node):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('minimal_publisher')
|
||||
self.publisher_ = self.create_publisher(Num, 'topic', 10)
|
||||
timer_period = 0.5 # seconds
|
||||
self.timer = self.create_timer(timer_period, self.timer_callback)
|
||||
self.i = 0
|
||||
|
||||
def timer_callback(self):
|
||||
msg = Num()
|
||||
msg.num = self.i
|
||||
self.publisher_.publish(msg)
|
||||
self.get_logger().info('Publishing: "%s"' % msg.num)
|
||||
self.i += 1
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
minimal_publisher = MinimalPublisher()
|
||||
|
||||
rclpy.spin(minimal_publisher)
|
||||
|
||||
# Destroy the node explicitly
|
||||
# (optional - otherwise it will be done automatically
|
||||
# when the garbage collector destroys the node object)
|
||||
minimal_publisher.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,37 @@
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
|
||||
from tutorial_interfaces.msg import Num
|
||||
|
||||
|
||||
class MinimalSubscriber(Node):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('minimal_subscriber')
|
||||
self.subscription = self.create_subscription(
|
||||
Num,
|
||||
'topic',
|
||||
self.listener_callback,
|
||||
10)
|
||||
self.subscription # prevent unused variable warning
|
||||
|
||||
def listener_callback(self, msg):
|
||||
self.get_logger().info('I heard: "%s"' % msg.num)
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
minimal_subscriber = MinimalSubscriber()
|
||||
|
||||
rclpy.spin(minimal_subscriber)
|
||||
|
||||
# Destroy the node explicitly
|
||||
# (optional - otherwise it will be done automatically
|
||||
# when the garbage collector destroys the node object)
|
||||
minimal_subscriber.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user