AS: adding first phase of orientation
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-action-client==0.15.3','console_scripts','client'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'examples-rclpy-minimal-action-client==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-action-client==0.15.3', 'console_scripts', 'client')())
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-action-client==0.15.3','console_scripts','client_asyncio'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'examples-rclpy-minimal-action-client==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-action-client==0.15.3', 'console_scripts', 'client_asyncio')())
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-action-client==0.15.3','console_scripts','client_cancel'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'examples-rclpy-minimal-action-client==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-action-client==0.15.3', 'console_scripts', 'client_cancel')())
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-minimal-action-client==0.15.3','console_scripts','client_not_composable'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'examples-rclpy-minimal-action-client==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-action-client==0.15.3', 'console_scripts', 'client_not_composable')())
|
||||
@@ -0,0 +1,19 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: examples-rclpy-minimal-action-client
|
||||
Version: 0.15.3
|
||||
Summary: Examples of action clients using rclpy.
|
||||
Home-page: UNKNOWN
|
||||
Author: Jacob Perron
|
||||
Author-email: jacob@openrobotics.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
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package.xml
|
||||
setup.cfg
|
||||
setup.py
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/PKG-INFO
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/SOURCES.txt
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/dependency_links.txt
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/entry_points.txt
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/requires.txt
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/top_level.txt
|
||||
../../../../../build/examples_rclpy_minimal_action_client/examples_rclpy_minimal_action_client.egg-info/zip-safe
|
||||
examples_rclpy_minimal_action_client/__init__.py
|
||||
examples_rclpy_minimal_action_client/client.py
|
||||
examples_rclpy_minimal_action_client/client_asyncio.py
|
||||
examples_rclpy_minimal_action_client/client_cancel.py
|
||||
examples_rclpy_minimal_action_client/client_not_composable.py
|
||||
resource/examples_rclpy_minimal_action_client
|
||||
test/test_copyright.py
|
||||
test/test_flake8.py
|
||||
test/test_pep257.py
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[console_scripts]
|
||||
client = examples_rclpy_minimal_action_client.client:main
|
||||
client_asyncio = examples_rclpy_minimal_action_client.client_asyncio:main
|
||||
client_cancel = examples_rclpy_minimal_action_client.client_cancel:main
|
||||
client_not_composable = examples_rclpy_minimal_action_client.client_not_composable:main
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
setuptools
|
||||
@@ -0,0 +1 @@
|
||||
examples_rclpy_minimal_action_client
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
# Copyright 2018 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 action_msgs.msg import GoalStatus
|
||||
from example_interfaces.action import Fibonacci
|
||||
|
||||
import rclpy
|
||||
from rclpy.action import ActionClient
|
||||
from rclpy.node import Node
|
||||
|
||||
|
||||
class MinimalActionClient(Node):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('minimal_action_client')
|
||||
self._action_client = ActionClient(self, Fibonacci, 'fibonacci')
|
||||
|
||||
def goal_response_callback(self, future):
|
||||
goal_handle = future.result()
|
||||
if not goal_handle.accepted:
|
||||
self.get_logger().info('Goal rejected :(')
|
||||
return
|
||||
|
||||
self.get_logger().info('Goal accepted :)')
|
||||
|
||||
self._get_result_future = goal_handle.get_result_async()
|
||||
self._get_result_future.add_done_callback(self.get_result_callback)
|
||||
|
||||
def feedback_callback(self, feedback):
|
||||
self.get_logger().info('Received feedback: {0}'.format(feedback.feedback.sequence))
|
||||
|
||||
def get_result_callback(self, future):
|
||||
result = future.result().result
|
||||
status = future.result().status
|
||||
if status == GoalStatus.STATUS_SUCCEEDED:
|
||||
self.get_logger().info('Goal succeeded! Result: {0}'.format(result.sequence))
|
||||
else:
|
||||
self.get_logger().info('Goal failed with status: {0}'.format(status))
|
||||
|
||||
# Shutdown after receiving a result
|
||||
rclpy.shutdown()
|
||||
|
||||
def send_goal(self):
|
||||
self.get_logger().info('Waiting for action server...')
|
||||
self._action_client.wait_for_server()
|
||||
|
||||
goal_msg = Fibonacci.Goal()
|
||||
goal_msg.order = 10
|
||||
|
||||
self.get_logger().info('Sending goal request...')
|
||||
|
||||
self._send_goal_future = self._action_client.send_goal_async(
|
||||
goal_msg,
|
||||
feedback_callback=self.feedback_callback)
|
||||
|
||||
self._send_goal_future.add_done_callback(self.goal_response_callback)
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
action_client = MinimalActionClient()
|
||||
|
||||
action_client.send_goal()
|
||||
|
||||
rclpy.spin(action_client)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,117 @@
|
||||
# Copyright 2021 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.
|
||||
|
||||
import asyncio
|
||||
|
||||
from action_msgs.msg import GoalStatus
|
||||
from example_interfaces.action import Fibonacci
|
||||
|
||||
import rclpy
|
||||
from rclpy.action import ActionClient
|
||||
from rclpy.node import Node
|
||||
|
||||
|
||||
class MinimalActionClientAsyncIO(Node):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('minimal_action_client_asyncio')
|
||||
self._action_client = ActionClient(self, Fibonacci, 'fibonacci')
|
||||
|
||||
def feedback_callback(self, feedback):
|
||||
self.get_logger().info('Received feedback: {0}'.format(feedback.feedback.sequence))
|
||||
|
||||
async def send_goal(self):
|
||||
self.get_logger().info('Waiting for action server...')
|
||||
self._action_client.wait_for_server()
|
||||
|
||||
goal_msg = Fibonacci.Goal()
|
||||
goal_msg.order = 10
|
||||
|
||||
self.get_logger().info('Sending goal request...')
|
||||
|
||||
goal_handle = await self._action_client.send_goal_async(
|
||||
goal_msg,
|
||||
feedback_callback=self.feedback_callback
|
||||
)
|
||||
|
||||
if not goal_handle.accepted:
|
||||
self.get_logger().info('Goal rejected :(')
|
||||
return
|
||||
|
||||
self.get_logger().info('Goal accepted :)')
|
||||
|
||||
res = await goal_handle.get_result_async()
|
||||
result = res.result
|
||||
status = res.status
|
||||
if status == GoalStatus.STATUS_SUCCEEDED:
|
||||
self.get_logger().info('Goal succeeded! Result: {0}'.format(result.sequence))
|
||||
else:
|
||||
self.get_logger().info('Goal failed with status: {0}'.format(status))
|
||||
return result, status
|
||||
|
||||
|
||||
async def spinning(node):
|
||||
while rclpy.ok():
|
||||
rclpy.spin_once(node, timeout_sec=0.01)
|
||||
await asyncio.sleep(0.001)
|
||||
|
||||
|
||||
async def run(args, loop):
|
||||
|
||||
logger = rclpy.logging.get_logger('minimal_action_client')
|
||||
|
||||
# init ros2
|
||||
rclpy.init(args=args)
|
||||
|
||||
# create node
|
||||
action_client = MinimalActionClientAsyncIO()
|
||||
|
||||
# start spinning
|
||||
spin_task = loop.create_task(spinning(action_client))
|
||||
|
||||
# Parallel example
|
||||
# execute goal request and schedule in loop
|
||||
my_task1 = loop.create_task(action_client.send_goal())
|
||||
my_task2 = loop.create_task(action_client.send_goal())
|
||||
|
||||
# glue futures together and wait
|
||||
wait_future = asyncio.wait([my_task1, my_task2])
|
||||
# run event loop
|
||||
finished, unfinished = await wait_future
|
||||
logger.info(f'unfinished: {len(unfinished)}')
|
||||
for task in finished:
|
||||
logger.info('result {} and status flag {}'.format(*task.result()))
|
||||
|
||||
# Sequence
|
||||
result, status = await loop.create_task(action_client.send_goal())
|
||||
logger.info(f'A) result {result} and status flag {status}')
|
||||
result, status = await loop.create_task(action_client.send_goal())
|
||||
logger.info(f'B) result {result} and status flag {status}')
|
||||
|
||||
# cancel spinning task
|
||||
spin_task.cancel()
|
||||
try:
|
||||
await spin_task
|
||||
except asyncio.exceptions.CancelledError:
|
||||
pass
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
def main(args=None):
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(run(args, loop=loop))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,89 @@
|
||||
# Copyright 2019 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.action import Fibonacci
|
||||
|
||||
import rclpy
|
||||
from rclpy.action import ActionClient
|
||||
from rclpy.node import Node
|
||||
|
||||
|
||||
class MinimalActionClient(Node):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__('minimal_action_client')
|
||||
self._action_client = ActionClient(self, Fibonacci, 'fibonacci')
|
||||
|
||||
def cancel_done(self, future):
|
||||
cancel_response = future.result()
|
||||
if len(cancel_response.goals_canceling) > 0:
|
||||
self.get_logger().info('Goal successfully canceled')
|
||||
else:
|
||||
self.get_logger().info('Goal failed to cancel')
|
||||
|
||||
rclpy.shutdown()
|
||||
|
||||
def goal_response_callback(self, future):
|
||||
goal_handle = future.result()
|
||||
if not goal_handle.accepted:
|
||||
self.get_logger().info('Goal rejected :(')
|
||||
return
|
||||
|
||||
self._goal_handle = goal_handle
|
||||
|
||||
self.get_logger().info('Goal accepted :)')
|
||||
|
||||
# Start a 2 second timer
|
||||
self._timer = self.create_timer(2.0, self.timer_callback)
|
||||
|
||||
def feedback_callback(self, feedback):
|
||||
self.get_logger().info('Received feedback: {0}'.format(feedback.feedback.sequence))
|
||||
|
||||
def timer_callback(self):
|
||||
self.get_logger().info('Canceling goal')
|
||||
# Cancel the goal
|
||||
future = self._goal_handle.cancel_goal_async()
|
||||
future.add_done_callback(self.cancel_done)
|
||||
|
||||
# Cancel the timer
|
||||
self._timer.cancel()
|
||||
|
||||
def send_goal(self):
|
||||
self.get_logger().info('Waiting for action server...')
|
||||
self._action_client.wait_for_server()
|
||||
|
||||
goal_msg = Fibonacci.Goal()
|
||||
goal_msg.order = 10
|
||||
|
||||
self.get_logger().info('Sending goal request...')
|
||||
|
||||
self._send_goal_future = self._action_client.send_goal_async(
|
||||
goal_msg,
|
||||
feedback_callback=self.feedback_callback)
|
||||
|
||||
self._send_goal_future.add_done_callback(self.goal_response_callback)
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
action_client = MinimalActionClient()
|
||||
|
||||
action_client.send_goal()
|
||||
|
||||
rclpy.spin(action_client)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,77 @@
|
||||
# Copyright 2019 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 action_msgs.msg import GoalStatus
|
||||
|
||||
from example_interfaces.action import Fibonacci
|
||||
|
||||
import rclpy
|
||||
from rclpy.action import ActionClient
|
||||
|
||||
|
||||
def feedback_cb(logger, feedback):
|
||||
logger.info('Received feedback: {0}'.format(feedback.feedback.sequence))
|
||||
|
||||
|
||||
def main(args=None):
|
||||
rclpy.init(args=args)
|
||||
|
||||
node = rclpy.create_node('minimal_action_client')
|
||||
|
||||
action_client = ActionClient(node, Fibonacci, 'fibonacci')
|
||||
|
||||
node.get_logger().info('Waiting for action server...')
|
||||
|
||||
action_client.wait_for_server()
|
||||
|
||||
goal_msg = Fibonacci.Goal()
|
||||
goal_msg.order = 10
|
||||
|
||||
node.get_logger().info('Sending goal request...')
|
||||
|
||||
send_goal_future = action_client.send_goal_async(
|
||||
goal_msg, feedback_callback=lambda feedback: feedback_cb(node.get_logger(), feedback))
|
||||
|
||||
rclpy.spin_until_future_complete(node, send_goal_future)
|
||||
|
||||
goal_handle = send_goal_future.result()
|
||||
|
||||
if not goal_handle.accepted:
|
||||
node.get_logger().info('Goal rejected :(')
|
||||
action_client.destroy()
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
return
|
||||
|
||||
node.get_logger().info('Goal accepted :)')
|
||||
|
||||
get_result_future = goal_handle.get_result_async()
|
||||
|
||||
rclpy.spin_until_future_complete(node, get_result_future)
|
||||
|
||||
result = get_result_future.result().result
|
||||
status = get_result_future.result().status
|
||||
if status == GoalStatus.STATUS_SUCCEEDED:
|
||||
node.get_logger().info(
|
||||
'Goal succeeded! Result: {0}'.format(result.sequence))
|
||||
else:
|
||||
node.get_logger().info('Goal failed with status code: {0}'.format(status))
|
||||
|
||||
action_client.destroy()
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1 @@
|
||||
example_interfaces:rclpy
|
||||
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;AMENT_PREFIX_PATH;
|
||||
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||
|
||||
colcon_prepend_unique_value AMENT_PREFIX_PATH "$env:COLCON_CURRENT_PREFIX"
|
||||
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||
|
||||
_colcon_prepend_unique_value AMENT_PREFIX_PATH "$COLCON_CURRENT_PREFIX"
|
||||
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;PYTHONPATH;lib/python3.10/site-packages
|
||||
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||
|
||||
colcon_prepend_unique_value PYTHONPATH "$env:COLCON_CURRENT_PREFIX\lib/python3.10/site-packages"
|
||||
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_core/shell/template/hook_prepend_value.sh.em
|
||||
|
||||
_colcon_prepend_unique_value PYTHONPATH "$COLCON_CURRENT_PREFIX/lib/python3.10/site-packages"
|
||||
@@ -0,0 +1,31 @@
|
||||
# generated from colcon_bash/shell/template/package.bash.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# a bash script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
_colcon_package_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_package_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_bash_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source sh script of this package
|
||||
_colcon_package_bash_source_script "$_colcon_package_bash_COLCON_CURRENT_PREFIX/share/examples_rclpy_minimal_action_client/package.sh"
|
||||
|
||||
unset _colcon_package_bash_source_script
|
||||
unset _colcon_package_bash_COLCON_CURRENT_PREFIX
|
||||
@@ -0,0 +1,6 @@
|
||||
source;share/examples_rclpy_minimal_action_client/hook/pythonpath.ps1
|
||||
source;share/examples_rclpy_minimal_action_client/hook/pythonpath.dsv
|
||||
source;share/examples_rclpy_minimal_action_client/hook/pythonpath.sh
|
||||
source;share/examples_rclpy_minimal_action_client/hook/ament_prefix_path.ps1
|
||||
source;share/examples_rclpy_minimal_action_client/hook/ament_prefix_path.dsv
|
||||
source;share/examples_rclpy_minimal_action_client/hook/ament_prefix_path.sh
|
||||
@@ -0,0 +1,116 @@
|
||||
# generated from colcon_powershell/shell/template/package.ps1.em
|
||||
|
||||
# function to append a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as leading separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
function colcon_append_unique_value {
|
||||
param (
|
||||
$_listname,
|
||||
$_value
|
||||
)
|
||||
|
||||
# get values from variable
|
||||
if (Test-Path Env:$_listname) {
|
||||
$_values=(Get-Item env:$_listname).Value
|
||||
} else {
|
||||
$_values=""
|
||||
}
|
||||
$_duplicate=""
|
||||
# start with no values
|
||||
$_all_values=""
|
||||
# iterate over existing values in the variable
|
||||
if ($_values) {
|
||||
$_values.Split(";") | ForEach {
|
||||
# not an empty string
|
||||
if ($_) {
|
||||
# not a duplicate of _value
|
||||
if ($_ -eq $_value) {
|
||||
$_duplicate="1"
|
||||
}
|
||||
if ($_all_values) {
|
||||
$_all_values="${_all_values};$_"
|
||||
} else {
|
||||
$_all_values="$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# append only non-duplicates
|
||||
if (!$_duplicate) {
|
||||
# avoid leading separator
|
||||
if ($_all_values) {
|
||||
$_all_values="${_all_values};${_value}"
|
||||
} else {
|
||||
$_all_values="${_value}"
|
||||
}
|
||||
}
|
||||
|
||||
# export the updated variable
|
||||
Set-Item env:\$_listname -Value "$_all_values"
|
||||
}
|
||||
|
||||
# function to prepend a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as trailing separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
function colcon_prepend_unique_value {
|
||||
param (
|
||||
$_listname,
|
||||
$_value
|
||||
)
|
||||
|
||||
# get values from variable
|
||||
if (Test-Path Env:$_listname) {
|
||||
$_values=(Get-Item env:$_listname).Value
|
||||
} else {
|
||||
$_values=""
|
||||
}
|
||||
# start with the new value
|
||||
$_all_values="$_value"
|
||||
# iterate over existing values in the variable
|
||||
if ($_values) {
|
||||
$_values.Split(";") | ForEach {
|
||||
# not an empty string
|
||||
if ($_) {
|
||||
# not a duplicate of _value
|
||||
if ($_ -ne $_value) {
|
||||
# keep non-duplicate values
|
||||
$_all_values="${_all_values};$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# export the updated variable
|
||||
Set-Item env:\$_listname -Value "$_all_values"
|
||||
}
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
function colcon_package_source_powershell_script {
|
||||
param (
|
||||
$_colcon_package_source_powershell_script
|
||||
)
|
||||
# source script with conditional trace output
|
||||
if (Test-Path $_colcon_package_source_powershell_script) {
|
||||
if ($env:COLCON_TRACE) {
|
||||
echo ". '$_colcon_package_source_powershell_script'"
|
||||
}
|
||||
. "$_colcon_package_source_powershell_script"
|
||||
} else {
|
||||
Write-Error "not found: '$_colcon_package_source_powershell_script'"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# a powershell script is able to determine its own path
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
$env:COLCON_CURRENT_PREFIX=(Get-Item $PSCommandPath).Directory.Parent.Parent.FullName
|
||||
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/examples_rclpy_minimal_action_client/hook/pythonpath.ps1"
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/examples_rclpy_minimal_action_client/hook/ament_prefix_path.ps1"
|
||||
|
||||
Remove-Item Env:\COLCON_CURRENT_PREFIX
|
||||
@@ -0,0 +1,87 @@
|
||||
# generated from colcon_core/shell/template/package.sh.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# function to prepend a value to a variable
|
||||
# which uses colons as separators
|
||||
# duplicates as well as trailing separators are avoided
|
||||
# first argument: the name of the result variable
|
||||
# second argument: the value to be prepended
|
||||
_colcon_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
|
||||
# get values from variable
|
||||
eval _values=\"\$$_listname\"
|
||||
# backup the field separator
|
||||
_colcon_prepend_unique_value_IFS=$IFS
|
||||
IFS=":"
|
||||
# start with the new value
|
||||
_all_values="$_value"
|
||||
# workaround SH_WORD_SPLIT not being set in zsh
|
||||
if [ "$(command -v colcon_zsh_convert_to_array)" ]; then
|
||||
colcon_zsh_convert_to_array _values
|
||||
fi
|
||||
# iterate over existing values in the variable
|
||||
for _item in $_values; do
|
||||
# ignore empty strings
|
||||
if [ -z "$_item" ]; then
|
||||
continue
|
||||
fi
|
||||
# ignore duplicates of _value
|
||||
if [ "$_item" = "$_value" ]; then
|
||||
continue
|
||||
fi
|
||||
# keep non-duplicate values
|
||||
_all_values="$_all_values:$_item"
|
||||
done
|
||||
unset _item
|
||||
# restore the field separator
|
||||
IFS=$_colcon_prepend_unique_value_IFS
|
||||
unset _colcon_prepend_unique_value_IFS
|
||||
# export the updated variable
|
||||
eval export $_listname=\"$_all_values\"
|
||||
unset _all_values
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# since a plain shell script can't determine its own path when being sourced
|
||||
# either use the provided COLCON_CURRENT_PREFIX
|
||||
# or fall back to the build time prefix (if it exists)
|
||||
_colcon_package_sh_COLCON_CURRENT_PREFIX="/root/ros2_ws/install/examples_rclpy_minimal_action_client"
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
if [ ! -d "$_colcon_package_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||
echo "The build time path \"$_colcon_package_sh_COLCON_CURRENT_PREFIX\" doesn't exist. Either source a script for a different shell or set the environment variable \"COLCON_CURRENT_PREFIX\" explicitly." 1>&2
|
||||
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||
return 1
|
||||
fi
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_sh_COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
unset _colcon_package_sh_COLCON_CURRENT_PREFIX
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source sh hooks
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/examples_rclpy_minimal_action_client/hook/pythonpath.sh"
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/examples_rclpy_minimal_action_client/hook/ament_prefix_path.sh"
|
||||
|
||||
unset _colcon_package_sh_source_script
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
# do not unset _colcon_prepend_unique_value since it might be used by non-primary shell hooks
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="2">
|
||||
<name>examples_rclpy_minimal_action_client</name>
|
||||
<version>0.15.3</version>
|
||||
<description>Examples of minimal action clients using rclpy.</description>
|
||||
<maintainer email="sloretz@openrobotics.org">Shane Loretz</maintainer>
|
||||
<maintainer email="aditya.pande@openrobotics.org">Aditya Pande</maintainer>
|
||||
<license>Apache License 2.0</license>
|
||||
|
||||
<author email="jacob@openrobotics.org">Jacob Perron</author>
|
||||
|
||||
<exec_depend>example_interfaces</exec_depend>
|
||||
<exec_depend>rclpy</exec_depend>
|
||||
|
||||
<!-- These test dependencies are optional
|
||||
Their purpose is to make sure that the code passes the linters -->
|
||||
<test_depend>ament_copyright</test_depend>
|
||||
<test_depend>ament_flake8</test_depend>
|
||||
<test_depend>ament_pep257</test_depend>
|
||||
<test_depend>python3-pytest</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_python</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,42 @@
|
||||
# generated from colcon_zsh/shell/template/package.zsh.em
|
||||
|
||||
# This script extends the environment for this package.
|
||||
|
||||
# a zsh script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
# the prefix is two levels up from the package specific share directory
|
||||
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_package_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
# additional arguments: arguments to the script
|
||||
_colcon_package_zsh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$@"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# function to convert array-like strings into arrays
|
||||
# to workaround SH_WORD_SPLIT not being set
|
||||
colcon_zsh_convert_to_array() {
|
||||
local _listname=$1
|
||||
local _dollar="$"
|
||||
local _split="{="
|
||||
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||
eval $_listname=$_to_array
|
||||
}
|
||||
|
||||
# source sh script of this package
|
||||
_colcon_package_zsh_source_script "$_colcon_package_zsh_COLCON_CURRENT_PREFIX/share/examples_rclpy_minimal_action_client/package.sh"
|
||||
unset convert_zsh_to_array
|
||||
|
||||
unset _colcon_package_zsh_source_script
|
||||
unset _colcon_package_zsh_COLCON_CURRENT_PREFIX
|
||||
Reference in New Issue
Block a user