добавлена поддержка moveit

This commit is contained in:
Даниил Грабарь
2025-12-24 13:44:55 +10:00
parent 6acbd7ca6f
commit 084d4c0aa7
15 changed files with 373 additions and 492 deletions
@@ -1,36 +0,0 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, EmitEvent, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.events import Shutdown
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
declare_package_arg = DeclareLaunchArgument(
"package_name",
default_value="iiwa_bringup",
description="Package name where RViz config is stored",
)
package_name = LaunchConfiguration("package_name")
rviz_config = PathJoinSubstitution(
[FindPackageShare(package_name), "config", "rviz_iiwa.rviz"]
)
rviz = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
arguments=["-d", rviz_config],
output="log",
)
# При закрытии rviz закрываем все
shutdown_on_rviz_exit = RegisterEventHandler(
OnProcessExit(target_action=rviz, on_exit=[EmitEvent(event=Shutdown())])
)
return LaunchDescription([declare_package_arg, rviz, shutdown_on_rviz_exit])
@@ -4,21 +4,23 @@ from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from webots_ros2_driver.urdf_spawner import URDFSpawner
from iiwa_bringup.utils import converter
def _setup_controllers(context, *args, **kwargs):
model_path = LaunchConfiguration("model").perform(context)
xacro_file = LaunchConfiguration("xacro_file").perform(context)
robot_name = LaunchConfiguration("robot_name").perform(context)
transform = LaunchConfiguration("transform").perform(context)
rotation = LaunchConfiguration("rotation").perform(context)
timer = LaunchConfiguration("controller_timer").perform(context)
robot_description = converter.load_robot_description(
model_path=model_path, robot_name=robot_name
model_path=xacro_file, robot_name=robot_name
)
tmo = ["--controller-manager-timeout", str(timer)]
jsb = Node(
package="controller_manager",
@@ -16,7 +16,7 @@ from webots_ros2_driver.webots_launcher import WebotsLauncher
def _spawn_setup(context, *args, **kwargs):
model_path = LaunchConfiguration("model").perform(context)
xacro_file = LaunchConfiguration("xacro_file").perform(context)
robot_name = LaunchConfiguration("robot_name").perform(context)
world_path = LaunchConfiguration("world").perform(context)
transform = LaunchConfiguration("transform").perform(context)
@@ -29,13 +29,13 @@ def _spawn_setup(context, *args, **kwargs):
robot_name=robot_name,
parameters=[
{
"robot_description": model_path,
"use_sim_time": True,
"robot_description": xacro_file,
"use_sim_time": False,
"set_robot_state_publisher": False,
},
LaunchConfiguration("controller").perform(context),
],
respawn=False,
respawn=True,
)
controllers_launch = IncludeLaunchDescription(
@@ -51,7 +51,7 @@ def _spawn_setup(context, *args, **kwargs):
),
launch_arguments={
"robot_name": robot_name,
"model": model_path,
"xacro_file": xacro_file,
"transform": transform,
"rotation": rotation,
"controller_timer": timer,