Refactor tool management and update robot configuration
- Updated iiwa7.srdf to streamline group and end effector definitions, removing unnecessary joint specifications. - Enhanced setting.yaml to include active tool configuration. - Removed deprecated gripper URDF and Xacro files, consolidating tool definitions into tools.yaml. - Introduced tool_manager.py for dynamic tool management, allowing for easy updates to active tools and collision settings. - Created tool_active.xacro to reflect the currently active tool in the robot's URDF. - Added comprehensive collision management for the new tool configurations.
This commit is contained in:
+10
-7
@@ -18,7 +18,7 @@ digital_twin:
|
||||
controller_timer: "50"
|
||||
|
||||
cameras:
|
||||
- pkg://iiwa_config/config/cameras/d455_top.yaml
|
||||
- pkg://iiwa_config/config/cameras/d455_top.yaml
|
||||
|
||||
rviz:
|
||||
config: pkg://iiwa_config/config/rviz/rviz_moveit.rviz
|
||||
@@ -36,6 +36,9 @@ controller:
|
||||
moveit_cpp: pkg://iiwa_config/config/moveit/moveit_cpp.yaml
|
||||
|
||||
|
||||
tool:
|
||||
active: "patron" # Активный инструмент: none | patron | ... (из tools.yaml)
|
||||
|
||||
planning:
|
||||
pose_link: "tcp" # TCP-линк для декартовых целей
|
||||
planning_group: "iiwa_arm" # Группа планирования из SRDF
|
||||
@@ -68,12 +71,12 @@ foxglove:
|
||||
send_buffer_limit: 10000000 # Максимальный размер буфера отправки в байтах (защита от OOM при медленном клиенте)
|
||||
use_sim_time: false # Использовать симуляционное время /clock вместо системного
|
||||
capabilities: # Список возможностей, открытых клиенту
|
||||
- clientPublish
|
||||
- parameters
|
||||
- parametersSubscribe
|
||||
- services
|
||||
- connectionGraph
|
||||
- assets
|
||||
- clientPublish
|
||||
- parameters
|
||||
- parametersSubscribe
|
||||
- services
|
||||
- connectionGraph
|
||||
- assets
|
||||
include_hidden: false # Показывать клиенту скрытые топики и сервисы (начинаются с _)
|
||||
asset_uri_allowlist: ['^package://(?:[-\w%]+/)*[-\w%.]+\.(?:dae|fbx|glb|gltf|jpeg|jpg|mtl|obj|png|stl|tif|tiff|urdf|webp|xacro)$'] # Regex-список URI вида package://..., из которых bridge разрешает отдавать файлы-ассеты (URDF, mesh и т.п.)
|
||||
ignore_unresponsive_param_nodes: true # Не падать, если нода не отвечает на запросы параметров (защита от зависания при старте)
|
||||
@@ -17,6 +17,12 @@ from cobot.tui import SCREEN_CSS, InputScreen, PickScreen
|
||||
_PROJECT_DIR = Path(__file__).parent.parent.parent
|
||||
_CONFIG_PATH = _PROJECT_DIR / "cobot-setting.yaml"
|
||||
|
||||
_TOOLS_YAML = _PROJECT_DIR / "src" / "iiwa_config" / "config" / "tools.yaml"
|
||||
_TOOL_ACTIVE_XACRO = (
|
||||
_PROJECT_DIR / "src" / "iiwa_description" / "urdf" / "tools" / "tool_active.xacro"
|
||||
)
|
||||
_SRDF_PATH = _PROJECT_DIR / "src" / "iiwa_config" / "config" / "moveit" / "iiwa7.srdf"
|
||||
|
||||
# Use ruamel.yaml instead of PyYAML so comments and formatting in the config file are preserved.
|
||||
# Используем ruamel.yaml вместо PyYAML, чтобы комментарии и форматирование в конфиге сохранялись.
|
||||
_yaml = YAML()
|
||||
@@ -48,6 +54,41 @@ class _Block:
|
||||
fields: List[_Field]
|
||||
|
||||
|
||||
def _load_tools_registry() -> dict:
|
||||
"""Читает tools.yaml и возвращает словарь инструментов."""
|
||||
if not _TOOLS_YAML.exists():
|
||||
return {}
|
||||
_y = YAML()
|
||||
with open(_TOOLS_YAML, encoding="utf-8") as f:
|
||||
data = _y.load(f)
|
||||
return dict(data.get("tools", {}))
|
||||
|
||||
|
||||
def _build_tool_block() -> Optional[_Block]:
|
||||
"""Строит блок выбора инструмента из реестра tools.yaml.
|
||||
Возвращает None если реестр недоступен."""
|
||||
registry = _load_tools_registry()
|
||||
if not registry:
|
||||
return None
|
||||
options = list(registry.keys())
|
||||
labels = " | ".join(
|
||||
f"{name}: {registry[name].get('label', '')}" for name in options
|
||||
)
|
||||
return _Block(
|
||||
yaml_key="tool",
|
||||
title="Tool / End-effector",
|
||||
fields=[
|
||||
_Field(
|
||||
"active",
|
||||
"Выберите активный инструмент:",
|
||||
options[0],
|
||||
note=labels,
|
||||
options=options,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
# All configuration blocks. Each block maps to a top-level key in cobot-setting.yaml.
|
||||
# Все блоки конфигурации. Каждый блок соответствует ключу верхнего уровня в cobot-setting.yaml.
|
||||
_BLOCKS: List[_Block] = [
|
||||
@@ -75,8 +116,6 @@ _BLOCKS: List[_Block] = [
|
||||
yaml_key="planning",
|
||||
title="MoveIt planning",
|
||||
fields=[
|
||||
_Field("pose_link", "TCP link name:", "tcp",
|
||||
note="Link used as the end-effector for Cartesian goals (defined in URDF/SRDF)"),
|
||||
_Field("planning_group", "Planning group:", "iiwa_arm",
|
||||
note="MoveIt planning group as defined in the SRDF"),
|
||||
_Field("default_frame", "Default reference frame:", "base_link"),
|
||||
@@ -204,14 +243,15 @@ class _Wizard(App[None]):
|
||||
"""
|
||||
CSS = SCREEN_CSS
|
||||
|
||||
def __init__(self, data: Any):
|
||||
def __init__(self, data: Any, extra_blocks: Optional[List[_Block]] = None):
|
||||
super().__init__()
|
||||
self._data = data
|
||||
self._blocks = list(_BLOCKS)
|
||||
self._blocks = list(extra_blocks or []) + list(_BLOCKS)
|
||||
self._block_idx = 0
|
||||
self._field_idx = 0
|
||||
self._current_block: Optional[_Block] = None
|
||||
self._pending_fields: List[_Field] = []
|
||||
self.did_save = False
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self._next_block()
|
||||
@@ -221,6 +261,7 @@ class _Wizard(App[None]):
|
||||
# All blocks done - save and show the confirmation screen.
|
||||
# Все блоки пройдены - сохраняем и показываем экран подтверждения.
|
||||
_save_config(self._data)
|
||||
self.did_save = True
|
||||
self.push_screen(_SavedScreen(), lambda _: self.exit())
|
||||
return
|
||||
block = self._blocks[self._block_idx]
|
||||
@@ -317,10 +358,60 @@ def register(subparsers: argparse._SubParsersAction) -> None:
|
||||
|
||||
|
||||
def run(args: argparse.Namespace) -> None:
|
||||
from rich.console import Console
|
||||
console = Console()
|
||||
|
||||
if not _CONFIG_PATH.exists():
|
||||
from rich.console import Console
|
||||
Console().print(f"[red]Config not found:[/red] {_CONFIG_PATH}")
|
||||
console.print(f"[red]Config not found:[/red] {_CONFIG_PATH}")
|
||||
sys.exit(1)
|
||||
|
||||
data = _load_config()
|
||||
_Wizard(data).run()
|
||||
|
||||
# Убеждаемся что секция tool существует в данных (для старых конфигов)
|
||||
if "tool" not in data:
|
||||
data["tool"] = {"active": "patron"}
|
||||
|
||||
tool_block = _build_tool_block()
|
||||
extra = [tool_block] if tool_block else []
|
||||
|
||||
wizard = _Wizard(data, extra_blocks=extra)
|
||||
wizard.run()
|
||||
|
||||
if not wizard.did_save:
|
||||
return
|
||||
|
||||
# Применяем выбранный инструмент: перезаписываем tool_active.xacro и iiwa7.srdf
|
||||
active_tool = str(data["tool"].get("active", "patron"))
|
||||
if _TOOLS_YAML.exists():
|
||||
try:
|
||||
registry = _load_tools_registry()
|
||||
if active_tool not in registry:
|
||||
raise ValueError(
|
||||
f"Unknown tool '{active_tool}'. Available: {', '.join(registry)}"
|
||||
)
|
||||
tool_cfg = dict(registry[active_tool])
|
||||
|
||||
import sys as _sys
|
||||
_sys.path.insert(0, str(_PROJECT_DIR / "src" / "iiwa_utils"))
|
||||
from iiwa_utils.tool_manager import apply_tool
|
||||
apply_tool(
|
||||
tool_cfg=tool_cfg,
|
||||
xacro_out_path=_TOOL_ACTIVE_XACRO,
|
||||
srdf_path=_SRDF_PATH,
|
||||
)
|
||||
|
||||
# Синхронизируем planning.pose_link с tcp_link выбранного инструмента
|
||||
tcp_link = tool_cfg.get("tcp_link", "link_ee")
|
||||
if "planning" in data:
|
||||
data["planning"]["pose_link"] = tcp_link
|
||||
_save_config(data)
|
||||
|
||||
console.print(
|
||||
f"[green]✓[/green] Tool [bold]{active_tool}[/bold] applied: "
|
||||
f"tool_active.xacro, iiwa7.srdf updated, "
|
||||
f"planning.pose_link → [bold]{tcp_link}[/bold]."
|
||||
)
|
||||
except Exception as exc:
|
||||
console.print(f"[red]Tool apply failed:[/red] {exc}")
|
||||
else:
|
||||
console.print(f"[yellow]tools.yaml not found at {_TOOLS_YAML} — skipping tool apply[/yellow]")
|
||||
|
||||
@@ -1,32 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--This does not replace URDF, and is not an extension of URDF.
|
||||
This is a format for representing semantic information about the robot structure.
|
||||
A URDF file must exist for this robot as well, where the joints and the links that are referenced are defined
|
||||
-->
|
||||
<!-- AUTO-GENERATED by cobot robot-setup — do not edit manually -->
|
||||
<robot name="iiwa7">
|
||||
<!--GROUPS: Representation of a set of joints and links. This can be useful for specifying DOF to plan for, defining arms, end effectors, etc-->
|
||||
<!--LINKS: When a link is specified, the parent joint of that link (if it exists) is automatically included-->
|
||||
<!--JOINTS: When a joint is specified, the child link of that joint (which will always exist) is automatically included-->
|
||||
<!--CHAINS: When a chain is specified, all the links along the chain (including endpoints) are included in the group. Additionally, all the joints that are parents to included links are also included. This means that joints along the chain and the parent joint of the base link are included in the group-->
|
||||
<!--SUBGROUPS: Groups can also be formed by referencing to already defined group names-->
|
||||
|
||||
<group name="iiwa_arm">
|
||||
<!-- <joint name="world_base_joint"/>
|
||||
<joint name="joint1"/>
|
||||
<joint name="joint2"/>
|
||||
<joint name="joint3"/>
|
||||
<joint name="joint4"/>
|
||||
<joint name="joint5"/>
|
||||
<joint name="joint6"/>
|
||||
<joint name="joint7"/>
|
||||
<joint name="tools_joint"/>
|
||||
<joint name="tool"/>
|
||||
<joint name="camera_holder_patron"/>
|
||||
<joint name="camera_holder_corner"/>
|
||||
<joint name="camera_corner_camera"/>
|
||||
<joint name="camera_hand_to_optical"/> -->
|
||||
<chain base_link="base_link" tip_link="patron"/>
|
||||
</group>
|
||||
<!--GROUP STATES: Purpose: Define a named state for a particular group, in terms of joint values. This is useful to define states like 'folded arms'-->
|
||||
|
||||
<group_state name="home" group="iiwa_arm">
|
||||
<joint name="joint1" value="0"/>
|
||||
<joint name="joint2" value="0"/>
|
||||
@@ -54,9 +33,9 @@
|
||||
<joint name="joint6" value="0"/>
|
||||
<joint name="joint7" value="0"/>
|
||||
</group_state>
|
||||
<!--END EFFECTOR: Purpose: Represent information about an end effector.-->
|
||||
|
||||
<end_effector name="patron" parent_link="patron" group="iiwa_arm"/>
|
||||
<!--DISABLE COLLISIONS: By default it is assumed that any link of the robot could potentially come into collision with any other link in the robot. This tag disables collision checking between a specified pair of links. -->
|
||||
|
||||
<disable_collisions link1="base_link" link2="link1" reason="Adjacent"/>
|
||||
<disable_collisions link1="base_link" link2="link2" reason="Never"/>
|
||||
<disable_collisions link1="base_link" link2="link3" reason="Never"/>
|
||||
@@ -67,26 +46,27 @@
|
||||
<disable_collisions link1="link1" link2="link5" reason="Never"/>
|
||||
<disable_collisions link1="link1" link2="link6" reason="Never"/>
|
||||
<disable_collisions link1="link1" link2="link7" reason="Never"/>
|
||||
<disable_collisions link1="link1" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="link3" reason="Adjacent"/>
|
||||
<disable_collisions link1="link2" link2="link4" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="link5" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="link6" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="link7" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link3" link2="link4" reason="Adjacent"/>
|
||||
<disable_collisions link1="link3" link2="link5" reason="Never"/>
|
||||
<disable_collisions link1="link3" link2="link6" reason="Never"/>
|
||||
<disable_collisions link1="link3" link2="link7" reason="Never"/>
|
||||
<disable_collisions link1="link3" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link4" link2="link5" reason="Adjacent"/>
|
||||
<disable_collisions link1="link4" link2="link6" reason="Never"/>
|
||||
<disable_collisions link1="link4" link2="link7" reason="Never"/>
|
||||
<disable_collisions link1="link4" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link5" link2="link6" reason="Adjacent"/>
|
||||
<disable_collisions link1="link5" link2="link7" reason="Never"/>
|
||||
<disable_collisions link1="link5" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link6" link2="link7" reason="Adjacent"/>
|
||||
|
||||
<disable_collisions link1="link1" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link2" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link3" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link4" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link5" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link6" link2="patron" reason="Never"/>
|
||||
<disable_collisions link1="link7" link2="patron" reason="Adjacent"/>
|
||||
<disable_collisions link1="link7" link2="camera_holder" reason="Adjacent"/>
|
||||
|
||||
@@ -36,6 +36,9 @@ controller:
|
||||
moveit_cpp: pkg://iiwa_config/config/moveit/moveit_cpp.yaml
|
||||
|
||||
|
||||
tool:
|
||||
active: "patron" # Активный инструмент: none | patron | ... (из tools.yaml)
|
||||
|
||||
planning:
|
||||
pose_link: "tcp" # TCP-линк для декартовых целей
|
||||
planning_group: "iiwa_arm" # Группа планирования из SRDF
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Реестр инструментов / захватов для KUKA iiwa7.
|
||||
#
|
||||
# Поля каждого инструмента:
|
||||
# label — название, отображаемое в меню robot-setup
|
||||
# xacro — путь до xacro-файла инструмента (xacro $(find ...) синтаксис);
|
||||
# null = без захвата (голый фланец)
|
||||
# tip_link — конец кинематической цепочки в SRDF (<chain tip_link="..."/>)
|
||||
# tcp_link — фрейм TCP для Декартовых целей (pose_link в planning)
|
||||
# collisions — пары disable_collisions специфичные для этого инструмента;
|
||||
# базовые пары робота (link1..link7) добавляются автоматически
|
||||
|
||||
tools:
|
||||
|
||||
none:
|
||||
label: "Без захвата"
|
||||
xacro: null
|
||||
tip_link: "link_ee"
|
||||
tcp_link: "link_ee"
|
||||
collisions: []
|
||||
|
||||
patron:
|
||||
label: "patron"
|
||||
xacro: "$(find iiwa_description)/urdf/tools/patron.xacro"
|
||||
tip_link: "patron"
|
||||
tcp_link: "tcp"
|
||||
collisions:
|
||||
- [link1, patron, Never]
|
||||
- [link2, patron, Never]
|
||||
- [link3, patron, Never]
|
||||
- [link4, patron, Never]
|
||||
- [link5, patron, Never]
|
||||
- [link6, patron, Never]
|
||||
- [link7, patron, Adjacent]
|
||||
- [link7, camera_holder, Adjacent]
|
||||
- [link6, camera_holder, Never]
|
||||
- [link5, camera_holder, Never]
|
||||
- [link4, camera_holder, Never]
|
||||
- [link3, camera_holder, Never]
|
||||
- [link2, camera_holder, Never]
|
||||
- [link1, camera_holder, Never]
|
||||
- [base_link, camera_holder, Never]
|
||||
- [camera_holder, patron, Adjacent]
|
||||
- [camera_holder, camera_corner, Adjacent]
|
||||
- [camera_corner, patron, Never]
|
||||
- [camera_corner, link7, Never]
|
||||
- [camera_corner, link6, Never]
|
||||
- [camera_corner, link5, Never]
|
||||
- [camera_corner, link4, Never]
|
||||
- [camera_corner, link3, Never]
|
||||
- [camera_corner, link2, Never]
|
||||
- [camera_corner, link1, Never]
|
||||
- [camera_corner, base_link, Never]
|
||||
- [camera_corner, camera_hand, Adjacent]
|
||||
- [camera_hand, camera_holder, Never]
|
||||
- [camera_hand, patron, Never]
|
||||
- [camera_hand, link7, Never]
|
||||
- [camera_hand, link6, Never]
|
||||
- [camera_hand, link5, Never]
|
||||
- [camera_hand, link4, Never]
|
||||
- [camera_hand, link3, Never]
|
||||
- [camera_hand, link2, Never]
|
||||
- [camera_hand, link1, Never]
|
||||
- [camera_hand, base_link, Never]
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot name="gripper">
|
||||
|
||||
<link name="base_frame">
|
||||
<visual>
|
||||
<origin xyz="-21 -21 6" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/base_frame.stl" />
|
||||
</geometry>
|
||||
<material name="black_plastic">
|
||||
<color rgba="0.05 0.05 0.05 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="-21 -21 6" rpy="0 0 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/base_frame.stl" />
|
||||
</geometry>
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.0"/>
|
||||
<origin xyz=" 0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="plate">
|
||||
<visual>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/plate.stl"/>
|
||||
</geometry>
|
||||
<material name="alum_plastic">
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/plate.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
<inertial>
|
||||
<mass value="0.0"/>
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
</link>
|
||||
|
||||
<link name="screw">
|
||||
<inertial>
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<mass value="0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
<visual name="">
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/screw.stl"/>
|
||||
</geometry>
|
||||
<material name="alum_plastic">
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
|
||||
|
||||
<link name="finger1">
|
||||
<inertial>
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<mass value="0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
<visual name="">
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
<material name="">
|
||||
<color rgba="0.0 0.8 1.0 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="finger2">
|
||||
<inertial>
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<mass value="0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
<visual name="">
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
<material name="">
|
||||
<color rgba="0.0 0.8 1.0 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="finger3">
|
||||
<inertial>
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<mass value="0.0"/>
|
||||
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
|
||||
</inertial>
|
||||
<visual name="">
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
<material name="">
|
||||
<color rgba="0.0 0.8 1.0 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="9 -25 5" rpy="0.0 -1.57 0.0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/finger_plates.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<joint name="base" type="fixed">
|
||||
<origin xyz="0.0 0.0 61.3" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="base_frame"/>
|
||||
<child link="plate"/>
|
||||
</joint>
|
||||
|
||||
<joint name="base_screw" type="prismatic">
|
||||
<origin xyz="0.0 0.0 72" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="base_frame"/>
|
||||
<child link="screw"/>
|
||||
<axis xyz="0.0 0.0 1"/>
|
||||
<limit lower="-7" upper="0.0" effort="0.0" velocity="0.0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="finger1_joint" type="revolute">
|
||||
<origin xyz="31.5 -18.5 28" rpy="0.0 0.0 -2.12"/>
|
||||
<parent link="plate"/>
|
||||
<child link="finger1"/>
|
||||
<axis xyz="1 0.0 0"/>
|
||||
<limit lower="-0.2" upper="0.07" effort="0.0" velocity="0.0"/>
|
||||
<mimic joint="base_screw" multiplier="-0.05" offset="-0.2"/>
|
||||
</joint>
|
||||
|
||||
<joint name="finger2_joint" type="revolute">
|
||||
<origin xyz="-31.5 -18.5 28" rpy="0.0 0.0 2.12"/>
|
||||
<parent link="plate"/>
|
||||
<child link="finger2"/>
|
||||
<axis xyz="1 0.0 0"/>
|
||||
<limit lower="-0.2" upper="0.07" effort="0.0" velocity="0.0"/>
|
||||
<mimic joint="base_screw" multiplier="-0.05" offset="-0.2"/>
|
||||
</joint>
|
||||
|
||||
<joint name="finger3_joint" type="revolute">
|
||||
<origin xyz="0 37 28" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="plate"/>
|
||||
<child link="finger3"/>
|
||||
<axis xyz="1 0.0 0"/>
|
||||
<limit lower="-0.2" upper="0.07" effort="0.0" velocity="0.0"/>
|
||||
<mimic joint="base_screw" multiplier="-0.05" offset="-0.2"/>
|
||||
</joint>
|
||||
|
||||
</robot>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_links.xacro"/>
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_joints.xacro"/>
|
||||
|
||||
<joint name="gripper_attach_joint" type="fixed">
|
||||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="link_ee"/>
|
||||
<child link="base_frame"/>
|
||||
</joint>
|
||||
|
||||
</robot>
|
||||
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_macros.xacro"/>
|
||||
<xacro:arg name="simulate" default="false"/>
|
||||
|
||||
<joint name="base_joint" type="fixed">
|
||||
<origin xyz="0.0 0.0 0.0613" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="base_frame"/>
|
||||
<child link="plate"/>
|
||||
</joint>
|
||||
|
||||
<xacro:prismatic_joint jname="base_screw"
|
||||
parent="base_frame" child="screw"
|
||||
xyz="0.0 0.0 0.072" rpy="0.0 0.0 0.0"
|
||||
axis="0.0 0.0 1"
|
||||
lower="-0.007" upper="0.0"
|
||||
effort="50.0" velocity="0.05"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="finger1_joint"
|
||||
parent="plate" child="finger1"
|
||||
xyz="0.0315 -0.0185 0.028" rpy="0.0 0.0 -2.12"
|
||||
axis="1 0.0 0"
|
||||
lower="-0.2" upper="0.07" effort="5.0" velocity="1.0" damping="0.0"
|
||||
mimic_joint="base_screw" multiplier="-50" mimic_offset="-0.2"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="finger2_joint"
|
||||
parent="plate" child="finger2"
|
||||
xyz="-0.0315 -0.0185 0.028" rpy="0.0 0.0 2.12"
|
||||
axis="1 0.0 0"
|
||||
lower="-0.2" upper="0.07" effort="5.0" velocity="1.0" damping="0.0"
|
||||
mimic_joint="base_screw" multiplier="-50" mimic_offset="-0.2"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="finger3_joint"
|
||||
parent="plate" child="finger3"
|
||||
xyz="0 0.037 0.028" rpy="0.0 0.0 0.0"
|
||||
axis="1 0.0 0"
|
||||
lower="-0.2" upper="0.07" effort="5.0" velocity="1.0" damping="0.0"
|
||||
mimic_joint="base_screw" multiplier="-50" mimic_offset="-0.2"/>
|
||||
|
||||
</robot>
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_macros.xacro"/>
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_meshes.xacro"/>
|
||||
|
||||
<xacro:property name="gripper_dark_r" value="0.05"/>
|
||||
<xacro:property name="gripper_dark_g" value="0.05"/>
|
||||
<xacro:property name="gripper_dark_b" value="0.05"/>
|
||||
|
||||
<xacro:property name="gripper_alum_r" value="0.7"/>
|
||||
<xacro:property name="gripper_alum_g" value="0.7"/>
|
||||
<xacro:property name="gripper_alum_b" value="0.7"/>
|
||||
|
||||
<xacro:property name="gripper_finger_r" value="0.0"/>
|
||||
<xacro:property name="gripper_finger_g" value="0.8"/>
|
||||
<xacro:property name="gripper_finger_b" value="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="base_frame"
|
||||
mass="0.3" xyz_iner="0 0 0.035"
|
||||
ixx="0.00024" ixy="0.0" ixz="0.0"
|
||||
iyy="0.00024" iyz="0.0" izz="0.00016"
|
||||
mesh="${mesh_gripper_base_frame}"
|
||||
visual_xyz="-0.021 -0.021 0.006" visual_rpy="0 0 0"
|
||||
r="${gripper_dark_r}" g="${gripper_dark_g}" b="${gripper_dark_b}" a="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="plate"
|
||||
mass="0.15" xyz_iner="0 0 0"
|
||||
ixx="0.00012" ixy="0.0" ixz="0.0"
|
||||
iyy="0.00012" iyz="0.0" izz="0.00018"
|
||||
mesh="${mesh_gripper_plate}"
|
||||
visual_xyz="0 0 0" visual_rpy="0 0 0"
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="screw"
|
||||
mass="0.03" xyz_iner="0 0 0"
|
||||
ixx="0.000024" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000024" iyz="0.0" izz="0.000012"
|
||||
mesh="${mesh_gripper_screw}"
|
||||
visual_xyz="0 0 0" visual_rpy="0 0 0"
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="finger1"
|
||||
mass="0.015" xyz_iner="0 0 0"
|
||||
ixx="0.000012" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000012" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_finger}"
|
||||
visual_xyz="0.009 -0.025 0.005" visual_rpy="0 -1.57 0"
|
||||
r="${gripper_finger_r}" g="${gripper_finger_g}" b="${gripper_finger_b}" a="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="finger2"
|
||||
mass="0.015" xyz_iner="0 0 0"
|
||||
ixx="0.000012" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000012" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_finger}"
|
||||
visual_xyz="0.009 -0.025 0.005" visual_rpy="0 -1.57 0"
|
||||
r="${gripper_finger_r}" g="${gripper_finger_g}" b="${gripper_finger_b}" a="1.0"/>
|
||||
|
||||
<xacro:gripper_link name="finger3"
|
||||
mass="0.015" xyz_iner="0 0 0"
|
||||
ixx="0.000012" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000012" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_finger}"
|
||||
visual_xyz="0.009 -0.025 0.005" visual_rpy="0 -1.57 0"
|
||||
r="${gripper_finger_r}" g="${gripper_finger_g}" b="${gripper_finger_b}" a="1.0"/>
|
||||
|
||||
</robot>
|
||||
@@ -1,65 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:macro name="gripper_link"
|
||||
params="name mass
|
||||
ixx ixy ixz iyy iyz izz xyz_iner
|
||||
mesh visual_xyz visual_rpy
|
||||
r g b a">
|
||||
<link name="${name}">
|
||||
<inertial>
|
||||
<origin xyz="${xyz_iner}" rpy="0 0 0"/>
|
||||
<mass value="${mass}"/>
|
||||
<inertia ixx="${ixx}" ixy="${ixy}" ixz="${ixz}"
|
||||
iyy="${iyy}" iyz="${iyz}" izz="${izz}"/>
|
||||
</inertial>
|
||||
<visual>
|
||||
<origin xyz="${visual_xyz}" rpy="${visual_rpy}"/>
|
||||
<geometry>
|
||||
<mesh filename="${mesh}" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
<material name="${name}_material">
|
||||
<color rgba="${r} ${g} ${b} ${a}"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="${visual_xyz}" rpy="${visual_rpy}"/>
|
||||
<geometry>
|
||||
<mesh filename="${mesh}" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
</xacro:macro>
|
||||
|
||||
<xacro:macro name="prismatic_joint"
|
||||
params="jname parent child xyz rpy axis lower upper effort velocity">
|
||||
<joint name="${jname}" type="prismatic">
|
||||
<origin xyz="${xyz}" rpy="${rpy}"/>
|
||||
<parent link="${parent}"/>
|
||||
<child link="${child}"/>
|
||||
<axis xyz="${axis}"/>
|
||||
<limit lower="${lower}" upper="${upper}"
|
||||
effort="${effort}" velocity="${velocity}"/>
|
||||
<dynamics damping="0.5" friction="0.1"/>
|
||||
</joint>
|
||||
</xacro:macro>
|
||||
|
||||
<xacro:macro name="mimic_revolute_joint"
|
||||
params="jname parent child xyz rpy axis
|
||||
lower upper effort velocity damping
|
||||
mimic_joint multiplier mimic_offset">
|
||||
<joint name="${jname}" type="revolute">
|
||||
<origin xyz="${xyz}" rpy="${rpy}"/>
|
||||
<parent link="${parent}"/>
|
||||
<child link="${child}"/>
|
||||
<axis xyz="${axis}"/>
|
||||
<limit lower="${lower}" upper="${upper}"
|
||||
effort="${effort}" velocity="${velocity}"/>
|
||||
<dynamics damping="${damping}" friction="0.05"/>
|
||||
<mimic joint="${mimic_joint}"
|
||||
multiplier="${multiplier}"
|
||||
offset="${mimic_offset}"/>
|
||||
</joint>
|
||||
</xacro:macro>
|
||||
|
||||
</robot>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:property name="gripper_pkg"
|
||||
value="package://iiwa_description/resource/meshes/gripper"/>
|
||||
|
||||
<xacro:property name="mesh_gripper_base_frame" value="${gripper_pkg}/base_frame.stl"/>
|
||||
<xacro:property name="mesh_gripper_plate" value="${gripper_pkg}/plate.stl"/>
|
||||
<xacro:property name="mesh_gripper_screw" value="${gripper_pkg}/screw.stl"/>
|
||||
<xacro:property name="mesh_gripper_finger" value="${gripper_pkg}/finger_plates.stl"/>
|
||||
|
||||
</robot>
|
||||
@@ -17,7 +17,7 @@
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/links.xacro"/>
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/joints.xacro"/>
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/tools/patron.xacro"/>
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/tools/tool_active.xacro"/>
|
||||
|
||||
<xacro:if value="$(arg simulate)">
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- AUTO-GENERATED by cobot robot-setup — do not edit manually -->
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="tool_active">
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/tools/patron.xacro"/>
|
||||
</robot>
|
||||
@@ -65,6 +65,11 @@ class PlanningCfg:
|
||||
planning_attempts: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ToolCfg:
|
||||
active: str # ключ из tools.yaml: "none" | "patron" | ...
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class WebCfg:
|
||||
enabled: bool
|
||||
@@ -108,6 +113,7 @@ class Settings:
|
||||
digital_twin: DigitalTwinCfg
|
||||
controller: ControllerCfg
|
||||
planning: PlanningCfg
|
||||
tool: ToolCfg
|
||||
foxglove: FoxgloveCfg
|
||||
web: WebCfg
|
||||
|
||||
@@ -336,6 +342,12 @@ def build_settings(settings_path: str, check_files: bool = True) -> Settings:
|
||||
planning_attempts=int(planning_raw.get("planning_attempts", 3)),
|
||||
)
|
||||
|
||||
# tool
|
||||
tool_raw = raw.get("tool", {})
|
||||
tool = ToolCfg(
|
||||
active=str(tool_raw.get("active", "patron")),
|
||||
)
|
||||
|
||||
# foxglove
|
||||
foxglove = _parse_foxglove(raw.get("foxglove"))
|
||||
|
||||
@@ -347,6 +359,7 @@ def build_settings(settings_path: str, check_files: bool = True) -> Settings:
|
||||
digital_twin=digital_twin,
|
||||
controller=controller,
|
||||
planning=planning,
|
||||
tool=tool,
|
||||
foxglove=foxglove,
|
||||
web=web,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
"""
|
||||
Управление активным инструментом робота.
|
||||
|
||||
Применяет выбранный инструмент из реестра tools.yaml:
|
||||
1. Перезаписывает tool_active.xacro — URDF подхватывает его при следующем запуске.
|
||||
2. Перегенерирует iiwa7.srdf — сохраняет текущие group_state, обновляет
|
||||
кинематическую цепочку, end_effector и пары disable_collisions.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Базовые пары столкновений робота (не зависят от инструмента).
|
||||
# ---------------------------------------------------------------------------
|
||||
_BASE_COLLISIONS: list[tuple[str, str, str]] = [
|
||||
("base_link", "link1", "Adjacent"),
|
||||
("base_link", "link2", "Never"),
|
||||
("base_link", "link3", "Never"),
|
||||
("base_link", "link4", "Never"),
|
||||
("link1", "link2", "Adjacent"),
|
||||
("link1", "link3", "Never"),
|
||||
("link1", "link4", "Never"),
|
||||
("link1", "link5", "Never"),
|
||||
("link1", "link6", "Never"),
|
||||
("link1", "link7", "Never"),
|
||||
("link2", "link3", "Adjacent"),
|
||||
("link2", "link4", "Never"),
|
||||
("link2", "link5", "Never"),
|
||||
("link2", "link6", "Never"),
|
||||
("link2", "link7", "Never"),
|
||||
("link3", "link4", "Adjacent"),
|
||||
("link3", "link5", "Never"),
|
||||
("link3", "link6", "Never"),
|
||||
("link3", "link7", "Never"),
|
||||
("link4", "link5", "Adjacent"),
|
||||
("link4", "link6", "Never"),
|
||||
("link4", "link7", "Never"),
|
||||
("link5", "link6", "Adjacent"),
|
||||
("link5", "link7", "Never"),
|
||||
("link6", "link7", "Adjacent"),
|
||||
]
|
||||
|
||||
|
||||
def load_registry(tools_yaml_path: Path) -> dict[str, Any]:
|
||||
"""Загружает реестр инструментов из tools.yaml.
|
||||
Поддерживает PyYAML и ruamel.yaml (что доступно в окружении)."""
|
||||
try:
|
||||
import yaml as _yaml
|
||||
with open(tools_yaml_path, encoding="utf-8") as f:
|
||||
data = _yaml.safe_load(f)
|
||||
except ImportError:
|
||||
from ruamel.yaml import YAML as _RYAML
|
||||
_y = _RYAML()
|
||||
with open(tools_yaml_path, encoding="utf-8") as f:
|
||||
data = _y.load(f)
|
||||
return dict(data.get("tools", {}))
|
||||
|
||||
|
||||
def _read_group_states(srdf_path: Path) -> list[dict]:
|
||||
"""Читает group_state из существующего SRDF, чтобы сохранить их при регенерации."""
|
||||
if not srdf_path.exists():
|
||||
return []
|
||||
tree = ET.parse(srdf_path)
|
||||
root = tree.getroot()
|
||||
states = []
|
||||
for gs in root.findall("group_state"):
|
||||
joints = {j.get("name"): j.get("value") for j in gs.findall("joint")}
|
||||
states.append({
|
||||
"name": gs.get("name"),
|
||||
"group": gs.get("group"),
|
||||
"joints": joints,
|
||||
})
|
||||
return states
|
||||
|
||||
|
||||
def _write_xacro(tool_cfg: dict, output_path: Path) -> None:
|
||||
"""Записывает tool_active.xacro с include нужного инструмента (или пустой)."""
|
||||
xacro_include = tool_cfg.get("xacro")
|
||||
if xacro_include:
|
||||
body = f' <xacro:include filename="{xacro_include}"/>\n'
|
||||
else:
|
||||
body = " <!-- no tool attached -->\n"
|
||||
|
||||
content = (
|
||||
'<?xml version="1.0"?>\n'
|
||||
'<!-- AUTO-GENERATED by cobot robot-setup — do not edit manually -->\n'
|
||||
'<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="tool_active">\n'
|
||||
+ body +
|
||||
'</robot>\n'
|
||||
)
|
||||
output_path.write_text(content, encoding="utf-8")
|
||||
|
||||
|
||||
def _write_srdf(
|
||||
tool_cfg: dict,
|
||||
group_states: list[dict],
|
||||
output_path: Path,
|
||||
) -> None:
|
||||
"""Генерирует iiwa7.srdf с учётом выбранного инструмента."""
|
||||
tip_link = tool_cfg.get("tip_link", "link_ee")
|
||||
tool_collisions = [tuple(c) for c in tool_cfg.get("collisions", [])]
|
||||
|
||||
lines: list[str] = [
|
||||
'<?xml version="1.0" encoding="UTF-8"?>',
|
||||
'<!-- AUTO-GENERATED by cobot robot-setup — do not edit manually -->',
|
||||
'<robot name="iiwa7">',
|
||||
'',
|
||||
' <group name="iiwa_arm">',
|
||||
f' <chain base_link="base_link" tip_link="{tip_link}"/>',
|
||||
' </group>',
|
||||
]
|
||||
|
||||
if group_states:
|
||||
lines.append('')
|
||||
for gs in group_states:
|
||||
lines.append(f' <group_state name="{gs["name"]}" group="{gs["group"]}">')
|
||||
for jname, jval in gs["joints"].items():
|
||||
lines.append(f' <joint name="{jname}" value="{jval}"/>')
|
||||
lines.append(' </group_state>')
|
||||
|
||||
if tip_link != "link_ee":
|
||||
lines += [
|
||||
'',
|
||||
f' <end_effector name="{tip_link}" parent_link="{tip_link}" group="iiwa_arm"/>',
|
||||
]
|
||||
|
||||
lines.append('')
|
||||
for l1, l2, reason in _BASE_COLLISIONS:
|
||||
lines.append(f' <disable_collisions link1="{l1}" link2="{l2}" reason="{reason}"/>')
|
||||
|
||||
if tool_collisions:
|
||||
lines.append('')
|
||||
for l1, l2, reason in tool_collisions:
|
||||
lines.append(f' <disable_collisions link1="{l1}" link2="{l2}" reason="{reason}"/>')
|
||||
|
||||
lines += ['</robot>', '']
|
||||
output_path.write_text('\n'.join(lines), encoding="utf-8")
|
||||
|
||||
|
||||
def apply_tool(
|
||||
tool_cfg: dict,
|
||||
xacro_out_path: Path,
|
||||
srdf_path: Path,
|
||||
) -> None:
|
||||
"""
|
||||
Применяет инструмент по его конфигу из реестра:
|
||||
- перезаписывает xacro_out_path (tool_active.xacro)
|
||||
- регенерирует srdf_path (iiwa7.srdf), сохраняя group_state
|
||||
"""
|
||||
group_states = _read_group_states(srdf_path)
|
||||
_write_xacro(tool_cfg, xacro_out_path)
|
||||
_write_srdf(tool_cfg, group_states, srdf_path)
|
||||
Reference in New Issue
Block a user