AS: adding first phase of orientation

This commit is contained in:
Alexander Schaefer
2025-01-29 09:58:44 +00:00
parent 79001dc331
commit 45650caa1b
5106 changed files with 582827 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-service==0.15.3','console_scripts','service'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'examples-rclpy-minimal-service==0.15.3'
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('examples-rclpy-minimal-service==0.15.3', 'console_scripts', 'service')())

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-service==0.15.3','console_scripts','service_member_function'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'examples-rclpy-minimal-service==0.15.3'
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('examples-rclpy-minimal-service==0.15.3', 'console_scripts', 'service_member_function')())

View File

@@ -0,0 +1,19 @@
Metadata-Version: 2.1
Name: examples-rclpy-minimal-service
Version: 0.15.3
Summary: Examples of minimal service servers using rclpy.
Home-page: UNKNOWN
Author: Mikael Arguedas
Author-email: mikael@osrfoundation.org
Maintainer: Aditya Pande, Shane Loretz
Maintainer-email: aditya.pande@openrobotics.org, shane@openrobotics.org
License: Apache License, Version 2.0
Keywords: ROS
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development
UNKNOWN

View File

@@ -0,0 +1,18 @@
README.md
package.xml
setup.cfg
setup.py
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/PKG-INFO
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/SOURCES.txt
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/dependency_links.txt
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/entry_points.txt
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/requires.txt
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/top_level.txt
../../../../../build/examples_rclpy_minimal_service/examples_rclpy_minimal_service.egg-info/zip-safe
examples_rclpy_minimal_service/__init__.py
examples_rclpy_minimal_service/service.py
examples_rclpy_minimal_service/service_member_function.py
resource/examples_rclpy_minimal_service
test/test_copyright.py
test/test_flake8.py
test/test_pep257.py

View File

@@ -0,0 +1,4 @@
[console_scripts]
service = examples_rclpy_minimal_service.service:main
service_member_function = examples_rclpy_minimal_service.service_member_function:main

View File

@@ -0,0 +1,49 @@
# Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from example_interfaces.srv import AddTwoInts
import rclpy
g_node = None
def add_two_ints_callback(request, response):
global g_node
response.sum = request.a + request.b
g_node.get_logger().info(
'Incoming request\na: %d b: %d' % (request.a, request.b))
return response
def main(args=None):
global g_node
rclpy.init(args=args)
g_node = rclpy.create_node('minimal_service')
srv = g_node.create_service(AddTwoInts, 'add_two_ints', add_two_ints_callback)
while rclpy.ok():
rclpy.spin_once(g_node)
# Destroy the service attached to the node explicitly
# (optional - otherwise it will be done automatically
# when the garbage collector destroys the node object)
g_node.destroy_service(srv)
rclpy.shutdown()
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,45 @@
# Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from example_interfaces.srv import AddTwoInts
import rclpy
from rclpy.node import Node
class MinimalService(Node):
def __init__(self):
super().__init__('minimal_service')
self.srv = self.create_service(AddTwoInts, 'add_two_ints', self.add_two_ints_callback)
def add_two_ints_callback(self, request, response):
response.sum = request.a + request.b
self.get_logger().info('Incoming request\na: %d b: %d' % (request.a, request.b))
return response
def main(args=None):
rclpy.init(args=args)
minimal_service = MinimalService()
rclpy.spin(minimal_service)
rclpy.shutdown()
if __name__ == '__main__':
main()