机械臂仿真构建完成
This commit is contained in:
1
simulation_ws/robotic_arm/install/.colcon_install_layout
Normal file
1
simulation_ws/robotic_arm/install/.colcon_install_layout
Normal file
@@ -0,0 +1 @@
|
||||
isolated
|
||||
0
simulation_ws/robotic_arm/install/COLCON_IGNORE
Normal file
0
simulation_ws/robotic_arm/install/COLCON_IGNORE
Normal file
407
simulation_ws/robotic_arm/install/_local_setup_util_ps1.py
Normal file
407
simulation_ws/robotic_arm/install/_local_setup_util_ps1.py
Normal file
@@ -0,0 +1,407 @@
|
||||
# Copyright 2016-2019 Dirk Thomas
|
||||
# Licensed under the Apache License, Version 2.0
|
||||
|
||||
import argparse
|
||||
from collections import OrderedDict
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
|
||||
FORMAT_STR_COMMENT_LINE = '# {comment}'
|
||||
FORMAT_STR_SET_ENV_VAR = 'Set-Item -Path "Env:{name}" -Value "{value}"'
|
||||
FORMAT_STR_USE_ENV_VAR = '$env:{name}'
|
||||
FORMAT_STR_INVOKE_SCRIPT = '_colcon_prefix_powershell_source_script "{script_path}"' # noqa: E501
|
||||
FORMAT_STR_REMOVE_LEADING_SEPARATOR = '' # noqa: E501
|
||||
FORMAT_STR_REMOVE_TRAILING_SEPARATOR = '' # noqa: E501
|
||||
|
||||
DSV_TYPE_APPEND_NON_DUPLICATE = 'append-non-duplicate'
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE = 'prepend-non-duplicate'
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS = 'prepend-non-duplicate-if-exists'
|
||||
DSV_TYPE_SET = 'set'
|
||||
DSV_TYPE_SET_IF_UNSET = 'set-if-unset'
|
||||
DSV_TYPE_SOURCE = 'source'
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]): # noqa: D103
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Output shell commands for the packages in topological '
|
||||
'order')
|
||||
parser.add_argument(
|
||||
'primary_extension',
|
||||
help='The file extension of the primary shell')
|
||||
parser.add_argument(
|
||||
'additional_extension', nargs='?',
|
||||
help='The additional file extension to be considered')
|
||||
parser.add_argument(
|
||||
'--merged-install', action='store_true',
|
||||
help='All install prefixes are merged into a single location')
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
packages = get_packages(Path(__file__).parent, args.merged_install)
|
||||
|
||||
ordered_packages = order_packages(packages)
|
||||
for pkg_name in ordered_packages:
|
||||
if _include_comments():
|
||||
print(
|
||||
FORMAT_STR_COMMENT_LINE.format_map(
|
||||
{'comment': 'Package: ' + pkg_name}))
|
||||
prefix = os.path.abspath(os.path.dirname(__file__))
|
||||
if not args.merged_install:
|
||||
prefix = os.path.join(prefix, pkg_name)
|
||||
for line in get_commands(
|
||||
pkg_name, prefix, args.primary_extension,
|
||||
args.additional_extension
|
||||
):
|
||||
print(line)
|
||||
|
||||
for line in _remove_ending_separators():
|
||||
print(line)
|
||||
|
||||
|
||||
def get_packages(prefix_path, merged_install):
|
||||
"""
|
||||
Find packages based on colcon-specific files created during installation.
|
||||
|
||||
:param Path prefix_path: The install prefix path of all packages
|
||||
:param bool merged_install: The flag if the packages are all installed
|
||||
directly in the prefix or if each package is installed in a subdirectory
|
||||
named after the package
|
||||
:returns: A mapping from the package name to the set of runtime
|
||||
dependencies
|
||||
:rtype: dict
|
||||
"""
|
||||
packages = {}
|
||||
# since importing colcon_core isn't feasible here the following constant
|
||||
# must match colcon_core.location.get_relative_package_index_path()
|
||||
subdirectory = 'share/colcon-core/packages'
|
||||
if merged_install:
|
||||
# return if workspace is empty
|
||||
if not (prefix_path / subdirectory).is_dir():
|
||||
return packages
|
||||
# find all files in the subdirectory
|
||||
for p in (prefix_path / subdirectory).iterdir():
|
||||
if not p.is_file():
|
||||
continue
|
||||
if p.name.startswith('.'):
|
||||
continue
|
||||
add_package_runtime_dependencies(p, packages)
|
||||
else:
|
||||
# for each subdirectory look for the package specific file
|
||||
for p in prefix_path.iterdir():
|
||||
if not p.is_dir():
|
||||
continue
|
||||
if p.name.startswith('.'):
|
||||
continue
|
||||
p = p / subdirectory / p.name
|
||||
if p.is_file():
|
||||
add_package_runtime_dependencies(p, packages)
|
||||
|
||||
# remove unknown dependencies
|
||||
pkg_names = set(packages.keys())
|
||||
for k in packages.keys():
|
||||
packages[k] = {d for d in packages[k] if d in pkg_names}
|
||||
|
||||
return packages
|
||||
|
||||
|
||||
def add_package_runtime_dependencies(path, packages):
|
||||
"""
|
||||
Check the path and if it exists extract the packages runtime dependencies.
|
||||
|
||||
:param Path path: The resource file containing the runtime dependencies
|
||||
:param dict packages: A mapping from package names to the sets of runtime
|
||||
dependencies to add to
|
||||
"""
|
||||
content = path.read_text()
|
||||
dependencies = set(content.split(os.pathsep) if content else [])
|
||||
packages[path.name] = dependencies
|
||||
|
||||
|
||||
def order_packages(packages):
|
||||
"""
|
||||
Order packages topologically.
|
||||
|
||||
:param dict packages: A mapping from package name to the set of runtime
|
||||
dependencies
|
||||
:returns: The package names
|
||||
:rtype: list
|
||||
"""
|
||||
# select packages with no dependencies in alphabetical order
|
||||
to_be_ordered = list(packages.keys())
|
||||
ordered = []
|
||||
while to_be_ordered:
|
||||
pkg_names_without_deps = [
|
||||
name for name in to_be_ordered if not packages[name]]
|
||||
if not pkg_names_without_deps:
|
||||
reduce_cycle_set(packages)
|
||||
raise RuntimeError(
|
||||
'Circular dependency between: ' + ', '.join(sorted(packages)))
|
||||
pkg_names_without_deps.sort()
|
||||
pkg_name = pkg_names_without_deps[0]
|
||||
to_be_ordered.remove(pkg_name)
|
||||
ordered.append(pkg_name)
|
||||
# remove item from dependency lists
|
||||
for k in list(packages.keys()):
|
||||
if pkg_name in packages[k]:
|
||||
packages[k].remove(pkg_name)
|
||||
return ordered
|
||||
|
||||
|
||||
def reduce_cycle_set(packages):
|
||||
"""
|
||||
Reduce the set of packages to the ones part of the circular dependency.
|
||||
|
||||
:param dict packages: A mapping from package name to the set of runtime
|
||||
dependencies which is modified in place
|
||||
"""
|
||||
last_depended = None
|
||||
while len(packages) > 0:
|
||||
# get all remaining dependencies
|
||||
depended = set()
|
||||
for pkg_name, dependencies in packages.items():
|
||||
depended = depended.union(dependencies)
|
||||
# remove all packages which are not dependent on
|
||||
for name in list(packages.keys()):
|
||||
if name not in depended:
|
||||
del packages[name]
|
||||
if last_depended:
|
||||
# if remaining packages haven't changed return them
|
||||
if last_depended == depended:
|
||||
return packages.keys()
|
||||
# otherwise reduce again
|
||||
last_depended = depended
|
||||
|
||||
|
||||
def _include_comments():
|
||||
# skipping comment lines when COLCON_TRACE is not set speeds up the
|
||||
# processing especially on Windows
|
||||
return bool(os.environ.get('COLCON_TRACE'))
|
||||
|
||||
|
||||
def get_commands(pkg_name, prefix, primary_extension, additional_extension):
|
||||
commands = []
|
||||
package_dsv_path = os.path.join(prefix, 'share', pkg_name, 'package.dsv')
|
||||
if os.path.exists(package_dsv_path):
|
||||
commands += process_dsv_file(
|
||||
package_dsv_path, prefix, primary_extension, additional_extension)
|
||||
return commands
|
||||
|
||||
|
||||
def process_dsv_file(
|
||||
dsv_path, prefix, primary_extension=None, additional_extension=None
|
||||
):
|
||||
commands = []
|
||||
if _include_comments():
|
||||
commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path}))
|
||||
with open(dsv_path, 'r') as h:
|
||||
content = h.read()
|
||||
lines = content.splitlines()
|
||||
|
||||
basenames = OrderedDict()
|
||||
for i, line in enumerate(lines):
|
||||
# skip over empty or whitespace-only lines
|
||||
if not line.strip():
|
||||
continue
|
||||
# skip over comments
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
try:
|
||||
type_, remainder = line.split(';', 1)
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"Line %d in '%s' doesn't contain a semicolon separating the "
|
||||
'type from the arguments' % (i + 1, dsv_path))
|
||||
if type_ != DSV_TYPE_SOURCE:
|
||||
# handle non-source lines
|
||||
try:
|
||||
commands += handle_dsv_types_except_source(
|
||||
type_, remainder, prefix)
|
||||
except RuntimeError as e:
|
||||
raise RuntimeError(
|
||||
"Line %d in '%s' %s" % (i + 1, dsv_path, e)) from e
|
||||
else:
|
||||
# group remaining source lines by basename
|
||||
path_without_ext, ext = os.path.splitext(remainder)
|
||||
if path_without_ext not in basenames:
|
||||
basenames[path_without_ext] = set()
|
||||
assert ext.startswith('.')
|
||||
ext = ext[1:]
|
||||
if ext in (primary_extension, additional_extension):
|
||||
basenames[path_without_ext].add(ext)
|
||||
|
||||
# add the dsv extension to each basename if the file exists
|
||||
for basename, extensions in basenames.items():
|
||||
if not os.path.isabs(basename):
|
||||
basename = os.path.join(prefix, basename)
|
||||
if os.path.exists(basename + '.dsv'):
|
||||
extensions.add('dsv')
|
||||
|
||||
for basename, extensions in basenames.items():
|
||||
if not os.path.isabs(basename):
|
||||
basename = os.path.join(prefix, basename)
|
||||
if 'dsv' in extensions:
|
||||
# process dsv files recursively
|
||||
commands += process_dsv_file(
|
||||
basename + '.dsv', prefix, primary_extension=primary_extension,
|
||||
additional_extension=additional_extension)
|
||||
elif primary_extension in extensions and len(extensions) == 1:
|
||||
# source primary-only files
|
||||
commands += [
|
||||
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||
'prefix': prefix,
|
||||
'script_path': basename + '.' + primary_extension})]
|
||||
elif additional_extension in extensions:
|
||||
# source non-primary files
|
||||
commands += [
|
||||
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||
'prefix': prefix,
|
||||
'script_path': basename + '.' + additional_extension})]
|
||||
|
||||
return commands
|
||||
|
||||
|
||||
def handle_dsv_types_except_source(type_, remainder, prefix):
|
||||
commands = []
|
||||
if type_ in (DSV_TYPE_SET, DSV_TYPE_SET_IF_UNSET):
|
||||
try:
|
||||
env_name, value = remainder.split(';', 1)
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"doesn't contain a semicolon separating the environment name "
|
||||
'from the value')
|
||||
try_prefixed_value = os.path.join(prefix, value) if value else prefix
|
||||
if os.path.exists(try_prefixed_value):
|
||||
value = try_prefixed_value
|
||||
if type_ == DSV_TYPE_SET:
|
||||
commands += _set(env_name, value)
|
||||
elif type_ == DSV_TYPE_SET_IF_UNSET:
|
||||
commands += _set_if_unset(env_name, value)
|
||||
else:
|
||||
assert False
|
||||
elif type_ in (
|
||||
DSV_TYPE_APPEND_NON_DUPLICATE,
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE,
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS
|
||||
):
|
||||
try:
|
||||
env_name_and_values = remainder.split(';')
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"doesn't contain a semicolon separating the environment name "
|
||||
'from the values')
|
||||
env_name = env_name_and_values[0]
|
||||
values = env_name_and_values[1:]
|
||||
for value in values:
|
||||
if not value:
|
||||
value = prefix
|
||||
elif not os.path.isabs(value):
|
||||
value = os.path.join(prefix, value)
|
||||
if (
|
||||
type_ == DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS and
|
||||
not os.path.exists(value)
|
||||
):
|
||||
comment = f'skip extending {env_name} with not existing ' \
|
||||
f'path: {value}'
|
||||
if _include_comments():
|
||||
commands.append(
|
||||
FORMAT_STR_COMMENT_LINE.format_map({'comment': comment}))
|
||||
elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE:
|
||||
commands += _append_unique_value(env_name, value)
|
||||
else:
|
||||
commands += _prepend_unique_value(env_name, value)
|
||||
else:
|
||||
raise RuntimeError(
|
||||
'contains an unknown environment hook type: ' + type_)
|
||||
return commands
|
||||
|
||||
|
||||
env_state = {}
|
||||
|
||||
|
||||
def _append_unique_value(name, value):
|
||||
global env_state
|
||||
if name not in env_state:
|
||||
if os.environ.get(name):
|
||||
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||
else:
|
||||
env_state[name] = set()
|
||||
# append even if the variable has not been set yet, in case a shell script sets the
|
||||
# same variable without the knowledge of this Python script.
|
||||
# later _remove_ending_separators() will cleanup any unintentional leading separator
|
||||
extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': extend + value})
|
||||
if value not in env_state[name]:
|
||||
env_state[name].add(value)
|
||||
else:
|
||||
if not _include_comments():
|
||||
return []
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
def _prepend_unique_value(name, value):
|
||||
global env_state
|
||||
if name not in env_state:
|
||||
if os.environ.get(name):
|
||||
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||
else:
|
||||
env_state[name] = set()
|
||||
# prepend even if the variable has not been set yet, in case a shell script sets the
|
||||
# same variable without the knowledge of this Python script.
|
||||
# later _remove_ending_separators() will cleanup any unintentional trailing separator
|
||||
extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name})
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value + extend})
|
||||
if value not in env_state[name]:
|
||||
env_state[name].add(value)
|
||||
else:
|
||||
if not _include_comments():
|
||||
return []
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
# generate commands for removing prepended underscores
|
||||
def _remove_ending_separators():
|
||||
# do nothing if the shell extension does not implement the logic
|
||||
if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None:
|
||||
return []
|
||||
|
||||
global env_state
|
||||
commands = []
|
||||
for name in env_state:
|
||||
# skip variables that already had values before this script started prepending
|
||||
if name in os.environ:
|
||||
continue
|
||||
commands += [
|
||||
FORMAT_STR_REMOVE_LEADING_SEPARATOR.format_map({'name': name}),
|
||||
FORMAT_STR_REMOVE_TRAILING_SEPARATOR.format_map({'name': name})]
|
||||
return commands
|
||||
|
||||
|
||||
def _set(name, value):
|
||||
global env_state
|
||||
env_state[name] = value
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value})
|
||||
return [line]
|
||||
|
||||
|
||||
def _set_if_unset(name, value):
|
||||
global env_state
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value})
|
||||
if env_state.get(name, os.environ.get(name)):
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
if __name__ == '__main__': # pragma: no cover
|
||||
try:
|
||||
rc = main()
|
||||
except RuntimeError as e:
|
||||
print(str(e), file=sys.stderr)
|
||||
rc = 1
|
||||
sys.exit(rc)
|
||||
407
simulation_ws/robotic_arm/install/_local_setup_util_sh.py
Normal file
407
simulation_ws/robotic_arm/install/_local_setup_util_sh.py
Normal file
@@ -0,0 +1,407 @@
|
||||
# Copyright 2016-2019 Dirk Thomas
|
||||
# Licensed under the Apache License, Version 2.0
|
||||
|
||||
import argparse
|
||||
from collections import OrderedDict
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
|
||||
FORMAT_STR_COMMENT_LINE = '# {comment}'
|
||||
FORMAT_STR_SET_ENV_VAR = 'export {name}="{value}"'
|
||||
FORMAT_STR_USE_ENV_VAR = '${name}'
|
||||
FORMAT_STR_INVOKE_SCRIPT = 'COLCON_CURRENT_PREFIX="{prefix}" _colcon_prefix_sh_source_script "{script_path}"' # noqa: E501
|
||||
FORMAT_STR_REMOVE_LEADING_SEPARATOR = 'if [ "$(echo -n ${name} | head -c 1)" = ":" ]; then export {name}=${{{name}#?}} ; fi' # noqa: E501
|
||||
FORMAT_STR_REMOVE_TRAILING_SEPARATOR = 'if [ "$(echo -n ${name} | tail -c 1)" = ":" ]; then export {name}=${{{name}%?}} ; fi' # noqa: E501
|
||||
|
||||
DSV_TYPE_APPEND_NON_DUPLICATE = 'append-non-duplicate'
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE = 'prepend-non-duplicate'
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS = 'prepend-non-duplicate-if-exists'
|
||||
DSV_TYPE_SET = 'set'
|
||||
DSV_TYPE_SET_IF_UNSET = 'set-if-unset'
|
||||
DSV_TYPE_SOURCE = 'source'
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]): # noqa: D103
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Output shell commands for the packages in topological '
|
||||
'order')
|
||||
parser.add_argument(
|
||||
'primary_extension',
|
||||
help='The file extension of the primary shell')
|
||||
parser.add_argument(
|
||||
'additional_extension', nargs='?',
|
||||
help='The additional file extension to be considered')
|
||||
parser.add_argument(
|
||||
'--merged-install', action='store_true',
|
||||
help='All install prefixes are merged into a single location')
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
packages = get_packages(Path(__file__).parent, args.merged_install)
|
||||
|
||||
ordered_packages = order_packages(packages)
|
||||
for pkg_name in ordered_packages:
|
||||
if _include_comments():
|
||||
print(
|
||||
FORMAT_STR_COMMENT_LINE.format_map(
|
||||
{'comment': 'Package: ' + pkg_name}))
|
||||
prefix = os.path.abspath(os.path.dirname(__file__))
|
||||
if not args.merged_install:
|
||||
prefix = os.path.join(prefix, pkg_name)
|
||||
for line in get_commands(
|
||||
pkg_name, prefix, args.primary_extension,
|
||||
args.additional_extension
|
||||
):
|
||||
print(line)
|
||||
|
||||
for line in _remove_ending_separators():
|
||||
print(line)
|
||||
|
||||
|
||||
def get_packages(prefix_path, merged_install):
|
||||
"""
|
||||
Find packages based on colcon-specific files created during installation.
|
||||
|
||||
:param Path prefix_path: The install prefix path of all packages
|
||||
:param bool merged_install: The flag if the packages are all installed
|
||||
directly in the prefix or if each package is installed in a subdirectory
|
||||
named after the package
|
||||
:returns: A mapping from the package name to the set of runtime
|
||||
dependencies
|
||||
:rtype: dict
|
||||
"""
|
||||
packages = {}
|
||||
# since importing colcon_core isn't feasible here the following constant
|
||||
# must match colcon_core.location.get_relative_package_index_path()
|
||||
subdirectory = 'share/colcon-core/packages'
|
||||
if merged_install:
|
||||
# return if workspace is empty
|
||||
if not (prefix_path / subdirectory).is_dir():
|
||||
return packages
|
||||
# find all files in the subdirectory
|
||||
for p in (prefix_path / subdirectory).iterdir():
|
||||
if not p.is_file():
|
||||
continue
|
||||
if p.name.startswith('.'):
|
||||
continue
|
||||
add_package_runtime_dependencies(p, packages)
|
||||
else:
|
||||
# for each subdirectory look for the package specific file
|
||||
for p in prefix_path.iterdir():
|
||||
if not p.is_dir():
|
||||
continue
|
||||
if p.name.startswith('.'):
|
||||
continue
|
||||
p = p / subdirectory / p.name
|
||||
if p.is_file():
|
||||
add_package_runtime_dependencies(p, packages)
|
||||
|
||||
# remove unknown dependencies
|
||||
pkg_names = set(packages.keys())
|
||||
for k in packages.keys():
|
||||
packages[k] = {d for d in packages[k] if d in pkg_names}
|
||||
|
||||
return packages
|
||||
|
||||
|
||||
def add_package_runtime_dependencies(path, packages):
|
||||
"""
|
||||
Check the path and if it exists extract the packages runtime dependencies.
|
||||
|
||||
:param Path path: The resource file containing the runtime dependencies
|
||||
:param dict packages: A mapping from package names to the sets of runtime
|
||||
dependencies to add to
|
||||
"""
|
||||
content = path.read_text()
|
||||
dependencies = set(content.split(os.pathsep) if content else [])
|
||||
packages[path.name] = dependencies
|
||||
|
||||
|
||||
def order_packages(packages):
|
||||
"""
|
||||
Order packages topologically.
|
||||
|
||||
:param dict packages: A mapping from package name to the set of runtime
|
||||
dependencies
|
||||
:returns: The package names
|
||||
:rtype: list
|
||||
"""
|
||||
# select packages with no dependencies in alphabetical order
|
||||
to_be_ordered = list(packages.keys())
|
||||
ordered = []
|
||||
while to_be_ordered:
|
||||
pkg_names_without_deps = [
|
||||
name for name in to_be_ordered if not packages[name]]
|
||||
if not pkg_names_without_deps:
|
||||
reduce_cycle_set(packages)
|
||||
raise RuntimeError(
|
||||
'Circular dependency between: ' + ', '.join(sorted(packages)))
|
||||
pkg_names_without_deps.sort()
|
||||
pkg_name = pkg_names_without_deps[0]
|
||||
to_be_ordered.remove(pkg_name)
|
||||
ordered.append(pkg_name)
|
||||
# remove item from dependency lists
|
||||
for k in list(packages.keys()):
|
||||
if pkg_name in packages[k]:
|
||||
packages[k].remove(pkg_name)
|
||||
return ordered
|
||||
|
||||
|
||||
def reduce_cycle_set(packages):
|
||||
"""
|
||||
Reduce the set of packages to the ones part of the circular dependency.
|
||||
|
||||
:param dict packages: A mapping from package name to the set of runtime
|
||||
dependencies which is modified in place
|
||||
"""
|
||||
last_depended = None
|
||||
while len(packages) > 0:
|
||||
# get all remaining dependencies
|
||||
depended = set()
|
||||
for pkg_name, dependencies in packages.items():
|
||||
depended = depended.union(dependencies)
|
||||
# remove all packages which are not dependent on
|
||||
for name in list(packages.keys()):
|
||||
if name not in depended:
|
||||
del packages[name]
|
||||
if last_depended:
|
||||
# if remaining packages haven't changed return them
|
||||
if last_depended == depended:
|
||||
return packages.keys()
|
||||
# otherwise reduce again
|
||||
last_depended = depended
|
||||
|
||||
|
||||
def _include_comments():
|
||||
# skipping comment lines when COLCON_TRACE is not set speeds up the
|
||||
# processing especially on Windows
|
||||
return bool(os.environ.get('COLCON_TRACE'))
|
||||
|
||||
|
||||
def get_commands(pkg_name, prefix, primary_extension, additional_extension):
|
||||
commands = []
|
||||
package_dsv_path = os.path.join(prefix, 'share', pkg_name, 'package.dsv')
|
||||
if os.path.exists(package_dsv_path):
|
||||
commands += process_dsv_file(
|
||||
package_dsv_path, prefix, primary_extension, additional_extension)
|
||||
return commands
|
||||
|
||||
|
||||
def process_dsv_file(
|
||||
dsv_path, prefix, primary_extension=None, additional_extension=None
|
||||
):
|
||||
commands = []
|
||||
if _include_comments():
|
||||
commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path}))
|
||||
with open(dsv_path, 'r') as h:
|
||||
content = h.read()
|
||||
lines = content.splitlines()
|
||||
|
||||
basenames = OrderedDict()
|
||||
for i, line in enumerate(lines):
|
||||
# skip over empty or whitespace-only lines
|
||||
if not line.strip():
|
||||
continue
|
||||
# skip over comments
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
try:
|
||||
type_, remainder = line.split(';', 1)
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"Line %d in '%s' doesn't contain a semicolon separating the "
|
||||
'type from the arguments' % (i + 1, dsv_path))
|
||||
if type_ != DSV_TYPE_SOURCE:
|
||||
# handle non-source lines
|
||||
try:
|
||||
commands += handle_dsv_types_except_source(
|
||||
type_, remainder, prefix)
|
||||
except RuntimeError as e:
|
||||
raise RuntimeError(
|
||||
"Line %d in '%s' %s" % (i + 1, dsv_path, e)) from e
|
||||
else:
|
||||
# group remaining source lines by basename
|
||||
path_without_ext, ext = os.path.splitext(remainder)
|
||||
if path_without_ext not in basenames:
|
||||
basenames[path_without_ext] = set()
|
||||
assert ext.startswith('.')
|
||||
ext = ext[1:]
|
||||
if ext in (primary_extension, additional_extension):
|
||||
basenames[path_without_ext].add(ext)
|
||||
|
||||
# add the dsv extension to each basename if the file exists
|
||||
for basename, extensions in basenames.items():
|
||||
if not os.path.isabs(basename):
|
||||
basename = os.path.join(prefix, basename)
|
||||
if os.path.exists(basename + '.dsv'):
|
||||
extensions.add('dsv')
|
||||
|
||||
for basename, extensions in basenames.items():
|
||||
if not os.path.isabs(basename):
|
||||
basename = os.path.join(prefix, basename)
|
||||
if 'dsv' in extensions:
|
||||
# process dsv files recursively
|
||||
commands += process_dsv_file(
|
||||
basename + '.dsv', prefix, primary_extension=primary_extension,
|
||||
additional_extension=additional_extension)
|
||||
elif primary_extension in extensions and len(extensions) == 1:
|
||||
# source primary-only files
|
||||
commands += [
|
||||
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||
'prefix': prefix,
|
||||
'script_path': basename + '.' + primary_extension})]
|
||||
elif additional_extension in extensions:
|
||||
# source non-primary files
|
||||
commands += [
|
||||
FORMAT_STR_INVOKE_SCRIPT.format_map({
|
||||
'prefix': prefix,
|
||||
'script_path': basename + '.' + additional_extension})]
|
||||
|
||||
return commands
|
||||
|
||||
|
||||
def handle_dsv_types_except_source(type_, remainder, prefix):
|
||||
commands = []
|
||||
if type_ in (DSV_TYPE_SET, DSV_TYPE_SET_IF_UNSET):
|
||||
try:
|
||||
env_name, value = remainder.split(';', 1)
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"doesn't contain a semicolon separating the environment name "
|
||||
'from the value')
|
||||
try_prefixed_value = os.path.join(prefix, value) if value else prefix
|
||||
if os.path.exists(try_prefixed_value):
|
||||
value = try_prefixed_value
|
||||
if type_ == DSV_TYPE_SET:
|
||||
commands += _set(env_name, value)
|
||||
elif type_ == DSV_TYPE_SET_IF_UNSET:
|
||||
commands += _set_if_unset(env_name, value)
|
||||
else:
|
||||
assert False
|
||||
elif type_ in (
|
||||
DSV_TYPE_APPEND_NON_DUPLICATE,
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE,
|
||||
DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS
|
||||
):
|
||||
try:
|
||||
env_name_and_values = remainder.split(';')
|
||||
except ValueError:
|
||||
raise RuntimeError(
|
||||
"doesn't contain a semicolon separating the environment name "
|
||||
'from the values')
|
||||
env_name = env_name_and_values[0]
|
||||
values = env_name_and_values[1:]
|
||||
for value in values:
|
||||
if not value:
|
||||
value = prefix
|
||||
elif not os.path.isabs(value):
|
||||
value = os.path.join(prefix, value)
|
||||
if (
|
||||
type_ == DSV_TYPE_PREPEND_NON_DUPLICATE_IF_EXISTS and
|
||||
not os.path.exists(value)
|
||||
):
|
||||
comment = f'skip extending {env_name} with not existing ' \
|
||||
f'path: {value}'
|
||||
if _include_comments():
|
||||
commands.append(
|
||||
FORMAT_STR_COMMENT_LINE.format_map({'comment': comment}))
|
||||
elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE:
|
||||
commands += _append_unique_value(env_name, value)
|
||||
else:
|
||||
commands += _prepend_unique_value(env_name, value)
|
||||
else:
|
||||
raise RuntimeError(
|
||||
'contains an unknown environment hook type: ' + type_)
|
||||
return commands
|
||||
|
||||
|
||||
env_state = {}
|
||||
|
||||
|
||||
def _append_unique_value(name, value):
|
||||
global env_state
|
||||
if name not in env_state:
|
||||
if os.environ.get(name):
|
||||
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||
else:
|
||||
env_state[name] = set()
|
||||
# append even if the variable has not been set yet, in case a shell script sets the
|
||||
# same variable without the knowledge of this Python script.
|
||||
# later _remove_ending_separators() will cleanup any unintentional leading separator
|
||||
extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': extend + value})
|
||||
if value not in env_state[name]:
|
||||
env_state[name].add(value)
|
||||
else:
|
||||
if not _include_comments():
|
||||
return []
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
def _prepend_unique_value(name, value):
|
||||
global env_state
|
||||
if name not in env_state:
|
||||
if os.environ.get(name):
|
||||
env_state[name] = set(os.environ[name].split(os.pathsep))
|
||||
else:
|
||||
env_state[name] = set()
|
||||
# prepend even if the variable has not been set yet, in case a shell script sets the
|
||||
# same variable without the knowledge of this Python script.
|
||||
# later _remove_ending_separators() will cleanup any unintentional trailing separator
|
||||
extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name})
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value + extend})
|
||||
if value not in env_state[name]:
|
||||
env_state[name].add(value)
|
||||
else:
|
||||
if not _include_comments():
|
||||
return []
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
# generate commands for removing prepended underscores
|
||||
def _remove_ending_separators():
|
||||
# do nothing if the shell extension does not implement the logic
|
||||
if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None:
|
||||
return []
|
||||
|
||||
global env_state
|
||||
commands = []
|
||||
for name in env_state:
|
||||
# skip variables that already had values before this script started prepending
|
||||
if name in os.environ:
|
||||
continue
|
||||
commands += [
|
||||
FORMAT_STR_REMOVE_LEADING_SEPARATOR.format_map({'name': name}),
|
||||
FORMAT_STR_REMOVE_TRAILING_SEPARATOR.format_map({'name': name})]
|
||||
return commands
|
||||
|
||||
|
||||
def _set(name, value):
|
||||
global env_state
|
||||
env_state[name] = value
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value})
|
||||
return [line]
|
||||
|
||||
|
||||
def _set_if_unset(name, value):
|
||||
global env_state
|
||||
line = FORMAT_STR_SET_ENV_VAR.format_map(
|
||||
{'name': name, 'value': value})
|
||||
if env_state.get(name, os.environ.get(name)):
|
||||
line = FORMAT_STR_COMMENT_LINE.format_map({'comment': line})
|
||||
return [line]
|
||||
|
||||
|
||||
if __name__ == '__main__': # pragma: no cover
|
||||
try:
|
||||
rc = main()
|
||||
except RuntimeError as e:
|
||||
print(str(e), file=sys.stderr)
|
||||
rc = 1
|
||||
sys.exit(rc)
|
||||
121
simulation_ws/robotic_arm/install/local_setup.bash
Normal file
121
simulation_ws/robotic_arm/install/local_setup.bash
Normal file
@@ -0,0 +1,121 @@
|
||||
# generated from colcon_bash/shell/template/prefix.bash.em
|
||||
|
||||
# This script extends the environment with all packages contained in this
|
||||
# prefix path.
|
||||
|
||||
# a bash script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
_colcon_prefix_bash_COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_prefix_bash_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# 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_prefix_bash_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
|
||||
# get values from variable
|
||||
eval _values=\"\$$_listname\"
|
||||
# backup the field separator
|
||||
_colcon_prefix_bash_prepend_unique_value_IFS="$IFS"
|
||||
IFS=":"
|
||||
# start with the new value
|
||||
_all_values="$_value"
|
||||
_contained_value=""
|
||||
# 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
|
||||
_contained_value=1
|
||||
continue
|
||||
fi
|
||||
# keep non-duplicate values
|
||||
_all_values="$_all_values:$_item"
|
||||
done
|
||||
unset _item
|
||||
if [ -z "$_contained_value" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
if [ "$_all_values" = "$_value" ]; then
|
||||
echo "export $_listname=$_value"
|
||||
else
|
||||
echo "export $_listname=$_value:\$$_listname"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
unset _contained_value
|
||||
# restore the field separator
|
||||
IFS="$_colcon_prefix_bash_prepend_unique_value_IFS"
|
||||
unset _colcon_prefix_bash_prepend_unique_value_IFS
|
||||
# export the updated variable
|
||||
eval export $_listname=\"$_all_values\"
|
||||
unset _all_values
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# add this prefix to the COLCON_PREFIX_PATH
|
||||
_colcon_prefix_bash_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_bash_COLCON_CURRENT_PREFIX"
|
||||
unset _colcon_prefix_bash_prepend_unique_value
|
||||
|
||||
# check environment variable for custom Python executable
|
||||
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||
else
|
||||
# try the Python executable known at configure time
|
||||
_colcon_python_executable="/usr/bin/python3"
|
||||
# if it doesn't exist try a fall back
|
||||
if [ ! -f "$_colcon_python_executable" ]; then
|
||||
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||
echo "error: unable to find python3 executable"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# get all commands in topological order
|
||||
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_bash_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh bash)"
|
||||
unset _colcon_python_executable
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "$(declare -f _colcon_prefix_sh_source_script)"
|
||||
echo "# Execute generated script:"
|
||||
echo "# <<<"
|
||||
echo "${_colcon_ordered_commands}"
|
||||
echo "# >>>"
|
||||
echo "unset _colcon_prefix_sh_source_script"
|
||||
fi
|
||||
eval "${_colcon_ordered_commands}"
|
||||
unset _colcon_ordered_commands
|
||||
|
||||
unset _colcon_prefix_sh_source_script
|
||||
|
||||
unset _colcon_prefix_bash_COLCON_CURRENT_PREFIX
|
||||
55
simulation_ws/robotic_arm/install/local_setup.ps1
Normal file
55
simulation_ws/robotic_arm/install/local_setup.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
# generated from colcon_powershell/shell/template/prefix.ps1.em
|
||||
|
||||
# This script extends the environment with all packages contained in this
|
||||
# prefix path.
|
||||
|
||||
# check environment variable for custom Python executable
|
||||
if ($env:COLCON_PYTHON_EXECUTABLE) {
|
||||
if (!(Test-Path "$env:COLCON_PYTHON_EXECUTABLE" -PathType Leaf)) {
|
||||
echo "error: COLCON_PYTHON_EXECUTABLE '$env:COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||
exit 1
|
||||
}
|
||||
$_colcon_python_executable="$env:COLCON_PYTHON_EXECUTABLE"
|
||||
} else {
|
||||
# use the Python executable known at configure time
|
||||
$_colcon_python_executable="/usr/bin/python3"
|
||||
# if it doesn't exist try a fall back
|
||||
if (!(Test-Path "$_colcon_python_executable" -PathType Leaf)) {
|
||||
if (!(Get-Command "python3" -ErrorAction SilentlyContinue)) {
|
||||
echo "error: unable to find python3 executable"
|
||||
exit 1
|
||||
}
|
||||
$_colcon_python_executable="python3"
|
||||
}
|
||||
}
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
function _colcon_prefix_powershell_source_script {
|
||||
param (
|
||||
$_colcon_prefix_powershell_source_script_param
|
||||
)
|
||||
# source script with conditional trace output
|
||||
if (Test-Path $_colcon_prefix_powershell_source_script_param) {
|
||||
if ($env:COLCON_TRACE) {
|
||||
echo ". '$_colcon_prefix_powershell_source_script_param'"
|
||||
}
|
||||
. "$_colcon_prefix_powershell_source_script_param"
|
||||
} else {
|
||||
Write-Error "not found: '$_colcon_prefix_powershell_source_script_param'"
|
||||
}
|
||||
}
|
||||
|
||||
# get all commands in topological order
|
||||
$_colcon_ordered_commands = & "$_colcon_python_executable" "$(Split-Path $PSCommandPath -Parent)/_local_setup_util_ps1.py" ps1
|
||||
|
||||
# execute all commands in topological order
|
||||
if ($env:COLCON_TRACE) {
|
||||
echo "Execute generated script:"
|
||||
echo "<<<"
|
||||
$_colcon_ordered_commands.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries) | Write-Output
|
||||
echo ">>>"
|
||||
}
|
||||
if ($_colcon_ordered_commands) {
|
||||
$_colcon_ordered_commands.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries) | Invoke-Expression
|
||||
}
|
||||
137
simulation_ws/robotic_arm/install/local_setup.sh
Normal file
137
simulation_ws/robotic_arm/install/local_setup.sh
Normal file
@@ -0,0 +1,137 @@
|
||||
# generated from colcon_core/shell/template/prefix.sh.em
|
||||
|
||||
# This script extends the environment with all packages contained in this
|
||||
# prefix path.
|
||||
|
||||
# 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_prefix_sh_COLCON_CURRENT_PREFIX="/home/quella/ROS2_WS/simulation_ws/robotic_arm/install"
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
if [ ! -d "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||
echo "The build time path \"$_colcon_prefix_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_prefix_sh_COLCON_CURRENT_PREFIX
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
_colcon_prefix_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# 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_prefix_sh_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
|
||||
# get values from variable
|
||||
eval _values=\"\$$_listname\"
|
||||
# backup the field separator
|
||||
_colcon_prefix_sh_prepend_unique_value_IFS="$IFS"
|
||||
IFS=":"
|
||||
# start with the new value
|
||||
_all_values="$_value"
|
||||
_contained_value=""
|
||||
# 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
|
||||
_contained_value=1
|
||||
continue
|
||||
fi
|
||||
# keep non-duplicate values
|
||||
_all_values="$_all_values:$_item"
|
||||
done
|
||||
unset _item
|
||||
if [ -z "$_contained_value" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
if [ "$_all_values" = "$_value" ]; then
|
||||
echo "export $_listname=$_value"
|
||||
else
|
||||
echo "export $_listname=$_value:\$$_listname"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
unset _contained_value
|
||||
# restore the field separator
|
||||
IFS="$_colcon_prefix_sh_prepend_unique_value_IFS"
|
||||
unset _colcon_prefix_sh_prepend_unique_value_IFS
|
||||
# export the updated variable
|
||||
eval export $_listname=\"$_all_values\"
|
||||
unset _all_values
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# add this prefix to the COLCON_PREFIX_PATH
|
||||
_colcon_prefix_sh_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX"
|
||||
unset _colcon_prefix_sh_prepend_unique_value
|
||||
|
||||
# check environment variable for custom Python executable
|
||||
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||
else
|
||||
# try the Python executable known at configure time
|
||||
_colcon_python_executable="/usr/bin/python3"
|
||||
# if it doesn't exist try a fall back
|
||||
if [ ! -f "$_colcon_python_executable" ]; then
|
||||
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||
echo "error: unable to find python3 executable"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# get all commands in topological order
|
||||
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_sh_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh)"
|
||||
unset _colcon_python_executable
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "_colcon_prefix_sh_source_script() {
|
||||
if [ -f \"\$1\" ]; then
|
||||
if [ -n \"\$COLCON_TRACE\" ]; then
|
||||
echo \"# . \\\"\$1\\\"\"
|
||||
fi
|
||||
. \"\$1\"
|
||||
else
|
||||
echo \"not found: \\\"\$1\\\"\" 1>&2
|
||||
fi
|
||||
}"
|
||||
echo "# Execute generated script:"
|
||||
echo "# <<<"
|
||||
echo "${_colcon_ordered_commands}"
|
||||
echo "# >>>"
|
||||
echo "unset _colcon_prefix_sh_source_script"
|
||||
fi
|
||||
eval "${_colcon_ordered_commands}"
|
||||
unset _colcon_ordered_commands
|
||||
|
||||
unset _colcon_prefix_sh_source_script
|
||||
|
||||
unset _colcon_prefix_sh_COLCON_CURRENT_PREFIX
|
||||
134
simulation_ws/robotic_arm/install/local_setup.zsh
Normal file
134
simulation_ws/robotic_arm/install/local_setup.zsh
Normal file
@@ -0,0 +1,134 @@
|
||||
# generated from colcon_zsh/shell/template/prefix.zsh.em
|
||||
|
||||
# This script extends the environment with all packages contained in this
|
||||
# prefix path.
|
||||
|
||||
# a zsh script is able to determine its own path if necessary
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
_colcon_prefix_zsh_COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)"
|
||||
else
|
||||
_colcon_prefix_zsh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
|
||||
# function to convert array-like strings into arrays
|
||||
# to workaround SH_WORD_SPLIT not being set
|
||||
_colcon_prefix_zsh_convert_to_array() {
|
||||
local _listname=$1
|
||||
local _dollar="$"
|
||||
local _split="{="
|
||||
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||
eval $_listname=$_to_array
|
||||
}
|
||||
|
||||
# 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_prefix_zsh_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
|
||||
# get values from variable
|
||||
eval _values=\"\$$_listname\"
|
||||
# backup the field separator
|
||||
_colcon_prefix_zsh_prepend_unique_value_IFS="$IFS"
|
||||
IFS=":"
|
||||
# start with the new value
|
||||
_all_values="$_value"
|
||||
_contained_value=""
|
||||
# workaround SH_WORD_SPLIT not being set
|
||||
_colcon_prefix_zsh_convert_to_array _values
|
||||
# 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
|
||||
_contained_value=1
|
||||
continue
|
||||
fi
|
||||
# keep non-duplicate values
|
||||
_all_values="$_all_values:$_item"
|
||||
done
|
||||
unset _item
|
||||
if [ -z "$_contained_value" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
if [ "$_all_values" = "$_value" ]; then
|
||||
echo "export $_listname=$_value"
|
||||
else
|
||||
echo "export $_listname=$_value:\$$_listname"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
unset _contained_value
|
||||
# restore the field separator
|
||||
IFS="$_colcon_prefix_zsh_prepend_unique_value_IFS"
|
||||
unset _colcon_prefix_zsh_prepend_unique_value_IFS
|
||||
# export the updated variable
|
||||
eval export $_listname=\"$_all_values\"
|
||||
unset _all_values
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# add this prefix to the COLCON_PREFIX_PATH
|
||||
_colcon_prefix_zsh_prepend_unique_value COLCON_PREFIX_PATH "$_colcon_prefix_zsh_COLCON_CURRENT_PREFIX"
|
||||
unset _colcon_prefix_zsh_prepend_unique_value
|
||||
unset _colcon_prefix_zsh_convert_to_array
|
||||
|
||||
# check environment variable for custom Python executable
|
||||
if [ -n "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
if [ ! -f "$COLCON_PYTHON_EXECUTABLE" ]; then
|
||||
echo "error: COLCON_PYTHON_EXECUTABLE '$COLCON_PYTHON_EXECUTABLE' doesn't exist"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable="$COLCON_PYTHON_EXECUTABLE"
|
||||
else
|
||||
# try the Python executable known at configure time
|
||||
_colcon_python_executable="/usr/bin/python3"
|
||||
# if it doesn't exist try a fall back
|
||||
if [ ! -f "$_colcon_python_executable" ]; then
|
||||
if ! /usr/bin/env python3 --version > /dev/null 2> /dev/null; then
|
||||
echo "error: unable to find python3 executable"
|
||||
return 1
|
||||
fi
|
||||
_colcon_python_executable=`/usr/bin/env python3 -c "import sys; print(sys.executable)"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# get all commands in topological order
|
||||
_colcon_ordered_commands="$($_colcon_python_executable "$_colcon_prefix_zsh_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh zsh)"
|
||||
unset _colcon_python_executable
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "$(declare -f _colcon_prefix_sh_source_script)"
|
||||
echo "# Execute generated script:"
|
||||
echo "# <<<"
|
||||
echo "${_colcon_ordered_commands}"
|
||||
echo "# >>>"
|
||||
echo "unset _colcon_prefix_sh_source_script"
|
||||
fi
|
||||
eval "${_colcon_ordered_commands}"
|
||||
unset _colcon_ordered_commands
|
||||
|
||||
unset _colcon_prefix_sh_source_script
|
||||
|
||||
unset _colcon_prefix_zsh_COLCON_CURRENT_PREFIX
|
||||
@@ -0,0 +1 @@
|
||||
rclcpp;ament_lint_auto;ament_lint_common
|
||||
@@ -0,0 +1 @@
|
||||
/home/quella/ROS2_WS/simulation_ws/robotic_arm/install/robotic_arm:/opt/ros/humble
|
||||
@@ -0,0 +1 @@
|
||||
rclcpp
|
||||
@@ -0,0 +1,14 @@
|
||||
# generated from ament/cmake/core/templates/nameConfig-version.cmake.in
|
||||
set(PACKAGE_VERSION "0.0.0")
|
||||
|
||||
set(PACKAGE_VERSION_EXACT False)
|
||||
set(PACKAGE_VERSION_COMPATIBLE False)
|
||||
|
||||
if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
@@ -0,0 +1,42 @@
|
||||
# generated from ament/cmake/core/templates/nameConfig.cmake.in
|
||||
|
||||
# prevent multiple inclusion
|
||||
if(_robotic_arm_CONFIG_INCLUDED)
|
||||
# ensure to keep the found flag the same
|
||||
if(NOT DEFINED robotic_arm_FOUND)
|
||||
# explicitly set it to FALSE, otherwise CMake will set it to TRUE
|
||||
set(robotic_arm_FOUND FALSE)
|
||||
elseif(NOT robotic_arm_FOUND)
|
||||
# use separate condition to avoid uninitialized variable warning
|
||||
set(robotic_arm_FOUND FALSE)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
set(_robotic_arm_CONFIG_INCLUDED TRUE)
|
||||
|
||||
# output package information
|
||||
if(NOT robotic_arm_FIND_QUIETLY)
|
||||
message(STATUS "Found robotic_arm: 0.0.0 (${robotic_arm_DIR})")
|
||||
endif()
|
||||
|
||||
# warn when using a deprecated package
|
||||
if(NOT "" STREQUAL "")
|
||||
set(_msg "Package 'robotic_arm' is deprecated")
|
||||
# append custom deprecation text if available
|
||||
if(NOT "" STREQUAL "TRUE")
|
||||
set(_msg "${_msg} ()")
|
||||
endif()
|
||||
# optionally quiet the deprecation message
|
||||
if(NOT ${robotic_arm_DEPRECATED_QUIET})
|
||||
message(DEPRECATION "${_msg}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# flag package as ament-based to distinguish it after being find_package()-ed
|
||||
set(robotic_arm_FOUND_AMENT_PACKAGE TRUE)
|
||||
|
||||
# include all config extra files
|
||||
set(_extras "")
|
||||
foreach(_extra ${_extras})
|
||||
include("${robotic_arm_DIR}/${_extra}")
|
||||
endforeach()
|
||||
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;AMENT_PREFIX_PATH;
|
||||
@@ -0,0 +1,4 @@
|
||||
# copied from
|
||||
# ament_cmake_core/cmake/environment_hooks/environment/ament_prefix_path.sh
|
||||
|
||||
ament_prepend_unique_value AMENT_PREFIX_PATH "$AMENT_CURRENT_PREFIX"
|
||||
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate-if-exists;PATH;bin
|
||||
@@ -0,0 +1,5 @@
|
||||
# copied from ament_cmake_core/cmake/environment_hooks/environment/path.sh
|
||||
|
||||
if [ -d "$AMENT_CURRENT_PREFIX/bin" ]; then
|
||||
ament_prepend_unique_value PATH "$AMENT_CURRENT_PREFIX/bin"
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
prepend-non-duplicate;CMAKE_PREFIX_PATH;
|
||||
@@ -0,0 +1,3 @@
|
||||
# generated from colcon_powershell/shell/template/hook_prepend_value.ps1.em
|
||||
|
||||
colcon_prepend_unique_value CMAKE_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 CMAKE_PREFIX_PATH "$COLCON_CURRENT_PREFIX"
|
||||
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
import xacro
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
pkg_path=get_package_share_directory('robotic_arm')
|
||||
xacro_file=os.path.join(pkg_path,'urdf','robotic_arm.urdf.xacro')
|
||||
# 解析xacro文件,展开所有宏,常量,变量,include等,得到最终的URDF字符串
|
||||
robot_description_config=xacro.process_file(xacro_file)
|
||||
# 将URDF字符串封装成ROS参数字典,键为'robot_description',值为URDF字符串
|
||||
robot_description = {'robot_description': robot_description_config.toxml()}
|
||||
|
||||
# 发布机器人状态的节点
|
||||
rsp=Node(
|
||||
package='robot_state_publisher',
|
||||
executable='robot_state_publisher',
|
||||
output='screen',
|
||||
parameters=[robot_description]
|
||||
)
|
||||
|
||||
# 关节状态发布器
|
||||
jsp=Node(
|
||||
package='joint_state_publisher_gui',
|
||||
executable='joint_state_publisher_gui',
|
||||
output='screen'
|
||||
)
|
||||
|
||||
# 启动rviz2,并加载预设的rviz配置文件
|
||||
rvz=Node(
|
||||
package='rviz2',
|
||||
executable='rviz2',
|
||||
output='screen',
|
||||
arguments=['-d', os.path.join(pkg_path,'rviz','display.rviz')]
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
rsp,
|
||||
jsp,
|
||||
rvz
|
||||
])
|
||||
@@ -0,0 +1,46 @@
|
||||
# generated from ament_package/template/package_level/local_setup.bash.in
|
||||
|
||||
# source local_setup.sh from same directory as this file
|
||||
_this_path=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" && pwd)
|
||||
# provide AMENT_CURRENT_PREFIX to shell script
|
||||
AMENT_CURRENT_PREFIX=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`/../.." && pwd)
|
||||
# store AMENT_CURRENT_PREFIX to restore it before each environment hook
|
||||
_package_local_setup_AMENT_CURRENT_PREFIX=$AMENT_CURRENT_PREFIX
|
||||
|
||||
# trace output
|
||||
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
|
||||
echo "# . \"$_this_path/local_setup.sh\""
|
||||
fi
|
||||
. "$_this_path/local_setup.sh"
|
||||
unset _this_path
|
||||
|
||||
# unset AMENT_ENVIRONMENT_HOOKS
|
||||
# if not appending to them for return
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
# restore AMENT_CURRENT_PREFIX before evaluating the environment hooks
|
||||
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
|
||||
# list all environment hooks of this package
|
||||
|
||||
# source all shell-specific environment hooks of this package
|
||||
# if not returning them
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
_package_local_setup_IFS=$IFS
|
||||
IFS=":"
|
||||
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
|
||||
# restore AMENT_CURRENT_PREFIX for each environment hook
|
||||
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
|
||||
# restore IFS before sourcing other files
|
||||
IFS=$_package_local_setup_IFS
|
||||
. "$_hook"
|
||||
done
|
||||
unset _hook
|
||||
IFS=$_package_local_setup_IFS
|
||||
unset _package_local_setup_IFS
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
unset _package_local_setup_AMENT_CURRENT_PREFIX
|
||||
unset AMENT_CURRENT_PREFIX
|
||||
@@ -0,0 +1,2 @@
|
||||
source;share/robotic_arm/environment/ament_prefix_path.sh
|
||||
source;share/robotic_arm/environment/path.sh
|
||||
@@ -0,0 +1,184 @@
|
||||
# generated from ament_package/template/package_level/local_setup.sh.in
|
||||
|
||||
# since this file is sourced use either the provided AMENT_CURRENT_PREFIX
|
||||
# or fall back to the destination set at configure time
|
||||
: ${AMENT_CURRENT_PREFIX:="/home/quella/ROS2_WS/simulation_ws/robotic_arm/install/robotic_arm"}
|
||||
if [ ! -d "$AMENT_CURRENT_PREFIX" ]; then
|
||||
if [ -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
echo "The compile time prefix path '$AMENT_CURRENT_PREFIX' doesn't " \
|
||||
"exist. Consider sourcing a different extension than '.sh'." 1>&2
|
||||
else
|
||||
AMENT_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
fi
|
||||
fi
|
||||
|
||||
# function to append values to environment variables
|
||||
# using colons as separators and avoiding leading separators
|
||||
ament_append_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
#echo "listname $_listname"
|
||||
#eval echo "list value \$$_listname"
|
||||
#echo "value $_value"
|
||||
|
||||
# avoid leading separator
|
||||
eval _values=\"\$$_listname\"
|
||||
if [ -z "$_values" ]; then
|
||||
eval export $_listname=\"$_value\"
|
||||
#eval echo "set list \$$_listname"
|
||||
else
|
||||
# field separator must not be a colon
|
||||
_ament_append_value_IFS=$IFS
|
||||
unset IFS
|
||||
eval export $_listname=\"\$$_listname:$_value\"
|
||||
#eval echo "append list \$$_listname"
|
||||
IFS=$_ament_append_value_IFS
|
||||
unset _ament_append_value_IFS
|
||||
fi
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# function to append non-duplicate values to environment variables
|
||||
# using colons as separators and avoiding leading separators
|
||||
ament_append_unique_value() {
|
||||
# arguments
|
||||
_listname=$1
|
||||
_value=$2
|
||||
#echo "listname $_listname"
|
||||
#eval echo "list value \$$_listname"
|
||||
#echo "value $_value"
|
||||
|
||||
# check if the list contains the value
|
||||
eval _values=\$$_listname
|
||||
_duplicate=
|
||||
_ament_append_unique_value_IFS=$IFS
|
||||
IFS=":"
|
||||
if [ "$AMENT_SHELL" = "zsh" ]; then
|
||||
ament_zsh_to_array _values
|
||||
fi
|
||||
for _item in $_values; do
|
||||
# ignore empty strings
|
||||
if [ -z "$_item" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ $_item = $_value ]; then
|
||||
_duplicate=1
|
||||
fi
|
||||
done
|
||||
unset _item
|
||||
|
||||
# append only non-duplicates
|
||||
if [ -z "$_duplicate" ]; then
|
||||
# avoid leading separator
|
||||
if [ -z "$_values" ]; then
|
||||
eval $_listname=\"$_value\"
|
||||
#eval echo "set list \$$_listname"
|
||||
else
|
||||
# field separator must not be a colon
|
||||
unset IFS
|
||||
eval $_listname=\"\$$_listname:$_value\"
|
||||
#eval echo "append list \$$_listname"
|
||||
fi
|
||||
fi
|
||||
IFS=$_ament_append_unique_value_IFS
|
||||
unset _ament_append_unique_value_IFS
|
||||
unset _duplicate
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# function to prepend non-duplicate values to environment variables
|
||||
# using colons as separators and avoiding trailing separators
|
||||
ament_prepend_unique_value() {
|
||||
# arguments
|
||||
_listname="$1"
|
||||
_value="$2"
|
||||
#echo "listname $_listname"
|
||||
#eval echo "list value \$$_listname"
|
||||
#echo "value $_value"
|
||||
|
||||
# check if the list contains the value
|
||||
eval _values=\"\$$_listname\"
|
||||
_duplicate=
|
||||
_ament_prepend_unique_value_IFS=$IFS
|
||||
IFS=":"
|
||||
if [ "$AMENT_SHELL" = "zsh" ]; then
|
||||
ament_zsh_to_array _values
|
||||
fi
|
||||
for _item in $_values; do
|
||||
# ignore empty strings
|
||||
if [ -z "$_item" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "$_item" = "$_value" ]; then
|
||||
_duplicate=1
|
||||
fi
|
||||
done
|
||||
unset _item
|
||||
|
||||
# prepend only non-duplicates
|
||||
if [ -z "$_duplicate" ]; then
|
||||
# avoid trailing separator
|
||||
if [ -z "$_values" ]; then
|
||||
eval export $_listname=\"$_value\"
|
||||
#eval echo "set list \$$_listname"
|
||||
else
|
||||
# field separator must not be a colon
|
||||
unset IFS
|
||||
eval export $_listname=\"$_value:\$$_listname\"
|
||||
#eval echo "prepend list \$$_listname"
|
||||
fi
|
||||
fi
|
||||
IFS=$_ament_prepend_unique_value_IFS
|
||||
unset _ament_prepend_unique_value_IFS
|
||||
unset _duplicate
|
||||
unset _values
|
||||
|
||||
unset _value
|
||||
unset _listname
|
||||
}
|
||||
|
||||
# unset AMENT_ENVIRONMENT_HOOKS
|
||||
# if not appending to them for return
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
# list all environment hooks of this package
|
||||
ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/robotic_arm/environment/ament_prefix_path.sh"
|
||||
ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/robotic_arm/environment/path.sh"
|
||||
|
||||
# source all shell-specific environment hooks of this package
|
||||
# if not returning them
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
_package_local_setup_IFS=$IFS
|
||||
IFS=":"
|
||||
if [ "$AMENT_SHELL" = "zsh" ]; then
|
||||
ament_zsh_to_array AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
|
||||
if [ -f "$_hook" ]; then
|
||||
# restore IFS before sourcing other files
|
||||
IFS=$_package_local_setup_IFS
|
||||
# trace output
|
||||
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
|
||||
echo "# . \"$_hook\""
|
||||
fi
|
||||
. "$_hook"
|
||||
fi
|
||||
done
|
||||
unset _hook
|
||||
IFS=$_package_local_setup_IFS
|
||||
unset _package_local_setup_IFS
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
# reset AMENT_CURRENT_PREFIX after each package
|
||||
# allowing to source multiple package-level setup files
|
||||
unset AMENT_CURRENT_PREFIX
|
||||
@@ -0,0 +1,59 @@
|
||||
# generated from ament_package/template/package_level/local_setup.zsh.in
|
||||
|
||||
AMENT_SHELL=zsh
|
||||
|
||||
# source local_setup.sh from same directory as this file
|
||||
_this_path=$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)
|
||||
# provide AMENT_CURRENT_PREFIX to shell script
|
||||
AMENT_CURRENT_PREFIX=$(builtin cd -q "`dirname "${(%):-%N}"`/../.." > /dev/null && pwd)
|
||||
# store AMENT_CURRENT_PREFIX to restore it before each environment hook
|
||||
_package_local_setup_AMENT_CURRENT_PREFIX=$AMENT_CURRENT_PREFIX
|
||||
|
||||
# function to convert array-like strings into arrays
|
||||
# to wordaround SH_WORD_SPLIT not being set
|
||||
ament_zsh_to_array() {
|
||||
local _listname=$1
|
||||
local _dollar="$"
|
||||
local _split="{="
|
||||
local _to_array="(\"$_dollar$_split$_listname}\")"
|
||||
eval $_listname=$_to_array
|
||||
}
|
||||
|
||||
# trace output
|
||||
if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
|
||||
echo "# . \"$_this_path/local_setup.sh\""
|
||||
fi
|
||||
# the package-level local_setup file unsets AMENT_CURRENT_PREFIX
|
||||
. "$_this_path/local_setup.sh"
|
||||
unset _this_path
|
||||
|
||||
# unset AMENT_ENVIRONMENT_HOOKS
|
||||
# if not appending to them for return
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
# restore AMENT_CURRENT_PREFIX before evaluating the environment hooks
|
||||
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
|
||||
# list all environment hooks of this package
|
||||
|
||||
# source all shell-specific environment hooks of this package
|
||||
# if not returning them
|
||||
if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
|
||||
_package_local_setup_IFS=$IFS
|
||||
IFS=":"
|
||||
for _hook in $AMENT_ENVIRONMENT_HOOKS; do
|
||||
# restore AMENT_CURRENT_PREFIX for each environment hook
|
||||
AMENT_CURRENT_PREFIX=$_package_local_setup_AMENT_CURRENT_PREFIX
|
||||
# restore IFS before sourcing other files
|
||||
IFS=$_package_local_setup_IFS
|
||||
. "$_hook"
|
||||
done
|
||||
unset _hook
|
||||
IFS=$_package_local_setup_IFS
|
||||
unset _package_local_setup_IFS
|
||||
unset AMENT_ENVIRONMENT_HOOKS
|
||||
fi
|
||||
|
||||
unset _package_local_setup_AMENT_CURRENT_PREFIX
|
||||
unset AMENT_CURRENT_PREFIX
|
||||
@@ -0,0 +1,39 @@
|
||||
# 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/robotic_arm/package.sh"
|
||||
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_bash_COLCON_CURRENT_PREFIX"
|
||||
|
||||
# source bash hooks
|
||||
_colcon_package_bash_source_script "$COLCON_CURRENT_PREFIX/share/robotic_arm/local_setup.bash"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
unset _colcon_package_bash_source_script
|
||||
unset _colcon_package_bash_COLCON_CURRENT_PREFIX
|
||||
@@ -0,0 +1,8 @@
|
||||
source;share/robotic_arm/hook/cmake_prefix_path.ps1
|
||||
source;share/robotic_arm/hook/cmake_prefix_path.dsv
|
||||
source;share/robotic_arm/hook/cmake_prefix_path.sh
|
||||
source;share/robotic_arm/local_setup.bash
|
||||
source;share/robotic_arm/local_setup.dsv
|
||||
source;share/robotic_arm/local_setup.ps1
|
||||
source;share/robotic_arm/local_setup.sh
|
||||
source;share/robotic_arm/local_setup.zsh
|
||||
@@ -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/robotic_arm/hook/cmake_prefix_path.ps1"
|
||||
colcon_package_source_powershell_script "$env:COLCON_CURRENT_PREFIX\share/robotic_arm/local_setup.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="/home/quella/ROS2_WS/simulation_ws/robotic_arm/install/robotic_arm"
|
||||
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/robotic_arm/hook/cmake_prefix_path.sh"
|
||||
_colcon_package_sh_source_script "$COLCON_CURRENT_PREFIX/share/robotic_arm/local_setup.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,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>robotic_arm</name>
|
||||
<version>0.0.0</version>
|
||||
<description>TODO: Package description</description>
|
||||
<maintainer email="2892744389@qq.com">quella</maintainer>
|
||||
<license>Apache-2.0</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<depend>rclcpp</depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,50 @@
|
||||
# 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/robotic_arm/package.sh"
|
||||
unset convert_zsh_to_array
|
||||
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced scripts
|
||||
COLCON_CURRENT_PREFIX="$_colcon_package_zsh_COLCON_CURRENT_PREFIX"
|
||||
|
||||
# source zsh hooks
|
||||
_colcon_package_zsh_source_script "$COLCON_CURRENT_PREFIX/share/robotic_arm/local_setup.zsh"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
|
||||
unset _colcon_package_zsh_source_script
|
||||
unset _colcon_package_zsh_COLCON_CURRENT_PREFIX
|
||||
@@ -0,0 +1,191 @@
|
||||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 78
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /RobotModel1
|
||||
- /TF1
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 1071
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
- Class: rviz_common/Time
|
||||
Experimental: false
|
||||
Name: Time
|
||||
SyncMode: 0
|
||||
SyncSource: ""
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
- Alpha: 1
|
||||
Class: rviz_default_plugins/RobotModel
|
||||
Collision Enabled: false
|
||||
Description File: ""
|
||||
Description Source: Topic
|
||||
Description Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /robot_description
|
||||
Enabled: true
|
||||
Links:
|
||||
All Links Enabled: true
|
||||
Expand Joint Details: false
|
||||
Expand Link Details: false
|
||||
Expand Tree: false
|
||||
Link Tree Style: Links in Alphabetic Order
|
||||
base_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
link1:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Value: true
|
||||
Mass Properties:
|
||||
Inertia: false
|
||||
Mass: false
|
||||
Name: RobotModel
|
||||
TF Prefix: ""
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
Visual Enabled: true
|
||||
- Class: rviz_default_plugins/TF
|
||||
Enabled: true
|
||||
Frame Timeout: 15
|
||||
Frames:
|
||||
All Enabled: true
|
||||
base_link:
|
||||
Value: true
|
||||
link1:
|
||||
Value: true
|
||||
Marker Scale: 1
|
||||
Name: TF
|
||||
Show Arrows: true
|
||||
Show Axes: true
|
||||
Show Names: false
|
||||
Tree:
|
||||
base_link:
|
||||
link1:
|
||||
{}
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: base_link
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Covariance x: 0.25
|
||||
Covariance y: 0.25
|
||||
Covariance yaw: 0.06853891909122467
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 1.817091703414917
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.33039820194244385
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 6.238584518432617
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 1368
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd000000040000000000000156000004bafc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000004ba000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000004bafc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000004ba000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000008cf0000003efc0100000002fb0000000800540069006d00650100000000000008cf000002fb00fffffffb0000000800540069006d006501000000000000045000000000000000000000065e000004ba00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
Time:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 2255
|
||||
X: 70
|
||||
Y: 27
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
||||
<!-- 颜色 -->
|
||||
<material name="blue">
|
||||
<color rgba="0.0 0.0 0.8 1.0" />
|
||||
</material>
|
||||
|
||||
<material name="orange">
|
||||
<color rgba="1.0 0.5 0.0 1.0" />
|
||||
</material>
|
||||
|
||||
<material name="grey">
|
||||
<color rgba="0.5 0.5 0.5 1.0" />
|
||||
</material>
|
||||
|
||||
<material name="white">
|
||||
<color rgba="1.0 1.0 1.0 1.0" />
|
||||
</material>
|
||||
</robot>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot name="robotic_arm" xmlns:xacro="http://www.ros.org/wiki/xacro">
|
||||
<xacro:include filename="$(find robotic_arm)/urdf/materials.xacro" />
|
||||
|
||||
<!-- 底座连杆 -->
|
||||
<link name="base_link">
|
||||
<visual>
|
||||
<geometry>
|
||||
<cylinder radius="0.1" length="0.05" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.025" rpy="0.0 0.0 0.0" />
|
||||
<material name="grey" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<cylinder radius="0.1" length="0.05" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.025" rpy="0.0 0.0 0.0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="1.0" />
|
||||
<origin xyz="0.0 0.0 0.025" />
|
||||
<inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节1:底座旋转 -->
|
||||
<joint name="joint1" type="revolute">
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
|
||||
<parent link="base_link" />
|
||||
<child link="link1" />
|
||||
<axis xyz="0.0 0.0 1.0" />
|
||||
<limit lower="-3.14159" upper="3.14159" effort="100.0" velocity="1.0" />
|
||||
<!-- 阻尼系数和摩擦系数,模拟运动阻力和摩擦力 -->
|
||||
<dynamics damping="0.1" friction="0.1" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆1 -->
|
||||
<link name="link1">
|
||||
<visual>
|
||||
<geometry>
|
||||
<box size="0.08 0.08 0.15" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.075" rpy="0.0 0.0 0.0" />
|
||||
<material name="blue" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<box size="0.08 0.08 0.15" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.075" rpy="0.0 0.0 0.0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.8" />
|
||||
<origin xyz="0 0 0.075" />
|
||||
<inertia ixx="0.005" ixy="0" ixz="0" iyy="0.005" iyz="0" izz="0.003" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节2:肩部俯仰 -->
|
||||
<joint name="joint2" type="revolute">
|
||||
<parent link="link1" />
|
||||
<child link="link2" />
|
||||
<origin xyz="0.0 0.0 0.15" rpy="0.0 0.0 0.0" />
|
||||
<axis xyz="0.0 1.0 0.0" />
|
||||
<limit lower="-1.5708" upper="1.5708" effort="100.0" velocity="1.0" />
|
||||
<!-- 阻尼系数和摩擦系数,模拟运动阻力和摩擦力 -->
|
||||
<dynamics damping="0.1" friction="0.1" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆2 -->
|
||||
<link name="link2">
|
||||
<visual>
|
||||
<geometry>
|
||||
<box size="0.06 0.06 0.20" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.10" rpy="0.0 0.0 0.0" />
|
||||
<material name="orange" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<box size="0.06 0.06 0.20" />
|
||||
</geometry>
|
||||
<origin xyz="0.0 0.0 0.10" rpy="0.0 0.0 0.0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.6" />
|
||||
<origin xyz="0 0 0.10" />
|
||||
<inertia ixx="0.003" ixy="0" ixz="0" iyy="0.003" iyz="0" izz="0.002" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节3: 肘部俯仰 -->
|
||||
<joint name="joint3" type="revolute">
|
||||
<parent link="link2" />
|
||||
<child link="link3" />
|
||||
<origin xyz="0 0 0.20" rpy="0 0 0" />
|
||||
<axis xyz="0 1 0" />
|
||||
<limit lower="-1.5708" upper="1.5708" effort="80" velocity="1.0" />
|
||||
<dynamics damping="0.1" friction="0.1" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆3 -->
|
||||
<link name="link3">
|
||||
<visual>
|
||||
<geometry>
|
||||
<box size="0.055 0.055 0.18" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.09" rpy="0 0 0" />
|
||||
<material name="blue" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<box size="0.055 0.055 0.18" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.09" rpy="0 0 0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.5" />
|
||||
<origin xyz="0 0 0.09" />
|
||||
<inertia ixx="0.002" ixy="0" ixz="0" iyy="0.002" iyz="0" izz="0.001" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节4: 腕部滚转 -->
|
||||
<joint name="joint4" type="revolute">
|
||||
<parent link="link3" />
|
||||
<child link="link4" />
|
||||
<origin xyz="0 0 0.18" rpy="0 0 0" />
|
||||
<axis xyz="0 0 1" />
|
||||
<limit lower="-3.14159" upper="3.14159" effort="50" velocity="1.5" />
|
||||
<dynamics damping="0.05" friction="0.05" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆4 -->
|
||||
<link name="link4">
|
||||
<visual>
|
||||
<geometry>
|
||||
<box size="0.05 0.05 0.14" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.07" rpy="0 0 0" />
|
||||
<material name="orange" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<box size="0.05 0.05 0.14" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.07" rpy="0 0 0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.3" />
|
||||
<origin xyz="0 0 0.07" />
|
||||
<inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节5: 腕部俯仰 -->
|
||||
<joint name="joint5" type="revolute">
|
||||
<parent link="link4" />
|
||||
<child link="link5" />
|
||||
<origin xyz="0 0 0.14" rpy="0 0 0" />
|
||||
<axis xyz="0 1 0" />
|
||||
<limit lower="-1.5708" upper="1.5708" effort="30" velocity="1.5" />
|
||||
<dynamics damping="0.05" friction="0.05" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆5 -->
|
||||
<link name="link5">
|
||||
<visual>
|
||||
<geometry>
|
||||
<box size="0.045 0.045 0.10" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.05" rpy="0 0 0" />
|
||||
<material name="blue" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<box size="0.045 0.045 0.10" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.05" rpy="0 0 0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.2" />
|
||||
<origin xyz="0 0 0.05" />
|
||||
<inertia ixx="0.0005" ixy="0" ixz="0" iyy="0.0005" iyz="0" izz="0.0003" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 关节6: 腕部偏航 -->
|
||||
<joint name="joint6" type="revolute">
|
||||
<parent link="link5" />
|
||||
<child link="link6" />
|
||||
<origin xyz="0 0 0.10" rpy="0 0 0" />
|
||||
<axis xyz="0 0 1" />
|
||||
<limit lower="-3.14159" upper="3.14159" effort="20" velocity="2.0" />
|
||||
<dynamics damping="0.05" friction="0.05" />
|
||||
</joint>
|
||||
|
||||
<!-- 连杆6 (末端执行器) -->
|
||||
<link name="link6">
|
||||
<visual>
|
||||
<geometry>
|
||||
<cylinder radius="0.03" length="0.06" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.03" rpy="0 0 0" />
|
||||
<material name="grey" />
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<cylinder radius="0.03" length="0.06" />
|
||||
</geometry>
|
||||
<origin xyz="0 0 0.03" rpy="0 0 0" />
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.1" />
|
||||
<origin xyz="0 0 0.03" />
|
||||
<inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<!-- 末端执行器固定关节 -->
|
||||
<joint name="end_effector_fixed" type="fixed">
|
||||
<parent link="link6" />
|
||||
<child link="end_effector" />
|
||||
<origin xyz="0 0 0.06" rpy="0 0 0" />
|
||||
</joint>
|
||||
|
||||
<link name="end_effector" />
|
||||
|
||||
</robot>
|
||||
31
simulation_ws/robotic_arm/install/setup.bash
Normal file
31
simulation_ws/robotic_arm/install/setup.bash
Normal file
@@ -0,0 +1,31 @@
|
||||
# generated from colcon_bash/shell/template/prefix_chain.bash.em
|
||||
|
||||
# This script extends the environment with the environment of other prefix
|
||||
# paths which were sourced when this file was generated as well as all packages
|
||||
# contained in this prefix path.
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_chain_bash_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source chained prefixes
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||
COLCON_CURRENT_PREFIX="/opt/ros/humble"
|
||||
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
|
||||
|
||||
# source this prefix
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||
COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)"
|
||||
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
unset _colcon_prefix_chain_bash_source_script
|
||||
29
simulation_ws/robotic_arm/install/setup.ps1
Normal file
29
simulation_ws/robotic_arm/install/setup.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
# generated from colcon_powershell/shell/template/prefix_chain.ps1.em
|
||||
|
||||
# This script extends the environment with the environment of other prefix
|
||||
# paths which were sourced when this file was generated as well as all packages
|
||||
# contained in this prefix path.
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
function _colcon_prefix_chain_powershell_source_script {
|
||||
param (
|
||||
$_colcon_prefix_chain_powershell_source_script_param
|
||||
)
|
||||
# source script with conditional trace output
|
||||
if (Test-Path $_colcon_prefix_chain_powershell_source_script_param) {
|
||||
if ($env:COLCON_TRACE) {
|
||||
echo ". '$_colcon_prefix_chain_powershell_source_script_param'"
|
||||
}
|
||||
. "$_colcon_prefix_chain_powershell_source_script_param"
|
||||
} else {
|
||||
Write-Error "not found: '$_colcon_prefix_chain_powershell_source_script_param'"
|
||||
}
|
||||
}
|
||||
|
||||
# source chained prefixes
|
||||
_colcon_prefix_chain_powershell_source_script "/opt/ros/humble\local_setup.ps1"
|
||||
|
||||
# source this prefix
|
||||
$env:COLCON_CURRENT_PREFIX=(Split-Path $PSCommandPath -Parent)
|
||||
_colcon_prefix_chain_powershell_source_script "$env:COLCON_CURRENT_PREFIX\local_setup.ps1"
|
||||
45
simulation_ws/robotic_arm/install/setup.sh
Normal file
45
simulation_ws/robotic_arm/install/setup.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
# generated from colcon_core/shell/template/prefix_chain.sh.em
|
||||
|
||||
# This script extends the environment with the environment of other prefix
|
||||
# paths which were sourced when this file was generated as well as all packages
|
||||
# contained in this prefix path.
|
||||
|
||||
# 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_prefix_chain_sh_COLCON_CURRENT_PREFIX=/home/quella/ROS2_WS/simulation_ws/robotic_arm/install
|
||||
if [ ! -z "$COLCON_CURRENT_PREFIX" ]; then
|
||||
_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
|
||||
elif [ ! -d "$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX" ]; then
|
||||
echo "The build time path \"$_colcon_prefix_chain_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_prefix_chain_sh_COLCON_CURRENT_PREFIX
|
||||
return 1
|
||||
fi
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_chain_sh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source chained prefixes
|
||||
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script
|
||||
COLCON_CURRENT_PREFIX="/opt/ros/humble"
|
||||
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
|
||||
|
||||
|
||||
# source this prefix
|
||||
# setting COLCON_CURRENT_PREFIX avoids relying on the build time prefix of the sourced script
|
||||
COLCON_CURRENT_PREFIX="$_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX"
|
||||
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"
|
||||
|
||||
unset _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX
|
||||
unset _colcon_prefix_chain_sh_source_script
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
31
simulation_ws/robotic_arm/install/setup.zsh
Normal file
31
simulation_ws/robotic_arm/install/setup.zsh
Normal file
@@ -0,0 +1,31 @@
|
||||
# generated from colcon_zsh/shell/template/prefix_chain.zsh.em
|
||||
|
||||
# This script extends the environment with the environment of other prefix
|
||||
# paths which were sourced when this file was generated as well as all packages
|
||||
# contained in this prefix path.
|
||||
|
||||
# function to source another script with conditional trace output
|
||||
# first argument: the path of the script
|
||||
_colcon_prefix_chain_zsh_source_script() {
|
||||
if [ -f "$1" ]; then
|
||||
if [ -n "$COLCON_TRACE" ]; then
|
||||
echo "# . \"$1\""
|
||||
fi
|
||||
. "$1"
|
||||
else
|
||||
echo "not found: \"$1\"" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# source chained prefixes
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||
COLCON_CURRENT_PREFIX="/opt/ros/humble"
|
||||
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
|
||||
|
||||
# source this prefix
|
||||
# setting COLCON_CURRENT_PREFIX avoids determining the prefix in the sourced script
|
||||
COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && pwd)"
|
||||
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"
|
||||
|
||||
unset COLCON_CURRENT_PREFIX
|
||||
unset _colcon_prefix_chain_zsh_source_script
|
||||
Reference in New Issue
Block a user