Refactor URDF and launch files for iiwa robot
- Updated gripper macros in gripper_macros.xacro to simplify parameters and add Gazebo support. - Removed unused mesh property in gripper_meshes.xacro. - Enhanced iiwa7 digital and FRI URDF files with simulation arguments and improved controller setup. - Added new launch files for Gazebo simulation and universal launch configuration. - Implemented YAML parameter wrapping for ROS2 in converter.py. - Introduced a new gz_bridge.yaml configuration for Gazebo to ROS2 topic mapping. - Cleaned up setting_loader.py and added necessary imports.
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import OpaqueFunction
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch.event_handlers import OnProcessExit
|
||||
from launch.actions import RegisterEventHandler
|
||||
from launch_ros.actions import Node
|
||||
|
||||
from iiwa_utils import converter
|
||||
|
||||
|
||||
def _setup_controllers(context, *args, **kwargs):
|
||||
robot_name = LaunchConfiguration("robot_name").perform(context)
|
||||
description = LaunchConfiguration("description").perform(context)
|
||||
initial_positions_file = LaunchConfiguration("initial_positions_file").perform(context)
|
||||
controller_path = LaunchConfiguration("controller_path").perform(context)
|
||||
simulate = LaunchConfiguration("simulate").perform(context).lower() in ("true", "1", "yes")
|
||||
|
||||
robot_description = converter.load_robot_description(
|
||||
model_path=description,
|
||||
robot_name=robot_name,
|
||||
xacro_args={"initial_positions_file": initial_positions_file},
|
||||
)
|
||||
|
||||
# СИМУЛЯЦИЯ (Gazebo)
|
||||
if simulate:
|
||||
jsb = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"joint_state_broadcaster",
|
||||
"--controller-manager", "/controller_manager",
|
||||
"--controller-manager-timeout", "30",
|
||||
],
|
||||
parameters=[{"use_sim_time": True}],
|
||||
)
|
||||
|
||||
jtc = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"iiwa_arm_controller",
|
||||
"--controller-manager", "/controller_manager",
|
||||
"--controller-manager-timeout", "30",
|
||||
],
|
||||
parameters=[{"use_sim_time": True}],
|
||||
)
|
||||
|
||||
jtc_after_jsb = RegisterEventHandler(
|
||||
OnProcessExit(
|
||||
target_action=jsb,
|
||||
on_exit=[jtc],
|
||||
)
|
||||
)
|
||||
|
||||
return [jsb, jtc_after_jsb]
|
||||
|
||||
# РЕАЛЬНЫЙ РОБОТ (FRI)
|
||||
else:
|
||||
ros2_control_node = Node(
|
||||
package="controller_manager",
|
||||
executable="ros2_control_node",
|
||||
output="screen",
|
||||
parameters=[
|
||||
{"robot_description": robot_description},
|
||||
controller_path,
|
||||
],
|
||||
)
|
||||
|
||||
jsb = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"joint_state_broadcaster",
|
||||
"--controller-manager", "/controller_manager",
|
||||
],
|
||||
)
|
||||
|
||||
jtc = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"iiwa_arm_controller",
|
||||
"--controller-manager", "/controller_manager",
|
||||
],
|
||||
)
|
||||
|
||||
torque_controller = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"forward_torque_controller",
|
||||
"--controller-manager", "/controller_manager",
|
||||
"--inactive",
|
||||
],
|
||||
)
|
||||
|
||||
jtc_after_jsb = RegisterEventHandler(
|
||||
OnProcessExit(
|
||||
target_action=jsb,
|
||||
on_exit=[jtc, torque_controller],
|
||||
)
|
||||
)
|
||||
|
||||
return [
|
||||
ros2_control_node,
|
||||
jsb,
|
||||
jtc_after_jsb,
|
||||
]
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
return LaunchDescription([OpaqueFunction(function=_setup_controllers)])
|
||||
@@ -0,0 +1,63 @@
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import (
|
||||
IncludeLaunchDescription,
|
||||
OpaqueFunction,
|
||||
)
|
||||
from launch_ros.actions import Node
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
|
||||
|
||||
def _spawn_setup(context, *args, **kwargs):
|
||||
robot_name = LaunchConfiguration("robot_name").perform(context)
|
||||
world = LaunchConfiguration("world").perform(context)
|
||||
gazebo_config = LaunchConfiguration("gazebo_config").perform(context)
|
||||
simulate = LaunchConfiguration("simulate").perform(context).lower() in ("true", "1", "yes")
|
||||
# transform = LaunchConfiguration("transform").perform(context)
|
||||
|
||||
gazebo = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
PathJoinSubstitution(
|
||||
[
|
||||
FindPackageShare("ros_gz_sim"),
|
||||
"launch",
|
||||
"gz_sim.launch.py",
|
||||
]
|
||||
)
|
||||
),
|
||||
launch_arguments={
|
||||
"gz_args": f"-r {world}",
|
||||
"on_exit_shutdown": "true",
|
||||
}.items(),
|
||||
)
|
||||
|
||||
# TODO: добавить аргументы для transform и rotation
|
||||
spawn_robot = Node(
|
||||
package="ros_gz_sim",
|
||||
executable="create",
|
||||
name="spawn_iiwa7",
|
||||
output="screen",
|
||||
arguments=[
|
||||
"-topic", "/robot_description",
|
||||
"-name", robot_name,
|
||||
"-z", "0.0"
|
||||
],
|
||||
)
|
||||
|
||||
gz_bridge = Node(
|
||||
package="ros_gz_bridge",
|
||||
executable="parameter_bridge",
|
||||
name="gz_bridge",
|
||||
output="screen",
|
||||
parameters=[{
|
||||
"config_file": gazebo_config,
|
||||
"use_sim_time": simulate
|
||||
}],
|
||||
)
|
||||
|
||||
return [gazebo, spawn_robot, gz_bridge]
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
return LaunchDescription([OpaqueFunction(function=_spawn_setup)])
|
||||
@@ -33,7 +33,6 @@ def _setup_controllers(context, *args, **kwargs):
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
joint_state_broadcaster_spawner = Node(
|
||||
package="controller_manager",
|
||||
executable="spawner",
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import (
|
||||
DeclareLaunchArgument,
|
||||
EmitEvent,
|
||||
IncludeLaunchDescription,
|
||||
OpaqueFunction,
|
||||
RegisterEventHandler,
|
||||
SetEnvironmentVariable,
|
||||
# TimerAction,
|
||||
)
|
||||
from launch.conditions import IfCondition
|
||||
from launch.event_handlers import OnProcessExit
|
||||
from launch.events import Shutdown
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from moveit_configs_utils import MoveItConfigsBuilder
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
from iiwa_utils import converter, setting_loader
|
||||
|
||||
|
||||
def _runtime_setup(context, *args, **kwargs):
|
||||
setup = []
|
||||
|
||||
# Настройка параметров
|
||||
simulate = LaunchConfiguration("simulate").perform(context) in ("true", "1", "yes")
|
||||
|
||||
settings = setting_loader.build_settings(
|
||||
settings_path=LaunchConfiguration("setting").perform(context),
|
||||
check_files=True,
|
||||
)
|
||||
|
||||
joint_limits_ros2 = converter.wrap_for_ros2_params(
|
||||
settings.controller.moveit.joint_limits,
|
||||
"robot_description_planning",
|
||||
)
|
||||
kinematics_ros2 = converter.wrap_for_ros2_params(
|
||||
settings.controller.moveit.kinematics,
|
||||
"robot_description_kinematics",
|
||||
)
|
||||
|
||||
description_path = settings.robot.description
|
||||
|
||||
if simulate:
|
||||
xacro_args = {
|
||||
"initial_positions_file": settings.controller.moveit.initial_positions,
|
||||
"simulate": "true",
|
||||
}
|
||||
use_sim_time = True
|
||||
else:
|
||||
xacro_args = {
|
||||
"initial_positions_file": settings.controller.moveit.initial_positions,
|
||||
"robot_ip": settings.robot.ip,
|
||||
"fri_port": str(settings.robot.port),
|
||||
"simulate": "false",
|
||||
"command_mode": settings.robot.command_mode,
|
||||
}
|
||||
use_sim_time = False
|
||||
|
||||
robot_description = converter.load_robot_description(
|
||||
model_path=description_path,
|
||||
robot_name=settings.robot.name,
|
||||
xacro_args=xacro_args,
|
||||
)
|
||||
|
||||
# Вызов нод
|
||||
rsp_node = Node(
|
||||
package="robot_state_publisher",
|
||||
executable="robot_state_publisher",
|
||||
name="robot_state_publisher",
|
||||
output="screen",
|
||||
parameters=[
|
||||
{"robot_description": robot_description},
|
||||
{"use_sim_time": use_sim_time},
|
||||
],
|
||||
)
|
||||
|
||||
setup += [rsp_node]
|
||||
|
||||
# gazebo spawn
|
||||
if simulate:
|
||||
gazebo_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
PathJoinSubstitution(
|
||||
[
|
||||
FindPackageShare("iiwa_bringup"),
|
||||
"launch", "supported", "gazebo.launch.py",
|
||||
]
|
||||
)
|
||||
),
|
||||
# TODO: добавить аргументы для transform и rotation и передать их из setting.yaml а также мир
|
||||
launch_arguments={
|
||||
"robot_name": settings.robot.name,
|
||||
"world": "empty.sdf",
|
||||
"gazebo_config": str(get_package_share_directory("iiwa_config") + "/config/gazebo/gz_bridge.yaml"),
|
||||
"simulate": "true",
|
||||
}.items(),
|
||||
)
|
||||
|
||||
setup += [gazebo_launch]
|
||||
|
||||
# Controller launch
|
||||
controllers_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
PathJoinSubstitution(
|
||||
[
|
||||
FindPackageShare("iiwa_bringup"),
|
||||
"launch",
|
||||
"supported",
|
||||
"controllers.launch.py",
|
||||
]
|
||||
)
|
||||
),
|
||||
launch_arguments={
|
||||
"robot_name": settings.robot.name,
|
||||
"description": description_path,
|
||||
"initial_positions_file": settings.controller.moveit.initial_positions,
|
||||
# "simulate": str(simulate),
|
||||
"controller_path": settings.controller.controller_path,
|
||||
}.items(),
|
||||
)
|
||||
|
||||
# Moveit launch
|
||||
moveit_configs = (
|
||||
MoveItConfigsBuilder("iiwa7", package_name="iiwa_config")
|
||||
.robot_description(
|
||||
file_path=description_path,
|
||||
mappings={
|
||||
"initial_positions_file": settings.controller.moveit.initial_positions
|
||||
},
|
||||
)
|
||||
.robot_description_semantic(file_path=settings.controller.moveit.srdf)
|
||||
.robot_description_kinematics(file_path=settings.controller.moveit.kinematics)
|
||||
.joint_limits(file_path=settings.controller.moveit.joint_limits)
|
||||
.pilz_cartesian_limits(file_path=settings.controller.moveit.pilz_limits)
|
||||
.trajectory_execution(file_path=settings.controller.moveit.moveit_controllers)
|
||||
.moveit_cpp(file_path=settings.controller.moveit.moveit_cpp)
|
||||
.to_moveit_configs()
|
||||
)
|
||||
|
||||
move_group = Node(
|
||||
package="moveit_ros_move_group",
|
||||
executable="move_group",
|
||||
output="screen",
|
||||
parameters=[
|
||||
moveit_configs.to_dict(),
|
||||
{"robot_description": robot_description},
|
||||
{"use_sim_time": use_sim_time},
|
||||
],
|
||||
)
|
||||
|
||||
# Rviz launch
|
||||
rviz_launch = Node(
|
||||
condition=IfCondition(LaunchConfiguration("rviz")),
|
||||
package="rviz2",
|
||||
executable="rviz2",
|
||||
name="rviz2",
|
||||
arguments=["-d", settings.digital_twin.rviz.config],
|
||||
output="log",
|
||||
parameters=[
|
||||
moveit_configs.robot_description,
|
||||
moveit_configs.robot_description_semantic,
|
||||
moveit_configs.planning_pipelines,
|
||||
joint_limits_ros2,
|
||||
kinematics_ros2,
|
||||
{"use_sim_time": use_sim_time},
|
||||
],
|
||||
)
|
||||
|
||||
shutdown_on_rviz_exit = RegisterEventHandler(
|
||||
OnProcessExit(
|
||||
target_action=rviz_launch,
|
||||
on_exit=[EmitEvent(event=Shutdown())],
|
||||
)
|
||||
)
|
||||
|
||||
setup += [
|
||||
controllers_launch,
|
||||
move_group,
|
||||
rviz_launch,
|
||||
shutdown_on_rviz_exit
|
||||
]
|
||||
|
||||
return setup
|
||||
|
||||
def generate_launch_description():
|
||||
declare_simulate = DeclareLaunchArgument(
|
||||
name="simulate",
|
||||
default_value="false",
|
||||
description="true = Gazebo симуляция, false = реальный робот через FRI",
|
||||
)
|
||||
|
||||
declare_rviz = DeclareLaunchArgument(
|
||||
name="rviz",
|
||||
default_value="false",
|
||||
description="true = запустить RViz",
|
||||
)
|
||||
|
||||
declare_setting = DeclareLaunchArgument(
|
||||
name="setting",
|
||||
default_value=PathJoinSubstitution(
|
||||
[FindPackageShare("iiwa_config"), "config", "setting.yaml"]
|
||||
),
|
||||
description="Путь к файлу настроек",
|
||||
)
|
||||
|
||||
gz_resource_path = SetEnvironmentVariable(
|
||||
name="GZ_SIM_RESOURCE_PATH",
|
||||
value=get_package_share_directory("iiwa_description") + "/..",
|
||||
)
|
||||
|
||||
runtime_setup = OpaqueFunction(function=_runtime_setup)
|
||||
|
||||
return LaunchDescription([
|
||||
gz_resource_path,
|
||||
declare_simulate,
|
||||
declare_rviz,
|
||||
declare_setting,
|
||||
runtime_setup,
|
||||
])
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# Формат каждой записи:
|
||||
# ros_topic_name: имя топика в ROS2
|
||||
# gz_topic_name: имя топика в Gazebo (можно опустить если совпадает)
|
||||
# ros_type_name: тип сообщения ROS2
|
||||
# gz_type_name: тип сообщения Gazebo
|
||||
# direction: GZ_TO_ROS / ROS_TO_GZ / BIDIRECTIONAL
|
||||
|
||||
- ros_topic_name: /clock
|
||||
gz_topic_name: /clock
|
||||
ros_type_name: rosgraph_msgs/msg/Clock
|
||||
gz_type_name: gz.msgs.Clock
|
||||
direction: GZ_TO_ROS
|
||||
lazy: false
|
||||
|
||||
# Состояния джойнтов из Gazebo в ROS2
|
||||
- ros_topic_name: /joint_states
|
||||
gz_topic_name: /world/empty/model/iiwa7/joint_state
|
||||
ros_type_name: sensor_msgs/msg/JointState
|
||||
gz_type_name: gz.msgs.Model
|
||||
direction: GZ_TO_ROS
|
||||
lazy: false
|
||||
|
||||
# TF из Gazebo в ROS2 (поза модели в мире)
|
||||
- ros_topic_name: /tf
|
||||
gz_topic_name: /model/iiwa7/pose
|
||||
ros_type_name: tf2_msgs/msg/TFMessage
|
||||
gz_type_name: gz.msgs.Pose_V
|
||||
direction: GZ_TO_ROS
|
||||
lazy: false
|
||||
@@ -43,9 +43,6 @@
|
||||
<!--PASSIVE JOINTS: MoveIt не ожидает их в /joint_states и не планирует ими.
|
||||
Геометрия захвата всё равно учитывается при проверке коллизий.-->
|
||||
<passive_joint name="base_screw"/>
|
||||
<passive_joint name="craving1_joint"/>
|
||||
<passive_joint name="craving2_joint"/>
|
||||
<passive_joint name="craving3_joint"/>
|
||||
<passive_joint name="finger1_joint"/>
|
||||
<passive_joint name="finger2_joint"/>
|
||||
<passive_joint name="finger3_joint"/>
|
||||
|
||||
@@ -60,82 +60,8 @@
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<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>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="craving1">
|
||||
<inertial>
|
||||
<origin xyz="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="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
<material name="alum_plastic">
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="craving2">
|
||||
<inertial>
|
||||
<origin xyz="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="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
<material name="alum_plastic">
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="craving3">
|
||||
<inertial>
|
||||
<origin xyz="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="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
<material name="alum_plastic">
|
||||
<color rgba="0.7 0.7 0.7 1.0"/>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="-4 -7 19" rpy="0.0 1.57 0"/>
|
||||
<geometry>
|
||||
<mesh filename="/home/daniel/dev/kuka_iiwa7_ros2/src/iiwa_description/resource/meshes/gripper/craving.stl"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<link name="finger1">
|
||||
<inertial>
|
||||
@@ -207,7 +133,7 @@
|
||||
</link>
|
||||
|
||||
<joint name="base" type="fixed">
|
||||
<origin xyz="0.0 0.0 61" rpy="0.0 0.0 0.0"/>
|
||||
<origin xyz="0.0 0.0 61.3" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="base_frame"/>
|
||||
<child link="plate"/>
|
||||
</joint>
|
||||
@@ -220,42 +146,12 @@
|
||||
<limit lower="-7" upper="0.0" effort="0.0" velocity="0.0"/>
|
||||
</joint>
|
||||
|
||||
<joint name="craving1_joint" type="revolute">
|
||||
<origin xyz="15.5 -9.5 4" rpy="0.0 0 -0.55"/>
|
||||
<parent link="screw"/>
|
||||
<child link="craving1"/>
|
||||
<axis xyz="0.0 1 0.0"/>
|
||||
<limit lower="-0.25" upper="-0.2" effort="5.0" velocity="1.0"/>
|
||||
<dynamics damping="0.05" friction="0.05"/>
|
||||
<mimic joint="base_screw" multiplier="0.0001" offset="-0.25"/>
|
||||
</joint>
|
||||
|
||||
<joint name="craving2_joint" type="revolute">
|
||||
<origin xyz="-15.5 -9.5 4" rpy="0.0 0 0.55"/>
|
||||
<parent link="screw"/>
|
||||
<child link="craving2"/>
|
||||
<axis xyz="0.0 1 0.0"/>
|
||||
<limit lower="0.2" upper="0.25" effort="5.0" velocity="1.0"/>
|
||||
<dynamics damping="0.05" friction="0.05"/>
|
||||
<mimic joint="base_screw" multiplier="0.0001" offset="0.2"/>
|
||||
</joint>
|
||||
|
||||
<joint name="craving3_joint" type="revolute">
|
||||
<origin xyz="0 18 4" rpy="0.0 0 1.57"/>
|
||||
<parent link="screw"/>
|
||||
<child link="craving3"/>
|
||||
<axis xyz="0.0 1 0.0"/>
|
||||
<limit lower="-0.25" upper="-0.2" effort="5.0" velocity="1.0"/>
|
||||
<dynamics damping="0.05" friction="0.05"/>
|
||||
<mimic joint="base_screw" multiplier="0.0001" offset="-0.25"/>
|
||||
</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.09" effort="0.0" velocity="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>
|
||||
|
||||
@@ -264,7 +160,7 @@
|
||||
<parent link="plate"/>
|
||||
<child link="finger2"/>
|
||||
<axis xyz="1 0.0 0"/>
|
||||
<limit lower="-0.2" upper="0.09" effort="0.0" velocity="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>
|
||||
|
||||
@@ -273,7 +169,7 @@
|
||||
<parent link="plate"/>
|
||||
<child link="finger3"/>
|
||||
<axis xyz="1 0.0 0"/>
|
||||
<limit lower="-0.2" upper="0.09" effort="0.0" velocity="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>
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Захват для Webots digital twin: все суставы fixed, без физики суставов.
|
||||
Для реального робота используй gripper.xacro. -->
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<!-- Digital: box collision вместо mesh, все суставы с правильной физикой -->
|
||||
<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" rpy="0.0 0.0 0.0"/>
|
||||
<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>
|
||||
</robot>
|
||||
@@ -2,9 +2,10 @@
|
||||
<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.061" rpy="0.0 0.0 0.0"/>
|
||||
<origin xyz="0.0 0.0 0.0613" rpy="0.0 0.0 0.0"/>
|
||||
<parent link="base_frame"/>
|
||||
<child link="plate"/>
|
||||
</joint>
|
||||
@@ -16,47 +17,25 @@
|
||||
lower="-0.007" upper="0.0"
|
||||
effort="50.0" velocity="0.05"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="craving1_joint"
|
||||
parent="screw" child="craving1"
|
||||
xyz="0.0155 -0.0095 0.004" rpy="0.0 0 -0.55"
|
||||
axis="0.0 1 0.0"
|
||||
lower="-0.25" upper="-0.2" effort="5.0" velocity="1.0" damping="0.05"
|
||||
mimic_joint="base_screw" multiplier="0.1" mimic_offset="-0.25"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="craving2_joint"
|
||||
parent="screw" child="craving2"
|
||||
xyz="-0.0155 -0.0095 0.004" rpy="0.0 0 0.55"
|
||||
axis="0.0 1 0.0"
|
||||
lower="0.2" upper="0.25" effort="5.0" velocity="1.0" damping="0.05"
|
||||
mimic_joint="base_screw" multiplier="0.1" mimic_offset="0.2"/>
|
||||
|
||||
<xacro:mimic_revolute_joint jname="craving3_joint"
|
||||
parent="screw" child="craving3"
|
||||
xyz="0 0.018 0.004" rpy="0.0 0 1.57"
|
||||
axis="0.0 1 0.0"
|
||||
lower="-0.25" upper="-0.2" effort="5.0" velocity="1.0" damping="0.05"
|
||||
mimic_joint="base_screw" multiplier="0.1" mimic_offset="-0.25"/>
|
||||
|
||||
|
||||
<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.09" effort="5.0" velocity="1.0" damping="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.09" effort="5.0" velocity="1.0" damping="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.09" effort="5.0" velocity="1.0" damping="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,10 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Links захвата для Webots digital twin.
|
||||
Использует gripper_macros_digital.xacro: visual=mesh, collision=box.
|
||||
Размеры box определены по смещениям суставов и геометрии захвата. -->
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:version="1.0">
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper_macros_digital.xacro"/>
|
||||
<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"/>
|
||||
@@ -19,73 +16,37 @@
|
||||
<xacro:property name="gripper_finger_g" value="0.8"/>
|
||||
<xacro:property name="gripper_finger_b" value="1.0"/>
|
||||
|
||||
<!-- base_frame: основной корпус ~44×44×72mm -->
|
||||
<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"
|
||||
box_x="0.044" box_y="0.044" box_z="0.072" box_xyz="0 0 0.036"/>
|
||||
r="${gripper_dark_r}" g="${gripper_dark_g}" b="${gripper_dark_b}" a="1.0"/>
|
||||
|
||||
<!-- plate: пластина ~70×70×10mm -->
|
||||
<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"
|
||||
box_x="0.070" box_y="0.070" box_z="0.012" box_xyz="0 0 0.006"/>
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"/>
|
||||
|
||||
<!-- screw: ходовой винт ~20×20×15mm -->
|
||||
<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"
|
||||
box_x="0.020" box_y="0.020" box_z="0.015" box_xyz="0 0 0"/>
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"/>
|
||||
|
||||
<!-- craving1/2/3: кулачки ~12×12×35mm -->
|
||||
<xacro:gripper_link name="craving1"
|
||||
mass="0.01" xyz_iner="0 0 0"
|
||||
ixx="0.000008" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000008" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_craving}"
|
||||
visual_xyz="-0.004 -0.007 0.019" visual_rpy="0 1.57 0"
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"
|
||||
box_x="0.012" box_y="0.012" box_z="0.035" box_xyz="0 0 0.017"/>
|
||||
|
||||
<xacro:gripper_link name="craving2"
|
||||
mass="0.01" xyz_iner="0 0 0"
|
||||
ixx="0.000008" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000008" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_craving}"
|
||||
visual_xyz="-0.004 -0.007 0.019" visual_rpy="0 1.57 0"
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"
|
||||
box_x="0.012" box_y="0.012" box_z="0.035" box_xyz="0 0 0.017"/>
|
||||
|
||||
<xacro:gripper_link name="craving3"
|
||||
mass="0.01" xyz_iner="0 0 0"
|
||||
ixx="0.000008" ixy="0.0" ixz="0.0"
|
||||
iyy="0.000008" iyz="0.0" izz="0.000004"
|
||||
mesh="${mesh_gripper_craving}"
|
||||
visual_xyz="-0.004 -0.007 0.019" visual_rpy="0 1.57 0"
|
||||
r="${gripper_alum_r}" g="${gripper_alum_g}" b="${gripper_alum_b}" a="1.0"
|
||||
box_x="0.012" box_y="0.012" box_z="0.035" box_xyz="0 0 0.017"/>
|
||||
|
||||
<!-- finger1/2/3: пальцы ~10×10×40mm -->
|
||||
<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"
|
||||
box_x="0.010" box_y="0.010" box_z="0.040" box_xyz="0 0 0.020"/>
|
||||
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"
|
||||
@@ -93,8 +54,7 @@
|
||||
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"
|
||||
box_x="0.010" box_y="0.010" box_z="0.040" box_xyz="0 0 0.020"/>
|
||||
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"
|
||||
@@ -102,7 +62,6 @@
|
||||
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"
|
||||
box_x="0.010" box_y="0.010" box_z="0.040" box_xyz="0 0 0.020"/>
|
||||
r="${gripper_finger_r}" g="${gripper_finger_g}" b="${gripper_finger_b}" a="1.0"/>
|
||||
|
||||
</robot>
|
||||
</robot>
|
||||
@@ -1,15 +1,11 @@
|
||||
<?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
|
||||
box_x box_y box_z box_xyz">
|
||||
mesh visual_xyz visual_rpy
|
||||
r g b a">
|
||||
<link name="${name}">
|
||||
<inertial>
|
||||
<origin xyz="${xyz_iner}" rpy="0 0 0"/>
|
||||
@@ -27,14 +23,33 @@
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<origin xyz="${box_xyz}" rpy="0 0 0"/>
|
||||
<origin xyz="${visual_xyz}" rpy="${visual_rpy}"/>
|
||||
<geometry>
|
||||
<box size="${box_x} ${box_y} ${box_z}"/>
|
||||
<mesh filename="${mesh}" scale="0.001 0.001 0.001"/>
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
</xacro:macro>
|
||||
|
||||
<gazebo reference="${name}">
|
||||
<visual>
|
||||
<material>
|
||||
<ambient>${r} ${g} ${b} ${a}</ambient>
|
||||
<diffuse>${r} ${g} ${b} ${a}</diffuse>
|
||||
<specular>0.3 0.3 0.3 1.0</specular>
|
||||
</material>
|
||||
</visual>
|
||||
<collision>
|
||||
<surface>
|
||||
<friction>
|
||||
<ode><mu>1.0</mu><mu2>1.0</mu2></ode>
|
||||
</friction>
|
||||
<contact>
|
||||
<ode><kp>1000000.0</kp><kd>100.0</kd></ode>
|
||||
</contact>
|
||||
</surface>
|
||||
</collision>
|
||||
</gazebo>
|
||||
</xacro:macro>
|
||||
|
||||
<xacro:macro name="prismatic_joint"
|
||||
params="jname parent child xyz rpy axis lower upper effort velocity">
|
||||
@@ -67,4 +82,4 @@
|
||||
</joint>
|
||||
</xacro:macro>
|
||||
|
||||
</robot>
|
||||
</robot>
|
||||
@@ -7,7 +7,6 @@
|
||||
<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_craving" value="${gripper_pkg}/craving.stl"/>
|
||||
<xacro:property name="mesh_gripper_finger" value="${gripper_pkg}/finger_plates.stl"/>
|
||||
|
||||
</robot>
|
||||
@@ -4,6 +4,13 @@
|
||||
<!-- Аргукменты -->
|
||||
<xacro:arg name="initial_positions_file"
|
||||
default="$(find iiwa_config)/config/moveit/initial_positions.yaml"/>
|
||||
<xacro:arg name="simulate" default="false"/>
|
||||
|
||||
<!-- Аргументы только для реального робота -->
|
||||
<xacro:arg name="robot_ip" default="192.170.10.2"/>
|
||||
<xacro:arg name="fri_port" default="30200"/>
|
||||
<xacro:arg name="command_mode" default="position"/>
|
||||
|
||||
|
||||
<xacro:property name="initial_positions"
|
||||
value="${xacro.load_yaml('$(arg initial_positions_file)')['initial_positions']}"/>
|
||||
@@ -15,24 +22,49 @@
|
||||
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper.xacro"/>
|
||||
|
||||
<webots>
|
||||
<xacro:if value="$(arg simulate)">
|
||||
<gazebo>
|
||||
<plugin filename="gz_ros2_control-system"
|
||||
name="gz_ros2_control::GazeboSimROS2ControlPlugin">
|
||||
<parameters>$(find iiwa_config)/config/moveit/iiwa_controller.yaml</parameters>
|
||||
<ros>
|
||||
<remapping>~/robot_description:=/robot_description</remapping>
|
||||
</ros>
|
||||
</plugin>
|
||||
</gazebo>
|
||||
</xacro:if>
|
||||
|
||||
<!-- <webots>
|
||||
<plugin type="webots_ros2_control::Ros2Control"/>
|
||||
</webots>
|
||||
</webots> -->
|
||||
|
||||
<ros2_control name="iiwaControl" type="system">
|
||||
|
||||
<xacro:if value="$(arg simulate)">
|
||||
<hardware>
|
||||
<plugin>gz_ros2_control/GazeboSimSystem</plugin>
|
||||
</hardware>
|
||||
</xacro:if>
|
||||
|
||||
<ros2_control name="iiwaWebotsControl" type="system">
|
||||
<hardware>
|
||||
<plugin>webots_ros2_control::Ros2ControlSystem</plugin>
|
||||
<plugin>iiwa_controller/IIWAHardwareInterface</plugin>
|
||||
|
||||
<param name="robot_ip">$(arg robot_ip)</param>
|
||||
<param name="fri_port">$(arg fri_port)</param>
|
||||
<param name="simulate">$(arg simulate)</param>
|
||||
<param name="command_mode">$(arg command_mode)</param>
|
||||
|
||||
</hardware>
|
||||
|
||||
<joint name="joint1">
|
||||
<!-- <hardware>
|
||||
<plugin>webots_ros2_control::Ros2ControlSystem</plugin>
|
||||
</hardware> -->
|
||||
|
||||
<joint name="joint1">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint1']}</param>
|
||||
</state_interface>
|
||||
@@ -45,10 +77,6 @@
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint2']}</param>
|
||||
</state_interface>
|
||||
@@ -61,10 +89,6 @@
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint3']}</param>
|
||||
</state_interface>
|
||||
@@ -77,10 +101,6 @@
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint4']}</param>
|
||||
</state_interface>
|
||||
@@ -93,10 +113,6 @@
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint5']}</param>
|
||||
</state_interface>
|
||||
@@ -109,10 +125,6 @@
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint6']}</param>
|
||||
</state_interface>
|
||||
@@ -125,10 +137,6 @@
|
||||
<param name="min">-3.05</param>
|
||||
<param name="max"> 3.05</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint7']}</param>
|
||||
</state_interface>
|
||||
@@ -136,16 +144,14 @@
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<!-- Захват -->
|
||||
<!-- <joint name="base_screw">
|
||||
<joint name="base_screw">
|
||||
<command_interface name="position"/>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">0.0</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
</joint> -->
|
||||
</joint>
|
||||
|
||||
</ros2_control>
|
||||
|
||||
|
||||
</robot>
|
||||
@@ -1,13 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="iiwa7">
|
||||
|
||||
<xacro:arg name="initial_positions_file"
|
||||
default="$(find iiwa_config)/config/moveit/initial_positions.yaml"/>
|
||||
|
||||
<xacro:arg name="simulate" default="false"/>
|
||||
<xacro:arg name="robot_ip" default="192.170.10.2"/>
|
||||
<xacro:arg name="fri_port" default="30200"/>
|
||||
<xacro:arg name="simulate" default="false"/>
|
||||
<xacro:arg name="command_mode" default="position"/>
|
||||
|
||||
<xacro:property name="initial_positions"
|
||||
@@ -19,130 +17,245 @@
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/joints.xacro"/>
|
||||
<xacro:include filename="$(find iiwa_description)/urdf/gripper/gripper.xacro"/>
|
||||
|
||||
<ros2_control name="iiwaFRIControl" type="system">
|
||||
|
||||
<hardware>
|
||||
<plugin>iiwa_controller/IIWAHardwareInterface</plugin>
|
||||
<xacro:if value="$(arg simulate)">
|
||||
|
||||
<param name="robot_ip">$(arg robot_ip)</param>
|
||||
<param name="fri_port">$(arg fri_port)</param>
|
||||
<param name="simulate">$(arg simulate)</param>
|
||||
<param name="command_mode">$(arg command_mode)</param>
|
||||
<gazebo>
|
||||
<plugin filename="gz_ros2_control-system"
|
||||
name="gz_ros2_control::GazeboSimROS2ControlPlugin">
|
||||
<parameters>$(find iiwa_config)/config/moveit/iiwa_controller.yaml</parameters>
|
||||
<ros>
|
||||
<remapping>~/robot_description:=/robot_description</remapping>
|
||||
</ros>
|
||||
</plugin>
|
||||
</gazebo>
|
||||
|
||||
</hardware>
|
||||
<ros2_control name="iiwaGazeboControl" type="system">
|
||||
<hardware>
|
||||
<plugin>gz_ros2_control/GazeboSimSystem</plugin>
|
||||
</hardware>
|
||||
|
||||
<joint name="joint1">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint1']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint1">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint1']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint2">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint2']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint2">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint2']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint3">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint3']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint3">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint3']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint4">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint4']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint4">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint4']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint5">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint5']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint5">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint5']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint6">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint6']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint6">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint6']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint7">
|
||||
<command_interface name="position">
|
||||
<param name="min">-3.05</param>
|
||||
<param name="max"> 3.05</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint7']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
<joint name="joint7">
|
||||
<command_interface name="position">
|
||||
<param name="min">-3.05</param>
|
||||
<param name="max"> 3.05</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint7']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
</ros2_control>
|
||||
<joint name="base_screw">
|
||||
<command_interface name="position"/>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">0.0</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
</joint>
|
||||
|
||||
</ros2_control>
|
||||
|
||||
</xacro:if>
|
||||
|
||||
<xacro:unless value="$(arg simulate)">
|
||||
|
||||
<ros2_control name="iiwaFRIControl" type="system">
|
||||
<hardware>
|
||||
<plugin>iiwa_controller/IIWAHardwareInterface</plugin>
|
||||
<param name="robot_ip">$(arg robot_ip)</param>
|
||||
<param name="fri_port">$(arg fri_port)</param>
|
||||
<param name="simulate">false</param>
|
||||
<param name="command_mode">$(arg command_mode)</param>
|
||||
</hardware>
|
||||
|
||||
<joint name="joint1">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint1']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint2">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint2']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint3">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint3']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint4">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint4']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint5">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.97</param>
|
||||
<param name="max"> 2.97</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint5']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint6">
|
||||
<command_interface name="position">
|
||||
<param name="min">-2.09</param>
|
||||
<param name="max"> 2.09</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint6']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
<joint name="joint7">
|
||||
<command_interface name="position">
|
||||
<param name="min">-3.05</param>
|
||||
<param name="max"> 3.05</param>
|
||||
</command_interface>
|
||||
<command_interface name="effort">
|
||||
<param name="min">-320</param>
|
||||
<param name="max"> 320</param>
|
||||
</command_interface>
|
||||
<state_interface name="position">
|
||||
<param name="initial_value">${initial_positions['joint7']}</param>
|
||||
</state_interface>
|
||||
<state_interface name="velocity"/>
|
||||
<state_interface name="effort"/>
|
||||
</joint>
|
||||
|
||||
</ros2_control>
|
||||
|
||||
</xacro:unless>
|
||||
|
||||
</robot>
|
||||
@@ -27,6 +27,17 @@
|
||||
</geometry>
|
||||
</collision>
|
||||
</link>
|
||||
|
||||
<gazebo reference="${name}">
|
||||
<visual>
|
||||
<material>
|
||||
<ambient>${color_r * 0.7} ${color_g * 0.7} ${color_b * 0.7} ${color_a}</ambient>
|
||||
<diffuse>${color_r} ${color_g} ${color_b} ${color_a}</diffuse>
|
||||
<specular>0.3 0.3 0.3 1.0</specular>
|
||||
<emissive>0 0 0 1</emissive>
|
||||
</material>
|
||||
</visual>
|
||||
</gazebo>
|
||||
</xacro:macro>
|
||||
|
||||
<!-- Макрос для описания соединений -->
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import yaml
|
||||
import tempfile
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, Union
|
||||
|
||||
@@ -23,3 +26,13 @@ def load_robot_description(
|
||||
return model_path.read_text(encoding="utf-8")
|
||||
|
||||
raise FileNotFoundError(f"Supported file formats: .xacro/.urdf, got: {model_path}")
|
||||
|
||||
|
||||
def wrap_for_ros2_params(yaml_path: str, namespace: str) -> str:
|
||||
with open(yaml_path, "r") as f:
|
||||
data = yaml.safe_load(f)
|
||||
wrapped = {namespace: {"ros__parameters": data}}
|
||||
tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False)
|
||||
yaml.dump(wrapped, tmp, default_flow_style=False)
|
||||
tmp.close()
|
||||
return tmp.name
|
||||
@@ -229,3 +229,5 @@ def build_settings(settings_path: str, check_files: bool = True) -> Settings:
|
||||
assert_file(s.controller.moveit.moveit_cpp, "controller.moveit.moveit_cpp")
|
||||
|
||||
return s
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user