AS: adding first phase of orientation
This commit is contained in:
33
ros2_ws/install/py_pubsub/lib/py_pubsub/listener
Executable file
33
ros2_ws/install/py_pubsub/lib/py_pubsub/listener
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'py-pubsub==0.0.0','console_scripts','listener'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'py-pubsub==0.0.0'
|
||||
|
||||
try:
|
||||
from importlib.metadata import distribution
|
||||
except ImportError:
|
||||
try:
|
||||
from importlib_metadata import distribution
|
||||
except ImportError:
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
|
||||
def importlib_load_entry_point(spec, group, name):
|
||||
dist_name, _, _ = spec.partition('==')
|
||||
matches = (
|
||||
entry_point
|
||||
for entry_point in distribution(dist_name).entry_points
|
||||
if entry_point.group == group and entry_point.name == name
|
||||
)
|
||||
return next(matches).load()
|
||||
|
||||
|
||||
globals().setdefault('load_entry_point', importlib_load_entry_point)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(load_entry_point('py-pubsub==0.0.0', 'console_scripts', 'listener')())
|
||||
33
ros2_ws/install/py_pubsub/lib/py_pubsub/talker
Executable file
33
ros2_ws/install/py_pubsub/lib/py_pubsub/talker
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'py-pubsub==0.0.0','console_scripts','talker'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'py-pubsub==0.0.0'
|
||||
|
||||
try:
|
||||
from importlib.metadata import distribution
|
||||
except ImportError:
|
||||
try:
|
||||
from importlib_metadata import distribution
|
||||
except ImportError:
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
|
||||
def importlib_load_entry_point(spec, group, name):
|
||||
dist_name, _, _ = spec.partition('==')
|
||||
matches = (
|
||||
entry_point
|
||||
for entry_point in distribution(dist_name).entry_points
|
||||
if entry_point.group == group and entry_point.name == name
|
||||
)
|
||||
return next(matches).load()
|
||||
|
||||
|
||||
globals().setdefault('load_entry_point', importlib_load_entry_point)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(load_entry_point('py-pubsub==0.0.0', 'console_scripts', 'talker')())
|
||||
@@ -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