瀏覽代碼

机械臂代码优化

bzx 9 月之前
當前提交
174bb75425
共有 85 個文件被更改,包括 4917 次插入0 次删除
  1. 1 0
      catkin_ws/.catkin_workspace
  2. 1 0
      catkin_ws/src/CMakeLists.txt
  3. 11 0
      catkin_ws/src/lstrobot_moveit_config_0605/.setup_assistant
  4. 10 0
      catkin_ws/src/lstrobot_moveit_config_0605/CMakeLists.txt
  5. 5 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/cartesian_limits.yaml
  6. 18 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/chomp_planning.yaml
  7. 13 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/fake_controllers.yaml
  8. 4 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/gazebo_controllers.yaml
  9. 307 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/gazebo_mr12urdf20240605.urdf
  10. 40 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/joint_limits.yaml
  11. 7 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/kinematics.yaml
  12. 39 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/mr12urdf20240605.srdf
  13. 197 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/ompl_planning.yaml
  14. 0 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/ros_controllers.yaml
  15. 10 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/sensors_3d.yaml
  16. 10 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/sensors_3d2.yaml
  17. 2 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/simple_moveit_controllers.yaml
  18. 39 0
      catkin_ws/src/lstrobot_moveit_config_0605/config/stomp_planning.yaml
  19. 21 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/chomp_planning_pipeline.launch.xml
  20. 15 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/default_warehouse_db.launch
  21. 66 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/demo.launch
  22. 21 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/demo_gazebo.launch
  23. 12 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/fake_moveit_controller_manager.launch.xml
  24. 34 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/gazebo.launch
  25. 17 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/joystick_control.launch
  26. 105 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/move_group.launch
  27. 354 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/moveit.rviz
  28. 15 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/moveit_rviz.launch
  29. 3 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/mr12urdf20240605_moveit_sensor_manager.launch.xml
  30. 20 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/ompl-chomp_planning_pipeline.launch.xml
  31. 24 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/ompl_planning_pipeline.launch.xml
  32. 15 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/pilz_industrial_motion_planner_planning_pipeline.launch.xml
  33. 26 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/planning_context.launch
  34. 10 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/planning_pipeline.launch.xml
  35. 4 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/ros_control_moveit_controller_manager.launch.xml
  36. 11 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/ros_controllers.launch
  37. 21 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/run_benchmark_ompl.launch
  38. 21 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/sensor_manager.launch.xml
  39. 16 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/setup_assistant.launch
  40. 8 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/simple_moveit_controller_manager.launch.xml
  41. 23 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/stomp_planning_pipeline.launch.xml
  42. 23 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/trajectory_execution.launch.xml
  43. 15 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/warehouse.launch
  44. 16 0
      catkin_ws/src/lstrobot_moveit_config_0605/launch/warehouse_settings.launch.xml
  45. 41 0
      catkin_ws/src/lstrobot_moveit_config_0605/package.xml
  46. 224 0
      catkin_ws/src/lstrobot_planning/CMakeLists.txt
  47. 5 0
      catkin_ws/src/lstrobot_planning/launch/moveit_control_server.launch
  48. 7 0
      catkin_ws/src/lstrobot_planning/launch/publish_pointcloud.launch
  49. 5 0
      catkin_ws/src/lstrobot_planning/launch/set_update_paramter_p.launch
  50. 20 0
      catkin_ws/src/lstrobot_planning/launch/start_ur5.launch
  51. 5 0
      catkin_ws/src/lstrobot_planning/launch/test.launch
  52. 30 0
      catkin_ws/src/lstrobot_planning/launch/ur5_bringup.launch
  53. 7 0
      catkin_ws/src/lstrobot_planning/msg/JointTrajectoryPoint_ex.msg
  54. 3 0
      catkin_ws/src/lstrobot_planning/msg/JointTrajectory_ex.msg
  55. 70 0
      catkin_ws/src/lstrobot_planning/package.xml
  56. 23 0
      catkin_ws/src/lstrobot_planning/scripts/11.py
  57. 70 0
      catkin_ws/src/lstrobot_planning/scripts/CloudFunc.py
  58. 二進制
      catkin_ws/src/lstrobot_planning/scripts/__pycache__/check.cpython-38.pyc
  59. 二進制
      catkin_ws/src/lstrobot_planning/scripts/__pycache__/command.cpython-38.pyc
  60. 二進制
      catkin_ws/src/lstrobot_planning/scripts/__pycache__/hanqiangpose.cpython-38.pyc
  61. 二進制
      catkin_ws/src/lstrobot_planning/scripts/__pycache__/hjsx.cpython-38.pyc
  62. 148 0
      catkin_ws/src/lstrobot_planning/scripts/check.py
  63. 32 0
      catkin_ws/src/lstrobot_planning/scripts/command.py
  64. 215 0
      catkin_ws/src/lstrobot_planning/scripts/dycl_0506.py
  65. 455 0
      catkin_ws/src/lstrobot_planning/scripts/hanqiangpose.py
  66. 143 0
      catkin_ws/src/lstrobot_planning/scripts/hjsx.py
  67. 884 0
      catkin_ws/src/lstrobot_planning/scripts/moveitServer2.py
  68. 115 0
      catkin_ws/src/lstrobot_planning/scripts/set_update_paramter_p.py
  69. 79 0
      catkin_ws/src/lstrobot_planning/src/add_octomap.cpp
  70. 148 0
      catkin_ws/src/lstrobot_planning/src/moveit_cartesian_demo.py
  71. 44 0
      catkin_ws/src/lstrobot_planning/src/pcd2octomap.cpp
  72. 14 0
      catkin_ws/src/mr12urdf20240605/CMakeLists.txt
  73. 1 0
      catkin_ws/src/mr12urdf20240605/config/joint_names_mr12urdf20240605.yaml
  74. 20 0
      catkin_ws/src/mr12urdf20240605/launch/display.launch
  75. 20 0
      catkin_ws/src/mr12urdf20240605/launch/gazebo.launch
  76. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link1.STL
  77. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link2.STL
  78. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link3.STL
  79. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link4.STL
  80. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link5.STL
  81. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/Link6.STL
  82. 二進制
      catkin_ws/src/mr12urdf20240605/meshes/base_link.STL
  83. 21 0
      catkin_ws/src/mr12urdf20240605/package.xml
  84. 8 0
      catkin_ws/src/mr12urdf20240605/urdf/mr12urdf20240605.csv
  85. 430 0
      catkin_ws/src/mr12urdf20240605/urdf/mr12urdf20240605.urdf

+ 1 - 0
catkin_ws/.catkin_workspace

@@ -0,0 +1 @@
+# This file currently only serves to mark the location of a catkin workspace for tool integration

+ 1 - 0
catkin_ws/src/CMakeLists.txt

@@ -0,0 +1 @@
+/opt/ros/noetic/share/catkin/cmake/toplevel.cmake

+ 11 - 0
catkin_ws/src/lstrobot_moveit_config_0605/.setup_assistant

@@ -0,0 +1,11 @@
+moveit_setup_assistant_config:
+  URDF:
+    package: mr12urdf20240605
+    relative_path: urdf/mr12urdf20240605.urdf
+    xacro_args: ""
+  SRDF:
+    relative_path: config/mr12urdf20240605.srdf
+  CONFIG:
+    author_name: 123
+    author_email: 123@qq.com
+    generated_timestamp: 1717572194

+ 10 - 0
catkin_ws/src/lstrobot_moveit_config_0605/CMakeLists.txt

@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.1.3)
+project(lstrobot_moveit_config_0605)
+
+find_package(catkin REQUIRED)
+
+catkin_package()
+
+install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+  PATTERN "setup_assistant.launch" EXCLUDE)
+install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

+ 5 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/cartesian_limits.yaml

@@ -0,0 +1,5 @@
+cartesian_limits:
+  max_trans_vel: 1
+  max_trans_acc: 2.25
+  max_trans_dec: -5
+  max_rot_vel: 1.57

+ 18 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/chomp_planning.yaml

@@ -0,0 +1,18 @@
+planning_time_limit: 10.0
+max_iterations: 200
+max_iterations_after_collision_free: 5
+smoothness_cost_weight: 0.1
+obstacle_cost_weight: 1.0
+learning_rate: 0.01
+smoothness_cost_velocity: 0.0
+smoothness_cost_acceleration: 1.0
+smoothness_cost_jerk: 0.0
+ridge_factor: 0.0
+use_pseudo_inverse: false
+pseudo_inverse_ridge_factor: 1e-4
+joint_update_limit: 0.1
+collision_clearance: 0.2
+collision_threshold: 0.07
+use_stochastic_descent: true
+enable_failure_recovery: false
+max_recovery_attempts: 5

+ 13 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/fake_controllers.yaml

@@ -0,0 +1,13 @@
+controller_list:
+  - name: fake_manipulator_controller
+    type: $(arg fake_execution_type)
+    joints:
+      - joint1
+      - joint2
+      - joint3
+      - joint4
+      - joint5
+      - joint6
+initial:  # Define initial robot poses per group
+  - group: manipulator
+    pose: home

+ 4 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/gazebo_controllers.yaml

@@ -0,0 +1,4 @@
+# Publish joint_states
+joint_state_controller:
+  type: joint_state_controller/JointStateController
+  publish_rate: 50

+ 307 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/gazebo_mr12urdf20240605.urdf

@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
+     Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
+     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
+<robot name="mr12urdf20240605">
+    <link name="base_link">
+        <!-- <inertial>
+      <origin
+        xyz="-0.0389794721428083 3.18209550907445E-05 0.114464775769165"
+        rpy="0 0 0" />
+      <mass
+        value="27.8470958329326" />
+      <inertia
+        ixx="0.333719655951858"
+        ixy="-0.000162752951771119"
+        ixz="-0.0150515703369821"
+        iyy="0.572256719027697"
+        iyz="6.64144679179418E-05"
+        izz="0.74716855955823" />
+    </inertial> -->
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/base_link.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="0 1 1 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/base_link.STL" />
+            </geometry>
+        </collision>
+        <inertial>
+            <mass value="0.1" />
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <inertia ixx="0.03" iyy="0.03" izz="0.03" ixy="0.0" ixz="0.0" iyz="0.0" />
+        </inertial>
+    </link>
+    <link name="Link1">
+        <inertial>
+            <origin xyz="0.0015836 0.02481 -0.16429" rpy="0 0 0" />
+            <mass value="28.856" />
+            <inertia ixx="0.80293" ixy="0.2052" ixz="-0.085925" iyy="0.84748" iyz="-0.048338" izz="0.87668" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link1.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="1 1 1 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link1.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint1" type="revolute">
+        <origin xyz="0 0 0.55" rpy="0 0 0" />
+        <parent link="base_link" />
+        <child link="Link1" />
+        <axis xyz="0 0 1" />
+        <limit lower="-2.878" upper="2.878" effort="150" velocity="3.541" />
+    </joint>
+    <link name="Link2">
+        <inertial>
+            <origin xyz="0.318649688799688 -0.000235571433145232 0.186136694407231" rpy="0 0 0" />
+            <mass value="7.80684304255034" />
+            <inertia ixx="0.0281236828911867" ixy="0.000281518665603689" ixz="-0.00939923269411962" iyy="0.185870193003645" iyz="1.16807601383937E-05" izz="0.200135929390865" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link2.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="1 1 1 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link2.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint2" type="revolute">
+        <origin xyz="0.14974 0.035343 0" rpy="1.5708 -1.5708 0" />
+        <parent link="Link1" />
+        <child link="Link2" />
+        <axis xyz="0 0 1" />
+        <limit lower="-2.529" upper="1.396" effort="150" velocity="3.541" />
+    </joint>
+    <link name="Link3">
+        <inertial>
+            <origin xyz="0.108553296371736 -0.0970725190395638 0.00155584136936515" rpy="0 0 0" />
+            <mass value="13.1020677700115" />
+            <inertia ixx="0.0894771695987357" ixy="0.00373169975921231" ixz="0.00305911419576535" iyy="0.0755527499176048" iyz="0.00497831742143842" izz="0.0627128517779011" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link3.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="1 1 1 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link3.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint3" type="revolute">
+        <origin xyz="0.76075 0 0.033754" rpy="0 0 0" />
+        <parent link="Link2" />
+        <child link="Link3" />
+        <axis xyz="0 0 1" />
+        <limit lower="-1.308" upper="2.529" effort="150" velocity="3.733" />
+    </joint>
+    <link name="Link4">
+        <inertial>
+            <origin xyz="0.0144892098854688 -0.000636132360795127 -0.376459479520837" rpy="0 0 0" />
+            <mass value="8.67998704574409" />
+            <inertia ixx="0.466226625992446" ixy="0.000500906822306766" ixz="-0.015294045664646" iyy="0.451075373457536" iyz="0.000649456671583942" izz="0.036563182959402" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link4.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="0 1 1 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link4.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint4" type="revolute">
+        <origin xyz="0.19783 -1.0829 0" rpy="1.5708 0 0" />
+        <parent link="Link3" />
+        <child link="Link4" />
+        <axis xyz="0 0 1" />
+        <limit lower="-3.314" upper="3.314" effort="88.5" velocity="6.838" />
+    </joint>
+    <link name="Link5">
+        <inertial>
+            <origin xyz="-6.1697E-06 -0.048434 -0.0024999" rpy="0 0 0" />
+            <mass value="1.2351" />
+            <inertia ixx="0.0041541" ixy="-7.1529E-06" ixz="-1.1135E-05" iyy="0.0031617" iyz="0.00015352" izz="0.0035434" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link5.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="0.79216 0.81961 0.93333 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link5.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint5" type="revolute">
+        <origin xyz="0 0 0" rpy="1.5708 1.5708 0" />
+        <parent link="Link4" />
+        <child link="Link5" />
+        <axis xyz="0 0 1" />
+        <limit lower="-3.663" upper="0.75" effort="45.52" velocity="4.815" />
+    </joint>
+    <link name="Link6">
+        <inertial>
+            <origin xyz="0.048649 -0.00090428 0.27553" rpy="0 0 0" />
+            <mass value="1.8877" />
+            <inertia ixx="0.0086566" ixy="0.00012203" ixz="-0.00084157" iyy="0.0053122" iyz="0.00012437" izz="0.0064842" />
+        </inertial>
+        <visual>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link6.STL" />
+            </geometry>
+            <material name="">
+                <color rgba="0.75294 0.75294 0.75294 1" />
+            </material>
+        </visual>
+        <collision>
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <geometry>
+                <mesh filename="package://mr12urdf20240605/meshes/Link6.STL" />
+            </geometry>
+        </collision>
+    </link>
+    <joint name="joint6" type="revolute">
+        <origin xyz="0 0 0" rpy="1.5708 0 0" />
+        <parent link="Link5" />
+        <child link="Link6" />
+        <axis xyz="0 0 1" />
+        <limit lower="-3.838" upper="3.838" effort="32.64" velocity="23.655" />
+    </joint>
+    <joint name="joint_flp" type="fixed">
+        <parent link="Link6" />
+        <child link="link_flp" />
+        <!-- 法兰盘 -->
+        <origin rpy=" 0 0 3.1415926" xyz="0  0  0.100" />
+    </joint>
+    <link name="link_flp">
+        <collision>
+            <geometry>
+                <box size="0.0001 0.0001 0.0001" />
+            </geometry>
+            <origin rpy="0 0 0" xyz="0 0 0" />
+        </collision>
+        <inertial>
+            <mass value="0.1" />
+            <origin xyz="0 0 0" rpy="0 0 0" />
+            <inertia ixx="0.03" iyy="0.03" izz="0.03" ixy="0.0" ixz="0.0" iyz="0.0" />
+        </inertial>
+    </link>
+    <joint name="joint_end" type="fixed">
+        <parent link="link_flp" />
+        <child link="link_end" />
+        <origin rpy="0.0 0.325888 3.1415926" xyz="-0.06371  0.004214  0.7387658" />
+    </joint>
+    <link name="link_end" />
+    <transmission name="trans_joint1">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint1">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint1_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <transmission name="trans_joint2">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint2">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint2_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <transmission name="trans_joint3">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint3">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint3_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <transmission name="trans_joint4">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint4">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint4_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <transmission name="trans_joint5">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint5">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint5_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <transmission name="trans_joint6">
+        <type>transmission_interface/SimpleTransmission</type>
+        <joint name="joint6">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+        </joint>
+        <actuator name="joint6_motor">
+            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
+            <mechanicalReduction>1</mechanicalReduction>
+        </actuator>
+    </transmission>
+    <gazebo>
+        <plugin name="gazebo_ros_control">
+            <robotNamespace>/</robotNamespace>
+        </plugin>
+    </gazebo>
+</robot>
+

+ 40 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/joint_limits.yaml

@@ -0,0 +1,40 @@
+# joint_limits.yaml allows the dynamics properties specified in the URDF to be overwritten or augmented as needed
+
+# For beginners, we downscale velocity and acceleration limits.
+# You can always specify higher scaling factors (<= 1.0) in your motion requests.  # Increase the values below to 1.0 to always move at maximum speed.
+default_velocity_scaling_factor: 0.1
+default_acceleration_scaling_factor: 0.1
+
+# Specific joint properties can be changed with the keys [max_position, min_position, max_velocity, max_acceleration]
+# Joint limits can be turned off with [has_velocity_limits, has_acceleration_limits]
+joint_limits:
+  joint1:
+    has_velocity_limits: true
+    max_velocity: 3.541
+    has_acceleration_limits: false
+    max_acceleration: 0
+  joint2:
+    has_velocity_limits: true
+    max_velocity: 3.541
+    has_acceleration_limits: false
+    max_acceleration: 0
+  joint3:
+    has_velocity_limits: true
+    max_velocity: 3.733
+    has_acceleration_limits: false
+    max_acceleration: 0
+  joint4:
+    has_velocity_limits: true
+    max_velocity: 6.838
+    has_acceleration_limits: false
+    max_acceleration: 0
+  joint5:
+    has_velocity_limits: true
+    max_velocity: 4.815
+    has_acceleration_limits: false
+    max_acceleration: 0
+  joint6:
+    has_velocity_limits: true
+    max_velocity: 23.655
+    has_acceleration_limits: false
+    max_acceleration: 0

+ 7 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/kinematics.yaml

@@ -0,0 +1,7 @@
+manipulator:
+  kinematics_solver: trac_ik_kinematics_plugin/TRAC_IKKinematicsPlugin
+  kinematics_solver_search_resolution: 0.005
+  kinematics_solver_timeout: 0.005
+  goal_joint_tolerance: 0.0001
+  goal_position_tolerance: 0.0001
+  goal_orientation_tolerance: 0.001

+ 39 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/mr12urdf20240605.srdf

@@ -0,0 +1,39 @@
+<?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
+-->
+<robot name="mr12urdf20240605">
+    <!--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="manipulator">
+        <chain base_link="base_link" tip_link="link_end"/>
+    </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="manipulator">
+        <joint name="joint1" value="0"/>
+        <joint name="joint2" value="0"/>
+        <joint name="joint3" value="0"/>
+        <joint name="joint4" value="0"/>
+        <joint name="joint5" value="0"/>
+        <joint name="joint6" value="0"/>
+    </group_state>
+    <!--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="Link1" link2="Link2" reason="Adjacent"/>
+    <disable_collisions link1="Link1" link2="base_link" reason="Adjacent"/>
+    <disable_collisions link1="Link1" link2="link_flp" reason="Never"/>
+    <disable_collisions link1="Link2" link2="Link3" reason="Adjacent"/>
+    <disable_collisions link1="Link2" link2="Link5" reason="Never"/>
+    <disable_collisions link1="Link2" link2="link_flp" reason="Never"/>
+    <disable_collisions link1="Link3" link2="Link4" reason="Adjacent"/>
+    <disable_collisions link1="Link3" link2="Link5" reason="Never"/>
+    <disable_collisions link1="Link3" link2="link_flp" reason="Never"/>
+    <disable_collisions link1="Link4" link2="Link5" reason="Adjacent"/>
+    <disable_collisions link1="Link4" link2="link_flp" reason="Never"/>
+    <disable_collisions link1="Link5" link2="Link6" reason="Adjacent"/>
+    <disable_collisions link1="Link5" link2="link_flp" reason="Never"/>
+    <disable_collisions link1="Link6" link2="link_flp" reason="Adjacent"/>
+</robot>

+ 197 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/ompl_planning.yaml

@@ -0,0 +1,197 @@
+planner_configs:
+  AnytimePathShortening:
+    type: geometric::AnytimePathShortening
+    shortcut: true  # Attempt to shortcut all new solution paths
+    hybridize: true  # Compute hybrid solution trajectories
+    max_hybrid_paths: 24  # Number of hybrid paths generated per iteration
+    num_planners: 4  # The number of default planners to use for planning
+    planners: ""  # A comma-separated list of planner types (e.g., "PRM,EST,RRTConnect"Optionally, planner parameters can be passed to change the default:"PRM[max_nearest_neighbors=5],EST[goal_bias=.5],RRT[range=10. goal_bias=.1]"
+  SBL:
+    type: geometric::SBL
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+  EST:
+    type: geometric::EST
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0 setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
+  LBKPIECE:
+    type: geometric::LBKPIECE
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9
+    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
+  BKPIECE:
+    type: geometric::BKPIECE
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9
+    failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5
+    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
+  KPIECE:
+    type: geometric::KPIECE
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
+    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9 (0.0,1.]
+    failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5
+    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
+  RRT:
+    type: geometric::RRT
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
+  RRTConnect:
+    type: geometric::RRTConnect
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+  RRTstar:
+    type: geometric::RRTstar
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
+    delay_collision_checking: 1  # Stop collision checking as soon as C-free parent found. default 1
+  TRRT:
+    type: geometric::TRRT
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
+    max_states_failed: 10  # when to start increasing temp. default: 10
+    temp_change_factor: 2.0  # how much to increase or decrease temp. default: 2.0
+    min_temperature: 10e-10  # lower limit of temp change. default: 10e-10
+    init_temperature: 10e-6  # initial temperature. default: 10e-6
+    frontier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
+    frontier_node_ratio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
+    k_constant: 0.0  # value used to normalize expresssion. default: 0.0 set in setup()
+  PRM:
+    type: geometric::PRM
+    max_nearest_neighbors: 10  # use k nearest neighbors. default: 10
+  PRMstar:
+    type: geometric::PRMstar
+  FMT:
+    type: geometric::FMT
+    num_samples: 1000  # number of states that the planner should sample. default: 1000
+    radius_multiplier: 1.1  # multiplier used for the nearest neighbors search radius. default: 1.1
+    nearest_k: 1  # use Knearest strategy. default: 1
+    cache_cc: 1  # use collision checking cache. default: 1
+    heuristics: 0  # activate cost to go heuristics. default: 0
+    extended_fmt: 1  # activate the extended FMT*: adding new samples if planner does not finish successfully. default: 1
+  BFMT:
+    type: geometric::BFMT
+    num_samples: 1000  # number of states that the planner should sample. default: 1000
+    radius_multiplier: 1.0  # multiplier used for the nearest neighbors search radius. default: 1.0
+    nearest_k: 1  # use the Knearest strategy. default: 1
+    balanced: 0  # exploration strategy: balanced true expands one tree every iteration. False will select the tree with lowest maximum cost to go. default: 1
+    optimality: 1  # termination strategy: optimality true finishes when the best possible path is found. Otherwise, the algorithm will finish when the first feasible path is found. default: 1
+    heuristics: 1  # activates cost to go heuristics. default: 1
+    cache_cc: 1  # use the collision checking cache. default: 1
+    extended_fmt: 1  # Activates the extended FMT*: adding new samples if planner does not finish successfully. default: 1
+  PDST:
+    type: geometric::PDST
+  STRIDE:
+    type: geometric::STRIDE
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
+    use_projected_distance: 0  # whether nearest neighbors are computed based on distances in a projection of the state rather distances in the state space itself. default: 0
+    degree: 16  # desired degree of a node in the Geometric Near-neightbor Access Tree (GNAT). default: 16
+    max_degree: 18  # max degree of a node in the GNAT. default: 12
+    min_degree: 12  # min degree of a node in the GNAT. default: 12
+    max_pts_per_leaf: 6  # max points per leaf in the GNAT. default: 6
+    estimated_dimension: 0.0  # estimated dimension of the free space. default: 0.0
+    min_valid_path_fraction: 0.2  # Accept partially valid moves above fraction. default: 0.2
+  BiTRRT:
+    type: geometric::BiTRRT
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    temp_change_factor: 0.1  # how much to increase or decrease temp. default: 0.1
+    init_temperature: 100  # initial temperature. default: 100
+    frontier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
+    frontier_node_ratio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
+    cost_threshold: 1e300  # the cost threshold. Any motion cost that is not better will not be expanded. default: inf
+  LBTRRT:
+    type: geometric::LBTRRT
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
+    epsilon: 0.4  # optimality approximation factor. default: 0.4
+  BiEST:
+    type: geometric::BiEST
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+  ProjEST:
+    type: geometric::ProjEST
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
+  LazyPRM:
+    type: geometric::LazyPRM
+    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
+  LazyPRMstar:
+    type: geometric::LazyPRMstar
+  SPARS:
+    type: geometric::SPARS
+    stretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
+    sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
+    dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001
+    max_failures: 1000  # maximum consecutive failure limit. default: 1000
+  SPARStwo:
+    type: geometric::SPARStwo
+    stretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
+    sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
+    dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001
+    max_failures: 5000  # maximum consecutive failure limit. default: 5000
+  AITstar:
+    type: geometric::AITstar
+    use_k_nearest: 1  # whether to use a k-nearest RGG connection model (1) or an r-disc model (0). Default: 1
+    rewire_factor: 1.001  # rewire factor of the RGG. Valid values: [1.0:0.01:3.0]. Default: 1.001
+    samples_per_batch: 100  # batch size. Valid values: [1:1:1000]. Default: 100
+    use_graph_pruning: 1  # enable graph pruning (1) or not (0). Default: 1
+    find_approximate_solutions: 0  # track approximate solutions (1) or not (0). Default: 0
+    set_max_num_goals: 1  # maximum number of goals sampled from sampleable goal regions. Valid values: [1:1:1000]. Default: 1
+  ABITstar:
+    type: geometric::ABITstar
+    use_k_nearest: 1  # whether to use a k-nearest RGG connection model (1) or an r-disc model (0). Default: 1
+    rewire_factor: 1.001  # rewire factor of the RGG. Valid values: [1.0:0.01:3.0]. Default: 1.001
+    samples_per_batch: 100  # batch size. Valid values: [1:1:1000]. Default: 100
+    use_graph_pruning: 1  # enable graph pruning (1) or not (0). Default: 1
+    prune_threshold_as_fractional_cost_change: 0.1  # fractional change in the solution cost AND problem measure necessary for pruning to occur. Default: 0.1
+    delay_rewiring_to_first_solution: 0  # delay (1) or not (0) rewiring until a solution is found. Default: 0
+    use_just_in_time_sampling: 0  # delay the generation of samples until they are * necessary. Only works with r-disc connection and path length minimization. Default: 0
+    drop_unconnected_samples_on_prune: 0  # drop unconnected samples when pruning, regardless of their heuristic value. Default: 0
+    stop_on_each_solution_improvement: 0  # stop the planner each time a solution improvement is found. Useful for debugging. Default: 0
+    use_strict_queue_ordering: 0  # sort edges in the queue at the end of the batch (0) or after each rewiring (1). Default: 0
+    find_approximate_solutions: 0  # track approximate solutions (1) or not (0). Default: 0
+    initial_inflation_factor: 1000000  # inflation factor for the initial search. Valid values: [1.0:0.01:1000000.0]. Default: 1000000
+    inflation_scaling_parameter: 10  # scaling parameter for the inflation factor update policy. Valid values: [1.0:0.01:1000000.0]. Default: 0
+    truncation_scaling_parameter: 5.0  # scaling parameter for the truncation factor update policy. Valid values: [1.0:0.01:1000000.0]. Default: 0
+  BITstar:
+    type: geometric::BITstar
+    use_k_nearest: 1  # whether to use a k-nearest RGG connection model (1) or an r-disc model (0). Default: 1
+    rewire_factor: 1.001  # rewire factor of the RGG. Valid values: [1.0:0.01:3.0]. Default: 1.001
+    samples_per_batch: 100  # batch size. Valid values: [1:1:1000]. Default: 100
+    use_graph_pruning: 1  # enable graph pruning (1) or not (0). Default: 1
+    prune_threshold_as_fractional_cost_change: 0.1  # fractional change in the solution cost AND problem measure necessary for pruning to occur. Default: 0.1
+    delay_rewiring_to_first_solution: 0  # delay (1) or not (0) rewiring until a solution is found. Default: 0
+    use_just_in_time_sampling: 0  # delay the generation of samples until they are * necessary. Only works with r-disc connection and path length minimization. Default: 0
+    drop_unconnected_samples_on_prune: 0  # drop unconnected samples when pruning, regardless of their heuristic value. Default: 0
+    stop_on_each_solution_improvement: 0  # stop the planner each time a solution improvement is found. Useful for debugging. Default: 0
+    use_strict_queue_ordering: 0  # sort edges in the queue at the end of the batch (0) or after each rewiring (1). Default: 0
+    find_approximate_solutions: 0  # track approximate solutions (1) or not (0). Default: 0
+manipulator:
+  planner_configs:
+    - AnytimePathShortening
+    - SBL
+    - EST
+    - LBKPIECE
+    - BKPIECE
+    - KPIECE
+    - RRT
+    - RRTConnect
+    - RRTstar
+    - TRRT
+    - PRM
+    - PRMstar
+    - FMT
+    - BFMT
+    - PDST
+    - STRIDE
+    - BiTRRT
+    - LBTRRT
+    - BiEST
+    - ProjEST
+    - LazyPRM
+    - LazyPRMstar
+    - SPARS
+    - SPARStwo
+    - AITstar
+    - ABITstar
+    - BITstar
+  projection_evaluator: joints(joint1,joint2)
+  longest_valid_segment_fraction: 0.001

+ 0 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/ros_controllers.yaml


+ 10 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/sensors_3d.yaml

@@ -0,0 +1,10 @@
+sensors:
+  - filtered_cloud_topic: filtered_cloud
+    max_range: 5.0
+    max_update_rate: 1.0
+    padding_offset: 0.1
+    padding_scale: 1.0
+    point_cloud_topic: /pointcloud/output
+    point_subsample: 1
+    sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
+

+ 10 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/sensors_3d2.yaml

@@ -0,0 +1,10 @@
+sensors2:
+  - filtered_cloud_topic: filtered_cloud
+    max_range: 5.0
+    max_update_rate: 1.0
+    padding_offset: 0.1
+    padding_scale: 1.0
+    point_cloud_topic: /pointcloud/output2
+    point_subsample: 1
+    sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
+

+ 2 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/simple_moveit_controllers.yaml

@@ -0,0 +1,2 @@
+controller_list:
+  []

+ 39 - 0
catkin_ws/src/lstrobot_moveit_config_0605/config/stomp_planning.yaml

@@ -0,0 +1,39 @@
+stomp/manipulator:
+  group_name: manipulator
+  optimization:
+    num_timesteps: 60
+    num_iterations: 40
+    num_iterations_after_valid: 0
+    num_rollouts: 30
+    max_rollouts: 30
+    initialization_method: 1  # [1 : LINEAR_INTERPOLATION, 2 : CUBIC_POLYNOMIAL, 3 : MININUM_CONTROL_COST]
+    control_cost_weight: 0.0
+  task:
+    noise_generator:
+      - class: stomp_moveit/NormalDistributionSampling
+        stddev: [0.05, 0.05, 0.05, 0.05, 0.05, 0.05]
+    cost_functions:
+      - class: stomp_moveit/CollisionCheck
+        collision_penalty: 1.0
+        cost_weight: 1.0
+        kernel_window_percentage: 0.2
+        longest_valid_joint_move: 0.05
+    noisy_filters:
+      - class: stomp_moveit/JointLimits
+        lock_start: True
+        lock_goal: True
+      - class: stomp_moveit/MultiTrajectoryVisualization
+        line_width: 0.02
+        rgb: [255, 255, 0]
+        marker_array_topic: stomp_trajectories
+        marker_namespace: noisy
+    update_filters:
+      - class: stomp_moveit/PolynomialSmoother
+        poly_order: 6
+      - class: stomp_moveit/TrajectoryVisualization
+        line_width: 0.05
+        rgb: [0, 191, 255]
+        error_rgb: [255, 0, 0]
+        publish_intermediate: True
+        marker_topic: stomp_trajectory
+        marker_namespace: optimized

+ 21 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/chomp_planning_pipeline.launch.xml

@@ -0,0 +1,21 @@
+<launch>
+  <arg name="start_state_max_bounds_error" default="0.1" />
+  <arg name="jiggle_fraction" default="0.05" />
+  <!-- The request adapters (plugins) used when planning. ORDER MATTERS! -->
+  <arg name="planning_adapters"
+       default="default_planner_request_adapters/LimitMaxCartesianLinkSpeed
+                default_planner_request_adapters/AddTimeParameterization
+                default_planner_request_adapters/ResolveConstraintFrames
+                default_planner_request_adapters/FixWorkspaceBounds
+                default_planner_request_adapters/FixStartStateBounds
+                default_planner_request_adapters/FixStartStateCollision
+                default_planner_request_adapters/FixStartStatePathConstraints"
+                />
+
+  <param name="planning_plugin" value="chomp_interface/CHOMPPlanner" />
+  <param name="request_adapters" value="$(arg planning_adapters)" />
+  <param name="start_state_max_bounds_error" value="$(arg start_state_max_bounds_error)" />
+  <param name="jiggle_fraction" value="$(arg jiggle_fraction)" />
+
+  <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/chomp_planning.yaml" />
+</launch>

+ 15 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/default_warehouse_db.launch

@@ -0,0 +1,15 @@
+<launch>
+
+  <arg name="reset" default="false"/>
+  <!-- If not specified, we'll use a default database location -->
+  <arg name="moveit_warehouse_database_path" default="$(find lstrobot_moveit_config_0605)/default_warehouse_mongo_db" />
+
+  <!-- Launch the warehouse with the configured database location -->
+  <include file="$(dirname)/warehouse.launch">
+    <arg name="moveit_warehouse_database_path" value="$(arg moveit_warehouse_database_path)" />
+  </include>
+
+  <!-- If we want to reset the database, run this node -->
+  <node if="$(arg reset)" name="$(anon moveit_default_db_reset)" type="moveit_init_demo_warehouse" pkg="moveit_ros_warehouse" respawn="false" output="screen" />
+
+</launch>

+ 66 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/demo.launch

@@ -0,0 +1,66 @@
+<launch>
+
+  <!-- specify the planning pipeline -->
+  <arg name="pipeline" default="ompl" />
+
+  <!-- By default, we do not start a database (it can be large) -->
+  <arg name="db" default="false" />
+  <!-- Allow user to specify database location -->
+  <arg name="db_path" default="$(find lstrobot_moveit_config_0605)/default_warehouse_mongo_db" />
+
+  <!-- By default, we are not in debug mode -->
+  <arg name="debug" default="false" />
+
+  <!-- By default, we will load or override the robot_description -->
+  <arg name="load_robot_description" default="true"/>
+
+  <!-- Choose controller manager: fake, simple, or ros_control -->
+  <arg name="moveit_controller_manager" default="fake" />
+  <!-- Set execution mode for fake execution controllers -->
+  <arg name="fake_execution_type" default="interpolate" />
+
+  <!-- By default, hide joint_state_publisher's GUI in 'fake' controller_manager mode -->
+  <arg name="use_gui" default="false" />
+  <arg name="use_rviz" default="true" />
+
+  <!-- If needed, broadcast static tf for robot root -->
+
+  <group if="$(eval arg('moveit_controller_manager') == 'fake')">
+    <!-- We do not have a real robot connected, so publish fake joint states via a joint_state_publisher
+         MoveIt's fake controller's joint states are considered via the 'source_list' parameter -->
+    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" unless="$(arg use_gui)">
+      <rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
+    </node>
+    <!-- If desired, a GUI version is available allowing to move the simulated robot around manually
+         This corresponds to moving around the real robot without the use of MoveIt. -->
+    <node name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" if="$(arg use_gui)">
+      <rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
+    </node>
+
+    <!-- Given the published joint states, publish tf for the robot links -->
+    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
+  </group>
+
+  <!-- Run the main MoveIt executable without trajectory execution (we do not have controllers configured by default) -->
+  <include file="$(dirname)/move_group.launch">
+    <arg name="allow_trajectory_execution" value="true"/>
+    <arg name="moveit_controller_manager" value="$(arg moveit_controller_manager)" />
+    <arg name="fake_execution_type" value="$(arg fake_execution_type)"/>
+    <arg name="info" value="true"/>
+    <arg name="debug" value="$(arg debug)"/>
+    <arg name="pipeline" value="$(arg pipeline)"/>
+    <arg name="load_robot_description" value="$(arg load_robot_description)"/>
+  </include>
+
+  <!-- Run Rviz and load the default config to see the state of the move_group node -->
+  <include file="$(dirname)/moveit_rviz.launch" if="$(arg use_rviz)">
+    <arg name="rviz_config" value="$(dirname)/moveit.rviz"/>
+    <arg name="debug" value="$(arg debug)"/>
+  </include>
+
+  <!-- If database loading was enabled, start mongodb as well -->
+  <include file="$(dirname)/default_warehouse_db.launch" if="$(arg db)">
+    <arg name="moveit_warehouse_database_path" value="$(arg db_path)"/>
+  </include>
+
+</launch>

+ 21 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/demo_gazebo.launch

@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<launch>
+  <!-- MoveIt options -->
+  <arg name="pipeline" default="ompl" doc="Planning pipeline to use with MoveIt"/>
+
+  <!-- Gazebo options -->
+  <arg name="gazebo_gui" default="true" doc="Start Gazebo GUI"/>
+  <arg name="paused" default="false" doc="Start Gazebo paused"/>
+  <arg name="world_name" default="worlds/empty.world" doc="Gazebo world file"/>
+  <arg name="world_pose" default="-x 0 -y 0 -z 0 -R 0 -P 0 -Y 0" doc="Pose to spawn the robot at"/>
+
+  <!-- Launch Gazebo and spawn the robot -->
+  <include file="$(dirname)/gazebo.launch" pass_all_args="true"/>
+
+  <!-- Launch MoveIt -->
+  <include file="$(dirname)/demo.launch" pass_all_args="true">
+    <!-- robot_description is loaded by gazebo.launch, to enable Gazebo features -->
+    <arg name="load_robot_description" value="false" />
+    <arg name="moveit_controller_manager" value="ros_control" />
+  </include>
+</launch>

+ 12 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/fake_moveit_controller_manager.launch.xml

@@ -0,0 +1,12 @@
+<launch>
+
+  <!-- execute the trajectory in 'interpolate' mode or jump to goal position in 'last point' mode -->
+  <arg name="fake_execution_type" default="interpolate" />
+
+  <!-- Set the param that trajectory_execution_manager needs to find the controller plugin -->
+  <param name="moveit_controller_manager" value="moveit_fake_controller_manager/MoveItFakeControllerManager"/>
+
+  <!-- The rest of the params are specific to this plugin -->
+  <rosparam subst_value="true" file="$(find lstrobot_moveit_config_0605)/config/fake_controllers.yaml"/>
+
+</launch>

+ 34 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/gazebo.launch

@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<launch>
+  <!-- Gazebo options -->
+  <arg name="gazebo_gui" default="true" doc="Start Gazebo GUI"/>
+  <arg name="paused" default="false" doc="Start Gazebo paused"/>
+  <arg name="world_name" default="worlds/empty.world" doc="Gazebo world file"/>
+  <arg name="world_pose" default="-x 0 -y 0 -z 0 -R 0 -P 0 -Y 0" doc="Pose to spawn the robot at"/>
+  <arg name="initial_joint_positions" default=" -J joint1 0 -J joint2 0 -J joint3 0 -J joint4 0 -J joint5 0 -J joint6 0" doc="Initial joint configuration of the robot"/>
+
+  <!-- Start Gazebo paused to allow the controllers to pickup the initial pose -->
+  <include file="$(find gazebo_ros)/launch/empty_world.launch" pass_all_args="true">
+    <arg name="paused" value="true"/>
+  </include>
+
+  <!-- Set the robot urdf on the parameter server -->
+  <param name="robot_description" textfile="$(find lstrobot_moveit_config_0605)/config/gazebo_mr12urdf20240605.urdf" />
+
+  <!-- Unpause the simulation after loading the robot model -->
+  <arg name="unpause" value="$(eval '' if arg('paused') else '-unpause')" />
+
+  <!-- Spawn the robot in Gazebo -->
+  <node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot $(arg unpause) $(arg world_pose) $(arg initial_joint_positions)"
+    respawn="false" output="screen" />
+
+  <!-- Load the controller parameters onto the parameter server -->
+  <rosparam file="$(find lstrobot_moveit_config_0605)/config/gazebo_controllers.yaml" />
+  <include file="$(dirname)/ros_controllers.launch"/>
+
+  <!-- Spawn the Gazebo ROS controllers -->
+  <node name="gazebo_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller" />
+
+  <!-- Given the published joint states, publish tf for the robot links -->
+  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
+</launch>

+ 17 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/joystick_control.launch

@@ -0,0 +1,17 @@
+<launch>
+  <!-- See moveit_ros/visualization/doc/joystick.rst for documentation -->
+
+  <arg name="dev" default="/dev/input/js0" />
+
+  <!-- Launch joy node -->
+  <node pkg="joy" type="joy_node" name="joy">
+    <param name="dev" value="$(arg dev)" /> <!-- Customize this to match the location your joystick is plugged in on-->
+    <param name="deadzone" value="0.2" />
+    <param name="autorepeat_rate" value="40" />
+    <param name="coalesce_interval" value="0.025" />
+  </node>
+
+  <!-- Launch python interface -->
+  <node pkg="moveit_ros_visualization" type="moveit_joy.py" output="screen" name="moveit_joy"/>
+
+</launch>

+ 105 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/move_group.launch

@@ -0,0 +1,105 @@
+<launch>
+
+  <!-- GDB Debug Option -->
+  <arg name="debug" default="false" />
+  <arg unless="$(arg debug)" name="launch_prefix" value="" />
+  <arg     if="$(arg debug)" name="launch_prefix"
+           value="gdb -x $(dirname)/gdb_settings.gdb --ex run --args" />
+
+  <!-- Verbose Mode Option -->
+  <arg name="info" default="$(arg debug)" />
+  <arg unless="$(arg info)" name="command_args" value="" />
+  <arg     if="$(arg info)" name="command_args" value="--debug" />
+
+  <!-- move_group settings -->
+  <arg name="pipeline" default="ompl" />
+  <arg name="allow_trajectory_execution" default="true"/>
+  <arg name="moveit_controller_manager" default="simple" />
+  <arg name="fake_execution_type" default="interpolate"/>
+  <arg name="max_safe_path_cost" default="1"/>
+  <arg name="publish_monitored_planning_scene" default="true"/>
+
+  <arg name="capabilities" default=""/>
+  <arg name="disable_capabilities" default=""/>
+  <!-- load these non-default MoveGroup capabilities (space seperated) -->
+  <!--
+  <arg name="capabilities" value="
+                a_package/AwsomeMotionPlanningCapability
+                another_package/GraspPlanningPipeline
+                " />
+  -->
+
+  <!-- inhibit these default MoveGroup capabilities (space seperated) -->
+  <!--
+  <arg name="disable_capabilities" value="
+                move_group/MoveGroupKinematicsService
+                move_group/ClearOctomapService
+                " />
+  -->
+
+  <arg name="load_robot_description" default="false" />
+  <!-- load URDF, SRDF and joint_limits configuration -->
+  <include file="$(dirname)/planning_context.launch">
+    <arg name="load_robot_description" value="$(arg load_robot_description)" />
+  </include>
+
+  <!-- Planning Pipelines -->
+  <group ns="move_group/planning_pipelines">
+
+    <!-- OMPL -->
+    <include file="$(dirname)/planning_pipeline.launch.xml">
+      <arg name="pipeline" value="ompl" />
+    </include>
+
+    <!-- CHOMP -->
+    <include file="$(dirname)/planning_pipeline.launch.xml">
+      <arg name="pipeline" value="chomp" />
+    </include>
+
+    <!-- Pilz Industrial Motion -->
+    <include file="$(dirname)/planning_pipeline.launch.xml">
+      <arg name="pipeline" value="pilz_industrial_motion_planner" />
+    </include>
+
+    <!-- Support custom planning pipeline -->
+    <include if="$(eval arg('pipeline') not in ['ompl', 'chomp', 'pilz_industrial_motion_planner'])"
+             file="$(dirname)/planning_pipeline.launch.xml">
+      <arg name="pipeline" value="$(arg pipeline)" />
+    </include>
+  </group>
+
+  <!-- Trajectory Execution Functionality -->
+  <include ns="move_group" file="$(dirname)/trajectory_execution.launch.xml" if="$(arg allow_trajectory_execution)">
+    <arg name="moveit_manage_controllers" value="true" />
+    <arg name="moveit_controller_manager" value="$(arg moveit_controller_manager)" />
+    <arg name="fake_execution_type" value="$(arg fake_execution_type)" />
+  </include>
+
+  <!-- Sensors Functionality -->
+  <include ns="move_group" file="$(dirname)/sensor_manager.launch.xml" if="$(arg allow_trajectory_execution)">
+    <arg name="moveit_sensor_manager" value="mr12urdf20240605" />
+  </include>
+
+  <!-- Start the actual move_group node/action server -->
+  <node name="move_group" launch-prefix="$(arg launch_prefix)" pkg="moveit_ros_move_group" type="move_group" respawn="false" output="screen" args="$(arg command_args)">
+    <!-- Set the display variable, in case OpenGL code is used internally -->
+    <env name="DISPLAY" value="$(optenv DISPLAY :0)" />
+
+    <param name="allow_trajectory_execution" value="$(arg allow_trajectory_execution)"/>
+    <param name="sense_for_plan/max_safe_path_cost" value="$(arg max_safe_path_cost)"/>
+    <param name="default_planning_pipeline" value="$(arg pipeline)" />
+    <param name="capabilities" value="$(arg capabilities)" />
+    <param name="disable_capabilities" value="$(arg disable_capabilities)" />
+
+    <!-- do not copy dynamics information from /joint_states to internal robot monitoring
+         default to false, because almost nothing in move_group relies on this information -->
+    <param name="monitor_dynamics" value="false" />
+
+    <!-- Publish the planning scene of the physical robot so that rviz plugin can know actual robot -->
+    <param name="planning_scene_monitor/publish_planning_scene" value="$(arg publish_monitored_planning_scene)" />
+    <param name="planning_scene_monitor/publish_geometry_updates" value="$(arg publish_monitored_planning_scene)" />
+    <param name="planning_scene_monitor/publish_state_updates" value="$(arg publish_monitored_planning_scene)" />
+    <param name="planning_scene_monitor/publish_transforms_updates" value="$(arg publish_monitored_planning_scene)" />
+  </node>
+
+</launch>

+ 354 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/moveit.rviz

@@ -0,0 +1,354 @@
+Panels:
+  - Class: rviz/Displays
+    Help Height: 84
+    Name: Displays
+    Property Tree Widget:
+      Expanded:
+        - /MotionPlanning1
+      Splitter Ratio: 0.5
+    Tree Height: 557
+  - Class: rviz/Help
+    Name: Help
+  - Class: rviz/Views
+    Expanded:
+      - /Current View1
+    Name: Views
+    Splitter Ratio: 0.5
+Preferences:
+  PromptSaveOnExit: true
+Toolbars:
+  toolButtonStyle: 2
+Visualization Manager:
+  Class: ""
+  Displays:
+    - Alpha: 0.5
+      Cell Size: 1
+      Class: rviz/Grid
+      Color: 160; 160; 164
+      Enabled: true
+      Line Style:
+        Line Width: 0.029999999329447746
+        Value: Lines
+      Name: Grid
+      Normal Cell Count: 0
+      Offset:
+        X: 0
+        Y: 0
+        Z: 0
+      Plane: XY
+      Plane Cell Count: 10
+      Reference Frame: <Fixed Frame>
+      Value: true
+    - Acceleration_Scaling_Factor: 0.1
+      Class: moveit_rviz_plugin/MotionPlanning
+      Enabled: true
+      JointsTab_Use_Radians: false
+      Move Group Namespace: ""
+      MoveIt_Allow_Approximate_IK: false
+      MoveIt_Allow_External_Program: false
+      MoveIt_Allow_Replanning: false
+      MoveIt_Allow_Sensor_Positioning: false
+      MoveIt_Planning_Attempts: 10
+      MoveIt_Planning_Time: 5
+      MoveIt_Use_Cartesian_Path: false
+      MoveIt_Use_Constraint_Aware_IK: false
+      MoveIt_Workspace:
+        Center:
+          X: 0
+          Y: 0
+          Z: 0
+        Size:
+          X: 2
+          Y: 2
+          Z: 2
+      Name: MotionPlanning
+      Planned Path:
+        Color Enabled: false
+        Interrupt Display: false
+        Links:
+          All Links Enabled: true
+          Expand Joint Details: false
+          Expand Link Details: false
+          Expand Tree: false
+          Link Tree Style: Links in Alphabetic Order
+          Link1:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link2:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link3:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link4:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link5:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link6:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          base_link:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          link_end:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+          link_flp:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+        Loop Animation: true
+        Robot Alpha: 0.5
+        Robot Color: 150; 50; 150
+        Show Robot Collision: false
+        Show Robot Visual: false
+        Show Trail: false
+        State Display Time: 0.05 s
+        Trail Step Size: 1
+        Trajectory Topic: move_group/display_planned_path
+        Use Sim Time: false
+      Planning Metrics:
+        Payload: 1
+        Show Joint Torques: false
+        Show Manipulability: false
+        Show Manipulability Index: false
+        Show Weight Limit: false
+        TextHeight: 0.07999999821186066
+      Planning Request:
+        Colliding Link Color: 255; 0; 0
+        Goal State Alpha: 1
+        Goal State Color: 250; 128; 0
+        Interactive Marker Size: 0
+        Joint Violation Color: 255; 0; 255
+        Planning Group: manipulator
+        Query Goal State: false
+        Query Start State: false
+        Show Workspace: false
+        Start State Alpha: 1
+        Start State Color: 0; 255; 0
+      Planning Scene Topic: move_group/monitored_planning_scene
+      Robot Description: robot_description
+      Scene Geometry:
+        Scene Alpha: 1
+        Scene Color: 50; 230; 50
+        Scene Display Time: 0.009999999776482582
+        Show Scene Geometry: true
+        Voxel Coloring: Z-Axis
+        Voxel Rendering: Occupied Voxels
+      Scene Robot:
+        Attached Body Color: 150; 50; 150
+        Links:
+          All Links Enabled: true
+          Expand Joint Details: false
+          Expand Link Details: false
+          Expand Tree: false
+          Link Tree Style: Links in Alphabetic Order
+          Link1:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link2:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link3:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link4:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link5:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          Link6:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          base_link:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+          link_end:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+          link_flp:
+            Alpha: 1
+            Show Axes: false
+            Show Trail: false
+            Value: true
+        Robot Alpha: 0.5
+        Show Robot Collision: false
+        Show Robot Visual: false
+      Value: true
+      Velocity_Scaling_Factor: 0.1
+    - Alpha: 1
+      Class: rviz/RobotModel
+      Collision Enabled: false
+      Enabled: true
+      Links:
+        All Links Enabled: true
+        Expand Joint Details: false
+        Expand Link Details: false
+        Expand Tree: false
+        Link Tree Style: Links in Alphabetic Order
+        Link1:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        Link2:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        Link3:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        Link4:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        Link5:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        Link6:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        base_link:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+        link_end:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+        link_flp:
+          Alpha: 1
+          Show Axes: false
+          Show Trail: false
+          Value: true
+      Name: RobotModel
+      Robot Description: robot_description
+      TF Prefix: ""
+      Update Interval: 0
+      Value: true
+      Visual Enabled: true
+    - Alpha: 1
+      Autocompute Intensity Bounds: true
+      Autocompute Value Bounds:
+        Max Value: 10
+        Min Value: -10
+        Value: true
+      Axis: Z
+      Channel Name: intensity
+      Class: rviz/PointCloud2
+      Color: 255; 255; 255
+      Color Transformer: ""
+      Decay Time: 0
+      Enabled: true
+      Invert Rainbow: false
+      Max Color: 255; 255; 255
+      Min Color: 0; 0; 0
+      Name: PointCloud2
+      Position Transformer: ""
+      Queue Size: 10
+      Selectable: true
+      Size (Pixels): 3
+      Size (m): 0.0020000000949949026
+      Style: Flat Squares
+      Topic: ""
+      Unreliable: false
+      Use Fixed Frame: true
+      Use rainbow: true
+      Value: true
+  Enabled: true
+  Global Options:
+    Background Color: 48; 48; 48
+    Default Light: true
+    Fixed Frame: base_link
+    Frame Rate: 30
+  Name: root
+  Tools:
+    - Class: rviz/Interact
+      Hide Inactive Objects: true
+    - Class: rviz/MoveCamera
+    - Class: rviz/Select
+  Value: true
+  Views:
+    Current:
+      Class: rviz/Orbit
+      Distance: 4.112061977386475
+      Enable Stereo Rendering:
+        Stereo Eye Separation: 0.05999999865889549
+        Stereo Focal Distance: 1
+        Swap Stereo Eyes: false
+        Value: false
+      Field of View: 0.75
+      Focal Point:
+        X: 0.7538955211639404
+        Y: 0.3512139916419983
+        Z: 0.6472357511520386
+      Focal Shape Fixed Size: true
+      Focal Shape Size: 0.05000000074505806
+      Invert Z Axis: false
+      Name: Current View
+      Near Clip Distance: 0.009999999776482582
+      Pitch: 0.5000001788139343
+      Target Frame: base_link
+      Yaw: 4.689955711364746
+    Saved: ~
+Window Geometry:
+  Displays:
+    collapsed: true
+  Height: 792
+  Help:
+    collapsed: false
+  Hide Left Dock: true
+  Hide Right Dock: false
+  MotionPlanning:
+    collapsed: false
+  MotionPlanning - Trajectory Slider:
+    collapsed: false
+  QMainWindow State: 000000ff00000000fd0000000100000000000001f3000002befc0200000007fb000000100044006900730070006c006100790073000000003d000002be000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a00560069006500770073000000010c000000a4000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000001600000016fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e0067000000015b000001a00000017d00ffffff000004d0000002be00000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+  Views:
+    collapsed: false
+  Width: 1232
+  X: 485
+  Y: 119

+ 15 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/moveit_rviz.launch

@@ -0,0 +1,15 @@
+<launch>
+
+  <arg name="debug" default="false" />
+  <arg unless="$(arg debug)" name="launch_prefix" value="" />
+  <arg     if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args" />
+
+  <arg name="rviz_config" default="" />
+  <arg     if="$(eval rviz_config=='')" name="command_args" value="" />
+  <arg unless="$(eval rviz_config=='')" name="command_args" value="-d $(arg rviz_config)" />
+
+  <node name="$(anon rviz)" launch-prefix="$(arg launch_prefix)" pkg="rviz" type="rviz" respawn="false"
+        args="$(arg command_args)" output="screen">
+  </node>
+
+</launch>

+ 3 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/mr12urdf20240605_moveit_sensor_manager.launch.xml

@@ -0,0 +1,3 @@
+<launch>
+
+</launch>

+ 20 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/ompl-chomp_planning_pipeline.launch.xml

@@ -0,0 +1,20 @@
+<launch>
+  <!-- load OMPL planning pipeline, but add the CHOMP planning adapter. -->
+  <include file="$(find lstrobot_moveit_config_0605)/launch/ompl_planning_pipeline.launch.xml">
+    <arg name="planning_adapters"
+         default="default_planner_request_adapters/LimitMaxCartesianLinkSpeed
+                  default_planner_request_adapters/AddTimeParameterization
+                  default_planner_request_adapters/FixWorkspaceBounds
+                  default_planner_request_adapters/FixStartStateBounds
+                  default_planner_request_adapters/FixStartStateCollision
+                  default_planner_request_adapters/FixStartStatePathConstraints
+                  chomp/OptimizerAdapter"
+                  />
+  </include>
+
+  <!-- load chomp config -->
+  <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/chomp_planning.yaml" />
+
+  <!-- override trajectory_initialization_method: Use OMPL-generated trajectory -->
+  <param name="trajectory_initialization_method" value="fillTrajectory"/>
+</launch>

+ 24 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/ompl_planning_pipeline.launch.xml

@@ -0,0 +1,24 @@
+<launch>
+
+  <!-- The request adapters (plugins) used when planning with OMPL. ORDER MATTERS! -->
+  <arg name="planning_adapters"
+       default="default_planner_request_adapters/LimitMaxCartesianLinkSpeed
+                default_planner_request_adapters/AddTimeParameterization
+                default_planner_request_adapters/ResolveConstraintFrames
+                default_planner_request_adapters/FixWorkspaceBounds
+                default_planner_request_adapters/FixStartStateBounds
+                default_planner_request_adapters/FixStartStateCollision
+                default_planner_request_adapters/FixStartStatePathConstraints"
+                />
+
+  <arg name="start_state_max_bounds_error" default="0.1" />
+  <arg name="jiggle_fraction" default="0.05" />
+
+  <param name="planning_plugin" value="ompl_interface/OMPLPlanner" />
+  <param name="request_adapters" value="$(arg planning_adapters)" />
+  <param name="start_state_max_bounds_error" value="$(arg start_state_max_bounds_error)" />
+  <param name="jiggle_fraction" value="$(arg jiggle_fraction)" />
+
+  <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/ompl_planning.yaml"/>
+
+</launch>

+ 15 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/pilz_industrial_motion_planner_planning_pipeline.launch.xml

@@ -0,0 +1,15 @@
+<launch>
+
+  <!-- The request adapters (plugins) used when planning. ORDER MATTERS! -->
+  <arg name="planning_adapters" default="" />
+
+  <param name="planning_plugin" value="pilz_industrial_motion_planner::CommandPlanner" />
+  <param name="request_adapters" value="$(arg planning_adapters)" />
+
+  <!-- Define default planner (for all groups) -->
+  <param name="default_planner_config" value="PTP" />
+
+  <!-- MoveGroup capabilities to load for this pipeline, append sequence capability -->
+  <param name="capabilities" value="pilz_industrial_motion_planner/MoveGroupSequenceAction
+                                    pilz_industrial_motion_planner/MoveGroupSequenceService" />
+</launch>

+ 26 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/planning_context.launch

@@ -0,0 +1,26 @@
+<launch>
+  <!-- By default we do not overwrite the URDF. Change the following to true to change the default behavior -->
+  <arg name="load_robot_description" default="false"/>
+
+  <!-- The name of the parameter under which the URDF is loaded -->
+  <arg name="robot_description" default="robot_description"/>
+
+  <!-- Load universal robot description format (URDF) -->
+  <param if="$(arg load_robot_description)" name="$(arg robot_description)" textfile="$(find mr12urdf20240605)/urdf/mr12urdf20240605.urdf"/>
+
+  <!-- The semantic description that corresponds to the URDF -->
+  <param name="$(arg robot_description)_semantic" textfile="$(find lstrobot_moveit_config_0605)/config/mr12urdf20240605.srdf" />
+
+  <!-- Load updated joint limits (override information from URDF) -->
+  <group ns="$(arg robot_description)_planning">
+    <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/joint_limits.yaml"/>
+    <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/cartesian_limits.yaml"/>
+  </group>
+
+  <!-- Load default settings for kinematics; these settings are overridden by settings in a node's namespace -->
+  <group ns="$(arg robot_description)_kinematics">
+    <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/kinematics.yaml"/>
+
+  </group>
+
+</launch>

+ 10 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/planning_pipeline.launch.xml

@@ -0,0 +1,10 @@
+<launch>
+
+  <!-- This file makes it easy to include different planning pipelines;
+       It is assumed that all planning pipelines are named XXX_planning_pipeline.launch  -->
+
+  <arg name="pipeline" default="ompl" />
+
+  <include ns="$(arg pipeline)" file="$(dirname)/$(arg pipeline)_planning_pipeline.launch.xml" />
+
+</launch>

+ 4 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/ros_control_moveit_controller_manager.launch.xml

@@ -0,0 +1,4 @@
+<launch>
+	<!-- Define MoveIt controller manager plugin -->
+	<param name="moveit_controller_manager" value="moveit_ros_control_interface::MoveItControllerManager" />
+</launch>

+ 11 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/ros_controllers.launch

@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<launch>
+
+  <!-- Load joint controller configurations from YAML file to parameter server -->
+  <rosparam file="$(find lstrobot_moveit_config_0605)/config/ros_controllers.yaml" command="load"/>
+
+  <!-- Load the controllers -->
+  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
+    output="screen" args=""/>
+
+</launch>

+ 21 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/run_benchmark_ompl.launch

@@ -0,0 +1,21 @@
+<launch>
+
+  <!-- This argument must specify the list of .cfg files to process for benchmarking -->
+  <arg name="cfg" />
+
+  <!-- Load URDF -->
+  <include file="$(dirname)/planning_context.launch">
+    <arg name="load_robot_description" value="true"/>
+  </include>
+
+  <!-- Start the database -->
+  <include file="$(dirname)/warehouse.launch">
+    <arg name="moveit_warehouse_database_path" value="moveit_ompl_benchmark_warehouse"/>
+  </include>
+
+  <!-- Start Benchmark Executable -->
+  <node name="$(anon moveit_benchmark)" pkg="moveit_ros_benchmarks" type="moveit_run_benchmark" args="$(arg cfg) --benchmark-planners" respawn="false" output="screen">
+    <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/ompl_planning.yaml"/>
+  </node>
+
+</launch>

+ 21 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/sensor_manager.launch.xml

@@ -0,0 +1,21 @@
+<launch>
+
+  <!-- This file makes it easy to include the settings for sensor managers -->
+
+  <!-- Params for 3D sensors config -->
+  <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/sensors_3d.yaml" />
+  <!-- <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/sensors_3d2.yaml" /> -->
+  <!-- Params for the octomap monitor -->
+  <!--  <param name="octomap_frame" type="string" value="some frame in which the robot moves" /> -->
+  <param name="octomap_resolution" type="double" value="0.004" />
+  <param name="max_range" type="double" value="5.0" /> 
+
+  
+  
+  <!-- Load the robot specific sensor manager; this sets the moveit_sensor_manager ROS parameter -->
+  <arg name="moveit_sensor_manager" default="mr12urdf20240605" />
+  <include file="$(dirname)/$(arg moveit_sensor_manager)_moveit_sensor_manager.launch.xml" />
+
+
+
+</launch>

+ 16 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/setup_assistant.launch

@@ -0,0 +1,16 @@
+<!-- Re-launch the MoveIt Setup Assistant with this configuration package already loaded -->
+<launch>
+
+  <!-- Debug Info -->
+  <arg name="debug" default="false" />
+  <arg unless="$(arg debug)" name="launch_prefix" value="" />
+  <arg     if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args" />
+
+  <!-- Run -->
+  <node pkg="moveit_setup_assistant" type="moveit_setup_assistant" name="moveit_setup_assistant"
+        args="--config_pkg=lstrobot_moveit_config_0605"
+        launch-prefix="$(arg launch_prefix)"
+        required="true"
+        output="screen" />
+
+</launch>

+ 8 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/simple_moveit_controller_manager.launch.xml

@@ -0,0 +1,8 @@
+<launch>
+  <!-- Define the MoveIt controller manager plugin to use for trajectory execution -->
+  <param name="moveit_controller_manager" value="moveit_simple_controller_manager/MoveItSimpleControllerManager" />
+
+  <!-- Load controller list to the parameter server -->
+  <rosparam file="$(find lstrobot_moveit_config_0605)/config/simple_moveit_controllers.yaml" />
+  <rosparam file="$(find lstrobot_moveit_config_0605)/config/ros_controllers.yaml" />
+</launch>

+ 23 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/stomp_planning_pipeline.launch.xml

@@ -0,0 +1,23 @@
+<launch>
+  <!-- Stomp Plugin for MoveIt -->
+  <arg name="planning_plugin" value="stomp_moveit/StompPlannerManager" />
+
+  <arg name="start_state_max_bounds_error" value="0.1" />
+  <arg name="jiggle_fraction" value="0.05" />
+  <!-- The request adapters (plugins) used when planning. ORDER MATTERS! -->
+  <arg name="planning_adapters"
+       default="default_planner_request_adapters/LimitMaxCartesianLinkSpeed
+                default_planner_request_adapters/AddTimeParameterization
+                default_planner_request_adapters/FixWorkspaceBounds
+                default_planner_request_adapters/FixStartStateBounds
+                default_planner_request_adapters/FixStartStateCollision
+                default_planner_request_adapters/FixStartStatePathConstraints" />
+
+
+  <param name="planning_plugin" value="$(arg planning_plugin)" />
+  <param name="request_adapters" value="$(arg planning_adapters)" />
+  <param name="start_state_max_bounds_error" value="$(arg start_state_max_bounds_error)" />
+  <param name="jiggle_fraction" value="$(arg jiggle_fraction)" />
+
+  <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/stomp_planning.yaml"/>
+</launch>

+ 23 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/trajectory_execution.launch.xml

@@ -0,0 +1,23 @@
+<launch>
+  <!-- This file summarizes all settings required for trajectory execution  -->
+
+  <!-- Define moveit controller manager plugin: fake, simple, or ros_control -->
+  <arg name="moveit_controller_manager" />
+  <arg name="fake_execution_type" default="interpolate" />
+
+  <!-- Flag indicating whether MoveIt is allowed to load/unload  or switch controllers -->
+  <arg name="moveit_manage_controllers" default="true"/>
+  <param name="moveit_manage_controllers" value="$(arg moveit_manage_controllers)"/>
+
+  <!-- When determining the expected duration of a trajectory, this multiplicative factor is applied to get the allowed duration of execution -->
+  <param name="trajectory_execution/allowed_execution_duration_scaling" value="1.2"/> <!-- default 1.2 -->
+  <!-- Allow more than the expected execution time before triggering a trajectory cancel (applied after scaling) -->
+  <param name="trajectory_execution/allowed_goal_duration_margin" value="0.5"/> <!-- default 0.5 -->
+  <!-- Allowed joint-value tolerance for validation that trajectory's first point matches current robot state -->
+  <param name="trajectory_execution/allowed_start_tolerance" value="0.01"/> <!-- default 0.01 -->
+
+  <!-- We use pass_all_args=true here to pass fake_execution_type, which is required by fake controllers, but not by real-robot controllers.
+       As real-robot controller_manager.launch files shouldn't be required to define this argument, we use the trick of passing all args. -->
+  <include file="$(dirname)/$(arg moveit_controller_manager)_moveit_controller_manager.launch.xml" pass_all_args="true" />
+
+</launch>

+ 15 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/warehouse.launch

@@ -0,0 +1,15 @@
+<launch>
+
+  <!-- The path to the database must be specified -->
+  <arg name="moveit_warehouse_database_path" />
+
+  <!-- Load warehouse parameters -->
+  <include file="$(dirname)/warehouse_settings.launch.xml" />
+
+  <!-- Run the DB server -->
+  <node name="$(anon mongo_wrapper_ros)" cwd="ROS_HOME" type="mongo_wrapper_ros.py" pkg="warehouse_ros_mongo">
+    <param name="overwrite" value="false"/>
+    <param name="database_path" value="$(arg moveit_warehouse_database_path)" />
+  </node>
+
+</launch>

+ 16 - 0
catkin_ws/src/lstrobot_moveit_config_0605/launch/warehouse_settings.launch.xml

@@ -0,0 +1,16 @@
+<launch>
+  <!-- Set the parameters for the warehouse and run the mongodb server. -->
+
+  <!-- The default DB port for moveit (not default MongoDB port to avoid potential conflicts) -->
+  <arg name="moveit_warehouse_port" default="33829" />
+
+  <!-- The default DB host for moveit -->
+  <arg name="moveit_warehouse_host" default="localhost" />
+
+  <!-- Set parameters for the warehouse -->
+  <param name="warehouse_port" value="$(arg moveit_warehouse_port)"/>
+  <param name="warehouse_host" value="$(arg moveit_warehouse_host)"/>
+  <param name="warehouse_exec" value="mongod" />
+  <param name="warehouse_plugin" value="warehouse_ros_mongo::MongoDatabaseConnection" />
+
+</launch>

+ 41 - 0
catkin_ws/src/lstrobot_moveit_config_0605/package.xml

@@ -0,0 +1,41 @@
+<package>
+
+  <name>lstrobot_moveit_config_0605</name>
+  <version>0.3.0</version>
+  <description>
+     An automatically generated package with all the configuration and launch files for using the mr12urdf20240605 with the MoveIt Motion Planning Framework
+  </description>
+  <author email="123@qq.com">123</author>
+  <maintainer email="123@qq.com">123</maintainer>
+
+  <license>BSD</license>
+
+  <url type="website">http://moveit.ros.org/</url>
+  <url type="bugtracker">https://github.com/ros-planning/moveit/issues</url>
+  <url type="repository">https://github.com/ros-planning/moveit</url>
+
+  <buildtool_depend>catkin</buildtool_depend>
+
+  <run_depend>moveit_ros_move_group</run_depend>
+  <run_depend>moveit_fake_controller_manager</run_depend>
+  <run_depend>moveit_kinematics</run_depend>
+  <run_depend>moveit_planners</run_depend>
+  <run_depend>moveit_ros_visualization</run_depend>
+  <run_depend>moveit_setup_assistant</run_depend>
+  <run_depend>moveit_simple_controller_manager</run_depend>
+  <run_depend>joint_state_publisher</run_depend>
+  <run_depend>joint_state_publisher_gui</run_depend>
+  <run_depend>robot_state_publisher</run_depend>
+  <run_depend>rviz</run_depend>
+  <run_depend>tf2_ros</run_depend>
+  <run_depend>xacro</run_depend>
+  <!-- The next 2 packages are required for the gazebo simulation.
+       We don't include them by default to prevent installing gazebo and all its dependencies. -->
+  <!-- <run_depend>joint_trajectory_controller</run_depend> -->
+  <!-- <run_depend>gazebo_ros_control</run_depend> -->
+  <!-- This package is referenced in the warehouse launch files, but does not build out of the box at the moment. Commented the dependency until this works. -->
+  <!-- <run_depend>warehouse_ros_mongo</run_depend> -->
+  <run_depend>mr12urdf20240605</run_depend>
+
+
+</package>

+ 224 - 0
catkin_ws/src/lstrobot_planning/CMakeLists.txt

@@ -0,0 +1,224 @@
+cmake_minimum_required(VERSION 3.0.2)
+project(lstrobot_planning)
+
+## Compile as C++11, supported in ROS Kinetic and newer
+# add_compile_options(-std=c++11)
+
+## Find catkin macros and libraries
+## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
+## is used, also find other catkin packages
+find_package(catkin REQUIRED COMPONENTS
+  roscpp
+  rospy
+  std_msgs
+  message_generation
+)
+
+## System dependencies are found with CMake's conventions
+# find_package(Boost REQUIRED COMPONENTS system)
+
+
+## Uncomment this if the package has a setup.py. This macro ensures
+## modules and global scripts declared therein get installed
+## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
+# catkin_python_setup()
+
+################################################
+## Declare ROS messages, services and actions ##
+################################################
+
+## To declare and build messages, services or actions from within this
+## package, follow these steps:
+## * Let MSG_DEP_SET be the set of packages whose message types you use in
+##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
+## * In the file package.xml:
+##   * add a build_depend tag for "message_generation"
+##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
+##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in
+##     but can be declared for certainty nonetheless:
+##     * add a exec_depend tag for "message_runtime"
+## * In this file (CMakeLists.txt):
+##   * add "message_generation" and every package in MSG_DEP_SET to
+##     find_package(catkin REQUIRED COMPONENTS ...)
+##   * add "message_runtime" and every package in MSG_DEP_SET to
+##     catkin_package(CATKIN_DEPENDS ...)
+##   * uncomment the add_*_files sections below as needed
+##     and list every .msg/.srv/.action file to be processed
+##   * uncomment the generate_messages entry below
+##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
+
+## Generate messages in the 'msg' folder
+add_message_files(
+   FILES
+   JointTrajectoryPoint_ex.msg
+   JointTrajectory_ex.msg
+   
+ )
+
+## Generate services in the 'srv' folder
+# add_service_files(
+#   FILES
+#   Service1.srv
+#   Service2.srv
+# )
+
+## Generate actions in the 'action' folder
+# add_action_files(
+#   FILES
+#   Action1.action
+#   Action2.action
+# )
+
+## Generate added messages and services with any dependencies listed here
+ generate_messages(
+   DEPENDENCIES
+   std_msgs
+ )
+
+################################################
+## Declare ROS dynamic reconfigure parameters ##
+################################################
+
+## To declare and build dynamic reconfigure parameters within this
+## package, follow these steps:
+## * In the file package.xml:
+##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
+## * In this file (CMakeLists.txt):
+##   * add "dynamic_reconfigure" to
+##     find_package(catkin REQUIRED COMPONENTS ...)
+##   * uncomment the "generate_dynamic_reconfigure_options" section below
+##     and list every .cfg file to be processed
+
+## Generate dynamic reconfigure parameters in the 'cfg' folder
+# generate_dynamic_reconfigure_options(
+#   cfg/DynReconf1.cfg
+#   cfg/DynReconf2.cfg
+# )
+
+###################################
+## catkin specific configuration ##
+###################################
+## The catkin_package macro generates cmake config files for your package
+## Declare things to be passed to dependent projects
+## INCLUDE_DIRS: uncomment this if your package contains header files
+## LIBRARIES: libraries you create in this project that dependent projects also need
+## CATKIN_DEPENDS: catkin_packages dependent projects also need
+## DEPENDS: system dependencies of this project that dependent projects also need
+catkin_package(
+#  INCLUDE_DIRS include
+#  LIBRARIES lstrobot_planning
+CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
+#  DEPENDS system_lib
+
+)
+
+###########
+## Build ##
+###########
+
+## Specify additional locations of header files
+## Your package locations should be listed before other locations
+include_directories(
+include_directories(include ${catkin_INCLUDE_DIRS} )
+
+# include
+  ${catkin_INCLUDE_DIRS}
+)
+
+## Declare a C++ library
+# add_library(${PROJECT_NAME}
+#   src/${PROJECT_NAME}/lstrobot_planning.cpp
+# )
+
+## Add cmake target dependencies of the library
+## as an example, code may need to be generated before libraries
+## either from message generation or dynamic reconfigure
+# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Declare a C++ executable
+## With catkin_make all packages are built within a single CMake context
+## The recommended prefix ensures that target names across packages don't collide
+# add_executable(${PROJECT_NAME}_node src/lstrobot_planning_node.cpp)
+
+## Rename C++ executable without prefix
+## The above recommended prefix causes long target names, the following renames the
+## target back to the shorter version for ease of user use
+## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
+# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
+
+## Add cmake target dependencies of the executable
+## same as for the library above
+# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Specify libraries to link a library or executable target against
+# target_link_libraries(${PROJECT_NAME}_node
+#   ${catkin_LIBRARIES}
+# )
+
+#############
+## Install ##
+#############
+
+# all install targets should use catkin DESTINATION variables
+# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
+
+## Mark executable scripts (Python etc.) for installation
+## in contrast to setup.py, you can choose the destination
+ catkin_install_python(PROGRAMS
+   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+ )
+
+## Mark executables for installation
+## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
+# install(TARGETS lstrobot_planning_node
+#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
+
+## Mark libraries for installation
+## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
+# install(TARGETS set_update
+#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
+# )
+
+## Mark cpp header files for installation
+# install(DIRECTORY include/${PROJECT_NAME}/
+#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
+#   FILES_MATCHING PATTERN "*.h"
+#   PATTERN ".svn" EXCLUDE
+# )
+
+## Mark other files for installation (e.g. launch and bag files, etc.)
+# install(FILES
+#   # myfile1
+#   # myfile2
+#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+# )
+install(DIRECTORY launch 
+    DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+  )
+
+#############
+## Testing ##
+#############
+
+## Add gtest based cpp test target and link libraries
+# catkin_add_gtest(${PROJECT_NAME}-test test/test_lstrobot_planning.cpp)
+# if(TARGET ${PROJECT_NAME}-test)
+#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
+# endif()
+
+## Add folders to be run by python nosetests
+# catkin_add_nosetests(test)
+
+# add_executable(set_update scripts/set_update_paramter_p.py)
+#set_target_properties(moveit_cartesian_demo PROPERTIES LINKER_LANGUAGE PYTHON)
+
+#add_executable(add_objects src/add_objects.cpp)
+#add_dependencies(add_objects ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+#target_link_libraries(add_obje
+#	${catkin_LIBRARIES}
+#	${OpenCV_LIBRARIES}
+#	${PCL_LIBRARIES}
+#)

+ 5 - 0
catkin_ws/src/lstrobot_planning/launch/moveit_control_server.launch

@@ -0,0 +1,5 @@
+<launch>
+	<node name="moveit_control_server" pkg="lstrobot_planning" type="moveitServer2.py" output="screen">
+   
+	</node>
+</launch>

+ 7 - 0
catkin_ws/src/lstrobot_planning/launch/publish_pointcloud.launch

@@ -0,0 +1,7 @@
+<launch>
+  <!-- 启动publish_pointcloud节点 -->
+  <node pkg="lstrobot_planning" name="publish_pointcloud" type="dycl.py" required="true" output="screen">
+  </node>
+
+</launch>
+

+ 5 - 0
catkin_ws/src/lstrobot_planning/launch/set_update_paramter_p.launch

@@ -0,0 +1,5 @@
+<launch>
+  <node pkg="lstrobot_planning" name="set_update_paramter_p" type="set_update_paramter_p.py" required="true" output="screen">
+  </node>
+
+</launch>

+ 20 - 0
catkin_ws/src/lstrobot_planning/launch/start_ur5.launch

@@ -0,0 +1,20 @@
+<launch>
+  <arg name="limited" default="false" />
+  <arg name="config" default="true"/>
+
+  <!-- Launch ur5_bringup -->
+  <include file="$(find ur_modern_driver)/launch/ur5_bringup.launch">
+  </include>
+
+
+  <!-- Launch moveit -->
+  <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch">
+    <arg name="limited" default="$(arg limited)"/>
+  </include>
+
+  <!--start rviz  -->
+  <include file="$(find ur5_moveit_config)/launch/moveit_rviz.launch">
+    <arg name="config" default="$(arg config)"/>
+  </include>
+
+</launch>

+ 5 - 0
catkin_ws/src/lstrobot_planning/launch/test.launch

@@ -0,0 +1,5 @@
+<launch>
+  <node pkg="lstrobot_planning" name="test" type="11.py" required="true" output="screen">
+  </node>
+
+</launch>

+ 30 - 0
catkin_ws/src/lstrobot_planning/launch/ur5_bringup.launch

@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Universal robot ur5 launch.  Loads ur5 robot description (see ur_common.launch
+  for more info)
+
+  Usage:
+    ur5_bringup.launch robot_ip:=<value>
+-->
+<launch>
+  
+  <!-- robot_ip: IP-address of the robot's socket-messaging server -->
+  <arg name="robot_ip" default="192.168.50.100"/>
+  <arg name="limited" default="false"/>
+  <arg name="min_payload"  default="0.0"/>
+  <arg name="max_payload"  default="5.0"/>
+  <arg name="prefix" default="" />
+  <!-- robot model -->
+  <include file="$(find ur_description)/launch/ur5_upload.launch">
+    <arg name="limited" value="$(arg limited)"/>
+  </include>
+  
+  <!-- ur common -->
+  <include file="$(find ur_modern_driver)/launch/ur_common.launch">
+    <arg name="prefix"  value="$(arg prefix)" />
+    <arg name="robot_ip" value="$(arg robot_ip)"/>
+    <arg name="min_payload"  value="$(arg min_payload)"/>
+    <arg name="max_payload"  value="$(arg max_payload)"/>
+  </include>
+
+</launch>

+ 7 - 0
catkin_ws/src/lstrobot_planning/msg/JointTrajectoryPoint_ex.msg

@@ -0,0 +1,7 @@
+float64[] positions
+float64[] velocities
+float64[] accelerations
+float64[] effort
+duration time_from_start
+string type
+float64[] sequence

+ 3 - 0
catkin_ws/src/lstrobot_planning/msg/JointTrajectory_ex.msg

@@ -0,0 +1,3 @@
+Header header
+string[] joint_names
+JointTrajectoryPoint_ex[] points

+ 70 - 0
catkin_ws/src/lstrobot_planning/package.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<package format="2">
+  <name>lstrobot_planning</name>
+  <version>0.0.0</version>
+  <description>The lstrobot_planning package</description>
+
+  <!-- One maintainer tag required, multiple allowed, one person per tag -->
+  <!-- Example:  -->
+  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
+  <maintainer email="chen@todo.todo">chen</maintainer>
+
+
+  <!-- One license tag required, multiple allowed, one license per tag -->
+  <!-- Commonly used license strings: -->
+  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
+  <license>TODO</license>
+
+
+  <!-- Url tags are optional, but multiple are allowed, one per tag -->
+  <!-- Optional attribute type can be: website, bugtracker, or repository -->
+  <!-- Example: -->
+  <!-- <url type="website">http://wiki.ros.org/lstrobot_planning</url> -->
+
+
+  <!-- Author tags are optional, multiple are allowed, one per tag -->
+  <!-- Authors do not have to be maintainers, but could be -->
+  <!-- Example: -->
+  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->
+
+
+  <!-- The *depend tags are used to specify dependencies -->
+  <!-- Dependencies can be catkin packages or system dependencies -->
+  <!-- Examples: -->
+  <!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
+  <!--   <depend>roscpp</depend> -->
+  <!--   Note that this is equivalent to the following: -->
+  <!--   <build_depend>roscpp</build_depend> -->
+  <!--   <exec_depend>roscpp</exec_depend> -->
+  <!-- Use build_depend for packages you need at compile time: -->
+  <!--   <build_depend>message_generation</build_depend> -->
+  <!-- Use build_export_depend for packages you need in order to build against this package: -->
+  <!--   <build_export_depend>message_generation</build_export_depend> -->
+  <!-- Use buildtool_depend for build tool packages: -->
+  <!--   <buildtool_depend>catkin</buildtool_depend> -->
+  <!-- Use exec_depend for packages you need at runtime: -->
+  <!--   <exec_depend>message_runtime</exec_depend> -->
+  <!-- Use test_depend for packages you need only for testing: -->
+  <!--   <test_depend>gtest</test_depend> -->
+  <!-- Use doc_depend for packages you need only for building documentation: -->
+  <!--   <doc_depend>doxygen</doc_depend> -->
+  <buildtool_depend>catkin</buildtool_depend>
+  <build_depend>roscpp</build_depend>
+  <build_depend>rospy</build_depend>
+  <build_depend>std_msgs</build_depend>
+  <build_export_depend>roscpp</build_export_depend>
+  <build_export_depend>rospy</build_export_depend>
+  <build_export_depend>std_msgs</build_export_depend>
+  <exec_depend>roscpp</exec_depend>
+  <exec_depend>rospy</exec_depend>
+  <exec_depend>std_msgs</exec_depend>
+  
+ <build_depend>message_generation</build_depend>
+ <exec_depend>message_runtime</exec_depend>
+
+  <!-- The export tag contains other, unspecified, tags -->
+  <export>
+    <!-- Other tools can request additional information be placed here -->
+
+  </export>
+</package>

+ 23 - 0
catkin_ws/src/lstrobot_planning/scripts/11.py

@@ -0,0 +1,23 @@
+#! /usr/bin/env python3
+import rospy
+import os
+from std_srvs.srv import Empty
+from subprocess import Popen
+
+def Start_up_test():
+    # 设置各种类型参数
+    
+    # rospy.set_param("folder_path","/home/chen/catkin_ws/data/20240703-11-法兰盘")
+    rospy.set_param("folder_path","/home/robot/ROS/catkin_ws/data/20240710-2")
+    # rospy.set_param("culling_radius",10)
+    rospy.set_param("sign_control",1)
+    # rospy.set_param("sign_control",2)
+if __name__ == '__main__':
+    
+    rospy.init_node("test")
+    
+   
+    Start_up_test()
+
+
+     

+ 70 - 0
catkin_ws/src/lstrobot_planning/scripts/CloudFunc.py

@@ -0,0 +1,70 @@
+import numpy as np
+import open3d as o3d
+
+
+# 读取文件
+def open_file(file_path):
+    """
+    读取文件
+    :param file_path: 文件路径
+    :return: 读取的内容
+    """
+
+    if '.txt' in file_path:
+        print('txt文档')
+        pcd = o3d.io.read_point_cloud(file_path, format='xyz')
+    else:
+        pcd = o3d.io.read_point_cloud(file_path)
+    return pcd
+
+
+def save_file(content, file_path, write_ascii=True):
+    """
+    保存文件
+    :param write_ascii: 是否使用ASCII编码
+    :param content: 文件内容
+    :param file_path: 保存路径
+    :return: None
+    """
+    if '.txt' in file_path:
+        np.savetxt(file_path, np.asarray(content.points), fmt='%f %f %f')
+    else:
+        o3d.io.write_point_cloud(file_path, content, write_ascii=write_ascii)
+
+
+def voxel_down_sample(pcd, voxel_size):
+    """
+    体素方法点云降采样
+    :param pcd: 点云数据
+    :param voxel_size: 体素降采样的网格长度
+    :return: 降采样点云数据
+    """
+    return pcd.voxel_down_sample(voxel_size=voxel_size)
+
+
+def add_rgb_to_pcd(pcd):
+    """
+    给点云天啊及颜色信息
+    :param pcd: 点云数据
+    :return:
+    """
+    # 为点云中的每个点指定RGB颜色,这里我们使用红色作为示例
+    # RGB值范围为[0, 1],红色可以表示为(1, 0, 0)
+    pcd = np.asarray(pcd.points).shape[0]
+    colors = np.repeat([[1, 0, 0]], pcd, axis=0)  # 创建一个全是红色的颜色数组
+    # 将颜色信息添加到点云对象中
+    pcd.colors = o3d.utility.Vector3dVector(colors)
+    return pcd
+
+
+def pcd_visualization(pcd):
+    """
+    可视化点云数据
+    :param pcd: 点云数据
+    :return: None
+    """
+    o3d.visualization.draw_geometries([pcd],
+                                      zoom=0.3412,
+                                      front=[0.4257, -0.2125, -0.8795],
+                                      lookat=[2.6172, 2.0475, 1.532],
+                                      up=[-0.0694, -0.9768, 0.2024])

二進制
catkin_ws/src/lstrobot_planning/scripts/__pycache__/check.cpython-38.pyc


二進制
catkin_ws/src/lstrobot_planning/scripts/__pycache__/command.cpython-38.pyc


二進制
catkin_ws/src/lstrobot_planning/scripts/__pycache__/hanqiangpose.cpython-38.pyc


二進制
catkin_ws/src/lstrobot_planning/scripts/__pycache__/hjsx.cpython-38.pyc


+ 148 - 0
catkin_ws/src/lstrobot_planning/scripts/check.py

@@ -0,0 +1,148 @@
+import rospy, sys
+import numpy as np
+from tf.transformations import euler_from_quaternion,quaternion_from_euler,quaternion_from_euler, quaternion_multiply
+
+# def traj_validity_check(trajectory):
+#     if type (trajectory)is moveit_msgs.msg._RobotTrajectory.RobotTrajectory:
+#         point_num=len(trajectory.joint_trajectory.point)
+#         trajectory.joint_trajectory.point.positions
+        
+#         # for i
+#         trajectory.joint_trajectory.point.velocities
+
+#         trajectory.joint_trajectory.point.accelerations
+        
+#         return 0
+#     # else:
+#     #         raise MoveItCommanderException(
+#     #             "Expected value in the range from 0 to 1 for scaling factor"
+#     #         )
+#     def scale_trajectory_speed(traj, scale):
+#        # Create a new trajectory object
+#        new_traj = RobotTrajectory()
+       
+#        # Initialize the new trajectory to be the same as the input trajectory
+#        new_traj.joint_trajectory = traj.joint_trajectory
+       
+#        # Get the number of joints involved
+#        n_joints = len(traj.joint_trajectory.joint_names)
+       
+#        # Get the number of points on the trajectory
+#        n_points = len(traj.joint_trajectory.points)
+        
+#        # Store the trajectory points
+#        points = list(traj.joint_trajectory.points)
+       
+#        # Cycle through all points and joints and scale the time from start,
+#        # as well as joint speed and acceleration
+#        for i in range(n_points):
+#            point = JointTrajectoryPoint()
+           
+#            # The joint positions are not scaled so pull them out first
+#            point.positions = list(traj.joint_trajectory.points[i].positions)
+
+#            # Next, scale the time_from_start for this point
+#             # point.time_from_start = traj.joint_trajectory.points[i].time_from_start / scale
+           
+#            # Get the joint velocities for this point
+#            point.velocities = list(traj.joint_trajectory.points[i].velocities)
+           
+#            # Get the joint accelerations for this point
+#            point.accelerations = list(traj.joint_trajectory.points[i].accelerations)
+           
+#            # Scale the velocity and acceleration for each joint at this point
+#            for j in range(n_joints):
+#             #    if point.positions[j]
+#                if has_velocity_limits:
+#                 if point.velocities[j] > joint_max_velocity[j]:
+#                     vel_exception_point
+#                     rospy.loginfo("velocities Test OK") 
+#                 else:
+#                     raise MoveItCommanderException("Expected value in the range from 0 to 1 for scaling factor")     
+#                if has_acceleration_limits:
+#                 point.accelerations[j] = point.accelerations[j] * scale * scale
+        
+#            # Store the scaled trajectory point
+#            points[i] = point
+
+#        rospy.loginfo("velocities Check OK") 
+
+#        # Assign the modified points to the new trajectory
+#        new_traj.joint_trajectory.points = points
+
+#        # Return the new trajecotry
+#        return new_traj
+
+#     else:
+#         print("traj type is not std")
+    
+def check_joint_positions(joint_trajectory):
+    is_limited = False
+    Limit_margin = True
+    percentage = 0
+    for i in range(len(joint_trajectory.joint_trajectory.points) - 1):
+        if  not is_limited:
+            joint_positions1 = joint_trajectory.joint_trajectory.points[i].positions
+            joint_positions2 = joint_trajectory.joint_trajectory.points[i + 1].positions 
+
+            for j in range(len(joint_positions1)):
+                position_diff = abs(joint_positions1[j] - joint_positions2[j])
+                if position_diff > 6:
+                    rospy.loginfo("point{}-joint{}:{}".format(i,j+1,joint_positions1))
+                    new_start_point = list(joint_trajectory.joint_trajectory.points[0].positions)
+                    
+                    #关节限位值
+                    joint_limt =[[],[],[],[-3.314,3.314],[],[-3.838,3.838]] 
+                    #检查关节限位余量
+                    # midpoint = (joint_limt[j][0] + joint_limt[j][1])/2
+                    # distance_to_midpoint = abs(joint_trajectory.joint_trajectory.points[0].positions[j]- midpoint)
+                    Limit_point = joint_positions1[j]
+                    distance_to_Limit_point = abs(joint_trajectory.joint_trajectory.points[0].positions[j]- Limit_point)
+                    Joint_range = abs(joint_limt[j][0] - joint_limt[j][1])
+                    margin = distance_to_Limit_point / Joint_range
+                    if margin > 0.4:
+                        Limit_margin = True
+                    else:
+                        Limit_margin = False
+                    rospy.loginfo("margin = {}".format(margin))
+                    # if joint_positions1[j]>0:
+                    #     new_start_point[j] -= np.pi*2
+                    # else:
+                    #     new_start_point[j] += np.pi*2
+                    # rospy.loginfo("new point{}:{}".format(i,new_start_point))
+                    percentage = i/len(joint_trajectory.joint_trajectory.points)
+                    is_limited = True
+                    break
+                if position_diff > 3:
+                    rospy.loginfo("point{}-joint{}:{}".format(i,j+1,joint_positions1))
+                    
+                    
+                    
+                    Limit_margin = True
+                    
+                    
+                    is_limited = True
+                    break
+        if  is_limited:
+            break
+    if not is_limited:
+        rospy.loginfo("joint positions check OK")         
+    return is_limited,Limit_margin
+
+def angle_adjustment(pose,axis,angle):
+    if len(pose) == 6:
+        q_initial = quaternion_from_euler(pose[3], pose[4], pose[5])
+    else:
+        q_initial = (pose[3], pose[4], pose[5],pose[6])
+    if axis == 'z':
+        q_rotation = quaternion_from_euler(0, 0, angle)
+    if axis == 'y':
+        q_rotation = quaternion_from_euler(0, angle, 0)
+    if axis == 'x':
+        q_rotation = quaternion_from_euler(angle, 0, 0)    
+    q_new = quaternion_multiply(q_initial, q_rotation)
+    pose[3:] = q_new
+    return pose
+
+
+

+ 32 - 0
catkin_ws/src/lstrobot_planning/scripts/command.py

@@ -0,0 +1,32 @@
+#! /usr/bin/env python3
+import subprocess
+import rospy
+import os
+
+file_path = "moveitServer2"
+script_directory = os.path.dirname(os.path.abspath(__file__))
+
+def load_rviz():
+    command = "roslaunch lstrobot_moveit_config_0419 demo.launch"
+    subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', command])
+def launch_publish_pointcloud():
+    file_name = "dycl_0506.py"
+    absolute_path = os.path.join(script_directory, file_name)
+    command = "python3 {}".format(absolute_path)
+    subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', command])
+def launch_moveit_control_server():
+    file_name = "moveitServer2.py"
+    absolute_path = os.path.join(script_directory, file_name)
+    command = "python3 {}".format(absolute_path)
+    subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', command])
+
+def launch_publish_pointcloud_background():
+    file_name = "dycl_0506.py"
+    absolute_path = os.path.join(script_directory, file_name)
+    command = ["python3", absolute_path]
+    subprocess.call(command)
+def launch_moveit_control_server_background():
+    file_name = "moveitServer2.py"
+    absolute_path = os.path.join(script_directory, file_name)
+    command = ["python3", absolute_path]
+    subprocess.call(command)

+ 215 - 0
catkin_ws/src/lstrobot_planning/scripts/dycl_0506.py

@@ -0,0 +1,215 @@
+#!/usr/bin/env python3
+import rospy
+import numpy as np
+import open3d as o3d
+from scipy.spatial.transform import Rotation as R
+import os
+from sensor_msgs.msg import PointCloud2
+from sensor_msgs.msg import PointField
+
+
+
+folder_path = rospy.get_param("folder_path")
+file_path = os.path.join(folder_path, 'pointcloud.txt')
+file_path_points = os.path.join(folder_path, 'points.txt')
+file_path_down = os.path.join(folder_path, 'pointcloud_down.pcd')
+file_path_octomap = os.path.join(folder_path, 'pointcloud_octomap.pcd')
+#chen############################################################################################
+def cull_pointcloud(data,culling_radius):
+    data_retained,data_culled = [],[]
+    for i in range(data.shape[0]):  # 遍历每一个点 P
+
+        for j in range(len(vectors)):  # 遍历每一个向量 u
+            A = start_points[j] - culling_radius * (vectors[j] / np.linalg.norm(vectors[j]))
+            B = end_points[j] + culling_radius * (vectors[j] / np.linalg.norm(vectors[j]))
+            aaa = (np.linalg.norm(data[i] - A) + np.linalg.norm(data[i] - B)) <= (2 * culling_radius + np.linalg.norm(B - A))
+            distance = np.linalg.norm(np.cross(vectors[j], data[i]-start_points[j])) / np.linalg.norm(vectors[j])
+
+            # 如果有任何一个距离小于等于10,则标记为不满足条件
+            if distance <= culling_radius and aaa:
+            # if aaa:
+                data_culled.append(data[i])
+                break
+            # 如果该点对所有向量的距离都大于10,则保留该点
+            elif j == len(vectors)-1:
+                data_retained.append(data[i])
+
+    data_retained = np.array(data_retained)
+    data_culled = np.array(data_culled)
+    return data_retained,data_culled    
+
+def visual_data(data):
+    # 可视化
+    pt_cloud_circular = o3d.geometry.PointCloud()
+    pt_cloud_circular.points = o3d.utility.Vector3dVector(data)
+    o3d.visualization.draw_geometries([pt_cloud_circular]) 
+################################点云降采样################################
+
+# 从文件中读取焊缝起点和终点,并计算两点构成的向量
+def read_and_calculate_vectors(file_path):
+    with open(file_path, 'r') as file:
+        # 逐行读取文件内容
+        lines = file.readlines()
+    start_points,end_points,vectors = [],[],[]
+    for line in lines:
+        # 去除行尾的换行符并按'/'分割每一行
+        points_str = line.strip().split('/')
+        
+        # 确保每一行都正确地分为两部分
+        if len(points_str) == 2:
+            point1_str = points_str[0].split(',')
+            point2_str = points_str[1].split(',')
+            
+            # 转换字符串为浮点数列表,构造三维点
+            point1 = [float(coord) for coord in point1_str]
+            point2 = [float(coord) for coord in point2_str]
+
+            start_points.append(point1)
+            end_points.append(point2)
+            # 计算向量:向量 = 点2 - 点1
+            vector = [p2 - p1 for p1, p2 in zip(point1, point2)]
+            
+            vectors.append(vector)
+    
+    return start_points,end_points,vectors
+
+# 读取文件
+def load_point_cloud_from_binary_txt(file_path):
+    with open(file_path, 'rb') as f:
+        binary_data = f.read()
+
+        # 将二进制数据转换为 NumPy 数组
+        point_cloud = np.frombuffer(binary_data, dtype=np.float64).reshape(-1, 3)
+        # 将数组转换为可写状态
+        point_cloud = np.copy(point_cloud)
+    return point_cloud
+
+def open_file(file_path):
+    if '.txt' in file_path:
+        pcd = o3d.io.read_point_cloud(file_path, format='xyz')
+    else:
+        pcd = o3d.io.read_point_cloud(file_path)
+    return pcd
+
+def save_file(content, file_path, write_ascii=True):
+    if '.txt' in file_path:
+        np.savetxt(file_path, np.asarray(content.points), fmt='%f %f %f')
+    else:
+        o3d.io.write_point_cloud(file_path, content, write_ascii=write_ascii)
+
+def voxel_down_sample(pcd, voxel_size):
+    """
+    体素方法点云降采样
+    :param pcd: 点云数据
+    :param voxel_size: 体素降采样的网格长度
+    :return: 降采样点云数据
+    """
+    return pcd.voxel_down_sample(voxel_size=voxel_size)
+
+def add_rgb_to_pcd(pcd):
+
+    # 为点云中的每个点指定RGB颜色,这里我们使用红色作为示例
+    # RGB值范围为[0, 1],红色可以表示为(1, 0, 0)
+    pcd = np.asarray(pcd.points).shape[0]
+    colors = np.repeat([[1, 0, 0]], pcd, axis=0)  # 创建一个全是红色的颜色数组
+    # 将颜色信息添加到点云对象中
+    pcd.colors = o3d.utility.Vector3dVector(colors)
+    return pcd
+
+# 降采样
+# pcd = open_file(file_path)
+
+pcd = o3d.geometry.PointCloud()
+pcd.points = o3d.utility.Vector3dVector(load_point_cloud_from_binary_txt(file_path))
+pcd = pcd.voxel_down_sample(voxel_size = 4)
+save_file(pcd,file_path_down)
+
+################################去掉焊缝周围的点云#################################
+
+# 计算焊缝向量
+
+start_points,end_points,vectors = np.array(read_and_calculate_vectors(file_path_points))
+# 使用pcread直接读取点云数据
+ptCloud = o3d.io.read_point_cloud(file_path_down)
+data = np.asarray(ptCloud.points)
+
+culling_radius1 = 20
+culling_radius2 = float(rospy.get_param('culling_radius'))
+# culling_radius2 = 6
+
+data_retained2,data_culled2 =cull_pointcloud(data,culling_radius2)
+# rospy.loginfo('Point cloud culling is complete')
+#分批剔除
+# data_retained1,data_culled1 =cull_pointcloud(data,culling_radius1)
+# # visual_data(data_culled1)
+# data_retained2,data_culled2 =cull_pointcloud(data_culled1,culling_radius2)
+# visual_data(data_retained2)
+# visual_data(data_culled2)
+################################变换单位并保存################################
+
+# 将点云数据的小数点向前移动三位(即乘以1000)
+# data_scaled1 = np.array(data_retained1) / 1000
+data_scaled2 = np.array(data_retained2) / 1000
+# 创建一个新的pointCloud对象来存储缩放后的数据
+ptCloud_scaled1 = o3d.geometry.PointCloud()
+# ptCloud_scaled1.points = o3d.utility.Vector3dVector(data_scaled1)
+ptCloud_scaled2 = o3d.geometry.PointCloud()
+ptCloud_scaled2.points = o3d.utility.Vector3dVector(data_scaled2)
+# 将缩放后的点云数据写入新的 PCD 文件
+# o3d.io.write_point_cloud(file_path_octomap, ptCloud_scaled1, write_ascii=True)
+
+# 读取保存的点云数据
+# pcd = o3d.io.read_point_cloud(file_path_octomap)
+
+#####################################################################################################################################################################
+def build_pointcloud2_msg(points):
+    msg = PointCloud2()
+    msg.header.stamp = rospy.Time(0)
+    msg.header.frame_id = "base_link"
+
+    if len(points.shape) == 3:
+        msg.height = points.shape[1]
+        msg.width = points.shape[0]
+    else:
+        msg.height = 1
+        msg.width = len(points)
+
+    msg.fields = [
+        PointField('x', 0, PointField.FLOAT32, 1),
+        PointField('y', 4, PointField.FLOAT32, 1),
+        PointField('z', 8, PointField.FLOAT32, 1)]
+    msg.is_bigendian = False
+    msg.point_step = 12
+    msg.row_step = msg.point_step * points.shape[0]
+    msg.is_dense = False
+    msg.data = np.asarray(points, np.float32).tobytes()
+    return msg
+def talker():
+    pointcloud_topic = rospy.get_param('pointcloud_topic')
+    pub1 = rospy.Publisher("/pointcloud/output", PointCloud2, queue_size=10)
+    # pub2 = rospy.Publisher("/pointcloud/output2", PointCloud2, queue_size=10)
+    rospy.init_node('publish_pointcloud', anonymous=True)
+    rate = rospy.Rate(10)
+
+    
+    points1 = np.asarray(ptCloud_scaled1.points)
+    points2 = np.asarray(ptCloud_scaled2.points)
+    # msg1 = build_pointcloud2_msg(points1)
+    msg2 = build_pointcloud2_msg(points2)
+    
+    while not rospy.is_shutdown():
+
+        #机械臂完毕,退出点云发布
+        sign_pointcloud = str(rospy.get_param("sign_pointcloud"))
+        if sign_pointcloud == "1":
+            rospy.set_param("sign_pointcloud",0)
+            break
+
+        pub1.publish(msg2)
+        # pub2.publish(msg2)
+        # print("pointcloud has published,sign_pointcloud ={}".format(sign_pointcloud))
+        rate.sleep()
+
+if __name__ == '__main__':     
+
+    talker()

+ 455 - 0
catkin_ws/src/lstrobot_planning/scripts/hanqiangpose.py

@@ -0,0 +1,455 @@
+import numpy as np
+from scipy.spatial.transform import Rotation as R
+import open3d as o3d
+from scipy.spatial import KDTree
+import tf.transformations as tft
+import os
+import rospy
+from math import acos,tan,atan,degrees,sqrt
+
+def corner_angle_discrimination(point,data,fangxiang):
+    # 构建KDTree索引
+    tree = KDTree(data)
+    indices = np.array(tree.query_ball_point(point, r=30, p=2)) # 返回这些点的索引数组
+    distances = np.array([np.linalg.norm(point - data[index]) for index in indices])
+    distance_filter = distances >= 10
+    filtered_indices = indices[distance_filter]
+    data_circular = data[filtered_indices]
+
+    # 可视化
+    # pt_cloud_circular = o3d.geometry.PointCloud()
+    # pt_cloud_circular.points = o3d.utility.Vector3dVector(data_circular)
+    # o3d.visualization.draw_geometries([pt_cloud_circular])
+
+    # 获取与方向向量相似的点云
+    data_similar = []
+    for i in range(len(data_circular)):
+        v = np.array(data_circular[i]) - point
+        angle = acos(np.dot(v, fangxiang) / (np.linalg.norm(v) * np.linalg.norm(fangxiang)))
+        angle_deg = degrees(angle)
+        if angle_deg <= 15:
+            data_similar.append(data_circular[i])
+    
+    if len(data_similar) >= 1:
+        corner = True
+    else:
+        corner = False
+    return corner
+def set_yaw_angle(R_mat,yaw):
+    pz1 = np.array([[1, 0, 0],
+                    [0, np.cos(yaw), -np.sin(yaw)],
+                    [0, np.sin(yaw),  np.cos(yaw)]])
+    Z_PI = np.array([[np.cos(np.pi), -np.sin(np.pi), 0],
+                    [np.sin(np.pi), np.cos(np.pi), 0],
+                    [0, 0, 1]])
+    R1_mat = np.matmul(R_mat,pz1)
+    
+    sign = check_x_axis_direction(R1_mat)
+    if sign == 1:
+        pass
+    elif sign == -1:
+        R1_mat = np.matmul(R1_mat, Z_PI)
+
+    q = R.from_matrix(R1_mat).as_quat()
+    q = q.tolist()  # 将NumPy数组转换为列表
+    return q
+def calculate_angle_with_xy_plane(point1,point2):
+    # 计算方向向量
+    dir_vector = np.array([point2[0] - point1[0], point2[1] - point1[1], point2[2] - point1[2]])
+    
+    # 计算方向向量在 xy 平面上的投影
+    proj_vector = np.array([point2[0] - point1[0], point2[1] - point1[1], 0])
+    
+    # 计算夹角
+    angle = acos(np.dot(dir_vector, proj_vector) / (np.linalg.norm(dir_vector) * np.linalg.norm(proj_vector)))
+    angle_deg = degrees(angle)
+
+    return angle_deg
+def check_x_axis_direction(rotation_matrix):
+    # 提取旋转后的 x 轴方向向量
+    x_prime = rotation_matrix[:, 0]
+    # 检查 x 轴的 z 分量
+    if x_prime[2] > 0:
+        return 1
+    elif x_prime[2] < 0:
+        return -1
+    else:
+        return 0
+def load_point_cloud_from_txt(file_path):
+    """导入点云数据"""
+    points = []
+    with open(file_path, 'r') as file:
+        for line in file:
+            # 假设每一行是“x y z”格式,没有多余空格
+            coordinates = line.strip().split()
+            if len(coordinates) == 3:  # 检查是否为有效的三维点
+                point = [float(coord) for coord in coordinates]
+                points.append(point)
+
+    return np.array(points)
+def load_point_cloud_from_binary_txt(file_path):
+    with open(file_path, 'rb') as f:
+        binary_data = f.read()
+
+        # 将二进制数据转换为 NumPy 数组
+        point_cloud = np.frombuffer(binary_data, dtype=np.float64).reshape(-1, 3)
+    return point_cloud
+
+def get_hanfeng(file_path):
+    """从文件中读取焊缝起点、终点和中间点,并计算两点构成的向量"""
+    with open(file_path, 'r') as file:
+        # 逐行读取文件内容
+        lines = file.readlines()
+    start_points, end_points, midpoints , hanfeng = [],[],[],[]
+    for line in lines:
+        # 去除行尾的换行符并按'/'分割每一行
+        points_str = line.strip().split('/')
+        
+        # 确保每一行都正确地分为两部分
+        if len(points_str) == 2:
+            point1_str = points_str[0].split(',')
+            point2_str = points_str[1].split(',')
+            
+            # 转换字符串为浮点数列表,构造三维点
+            point1 = [float(coord) for coord in point1_str]
+            point2 = [float(coord) for coord in point2_str]
+
+            midpoint = [(p2 + p1)/2 for p1, p2 in zip(point1, point2)]
+            vector = [p2 - p1 for p1, p2 in zip(point1, point2)]
+            
+            start_points.append(point1)
+            end_points.append(point2)
+            midpoints.append(midpoint)  
+            hanfeng.append(vector)   
+
+    return start_points, end_points, midpoints, hanfeng
+
+def compute_Rc2w_tc2w(file_path_Tw2c):
+    """相机和基底坐标系的转换关系"""
+    # 读取文件
+    with open(file_path_Tw2c, 'r') as file:
+        lines = file.readlines()
+
+    lines = [line.strip().replace('[', '').replace(']', '').split() for line in lines]
+    data = [[float(num) for num in line] for line in lines]
+    data = np.array(data)
+    # 提取Rw2c和tw2c
+    Rw2c = data[:3,:3]
+    tw2c = data[:3,-1]
+
+    Rc2w = Rw2c.T
+    tc2w = -np.matmul(Rc2w, tw2c)
+    
+    return Rc2w,tc2w
+
+def compute_pose_R(fangxiang, hanfeng,start_point, end_point):
+    """根据计算出的焊接时z轴负方向的向量和由起(fangxiang)点指向终点的向量(hanfeng)计算旋转矩阵"""
+    x, y, z = fangxiang
+
+    # 计算旋转角度
+    rotx = -np.arctan2(y, z)
+    roty = np.arctan2(x, np.sqrt(y**2 + z**2))
+
+    # 构造旋转矩阵
+    A = np.array([[1, 0, 0],
+                [0, np.cos(rotx), -np.sin(rotx)],
+                [0, np.sin(rotx), np.cos(rotx)]])
+    B = np.array([[np.cos(roty), 0, np.sin(roty)],
+                [0, 1, 0],
+                [-np.sin(roty), 0, np.cos(roty)]])
+    bb = np.matmul(hanfeng, np.matmul(A, B))
+    # 区分平缝竖缝
+    angle = calculate_angle_with_xy_plane(start_point,end_point)
+    ispingfeng = abs(angle) < 30
+    if ispingfeng: 
+        rotz = np.arctan2(bb[0], -bb[1])
+    else:
+        rotz = np.arctan2(bb[1], bb[0])
+
+    C = np.array([[np.cos(rotz), -np.sin(rotz), 0],
+                [np.sin(rotz), np.cos(rotz), 0],
+                [0, 0, 1]])
+    D = np.array([[1, 0, 0],
+                    [0, np.cos(np.pi), -np.sin(np.pi)],
+                    [0, np.sin(np.pi), np.cos(np.pi)]])
+
+    R_mat = np.matmul(A, np.matmul(B, np.matmul(C, D)))
+
+    return R_mat, ispingfeng
+
+def get_quaternion(data, midpoint, hanfeng, start_point, end_point,result_ping,result_shu,result_wai,file_path_Tw2c): 
+
+    # 构建KDTree索引
+    tree = KDTree(data)
+    # 查询半径范围内的点,找出"data"中所有距离"midpoint"点在r以内的点,这里使用的是欧几里得距离(由p=2表示)
+    indices = np.array(tree.query_ball_point(midpoint, r=30, p=2)) # 返回这些点的索引数组
+    distances = np.array([np.linalg.norm(midpoint - data[index]) for index in indices])
+    # 对numpy数组进行布尔索引
+    # distance_filter = np.logical_and(distances >= 10, distances <= 50)
+    distance_filter = distances >= 10
+    # 使用布尔索引过滤出符合条件的索引
+    filtered_indices = indices[distance_filter]
+    # 提取符合条件的点
+    data_circular = data[filtered_indices]
+
+    # 可视化
+    # pt_cloud_circular = o3d.geometry.PointCloud()
+    # pt_cloud_circular.points = o3d.utility.Vector3dVector(data_circular)
+    # o3d.visualization.draw_geometries([pt_cloud_circular])
+
+    # 获取竖直方向上的点云
+    data_shu = []
+    for i in range(len(data_circular)):
+        P = np.array(data_circular[i])
+        v = P - midpoint
+        anglecos = np.dot(v, hanfeng) / (np.linalg.norm(v) * np.linalg.norm(hanfeng))
+        
+        if abs(anglecos) <= 0.015:
+            # print(anglecos)
+            data_shu.append(P)
+    data_shu = np.array(data_shu)
+    # # 可视化
+    # pt_cloud_shu = o3d.geometry.PointCloud()
+    # pt_cloud_shu.points = o3d.utility.Vector3dVector(np.array(data_shu))
+    # o3d.visualization.draw_geometries([pt_cloud_shu])
+
+ ##################################################
+ ##################################################
+    random_point = data_shu[np.random.randint(0, len(data_shu))]
+    # 与midpoint一起定义直线向量
+    nohanfeng = random_point - midpoint  #data_shu中任意一点midpoint构成的向量,计算所有点和该向量的距离判断是否是外缝(只拍到一面)
+
+    distances_to_line = []
+
+    for i in range(data_shu.shape[0]):  # 遍历每一个点 P
+        P = data_shu[i]
+        A = midpoint
+        u = nohanfeng
+        v = P - A
+        distance = np.linalg.norm(np.cross(u, v)) / np.linalg.norm(u)
+        distances_to_line.append(distance)
+
+    distances_to_line = np.array(distances_to_line)
+
+    all_distances_less_than_10 = np.all(distances_to_line < 5)#都小于10为true,也就是data_shu只有一列,侧着拍得外缝
+
+    if all_distances_less_than_10:
+
+        # 随机选取data_shu中的第一个点
+        random_index = np.random.randint(0, data_shu.shape[0])
+        vector1 = data_shu[random_index] - midpoint
+        vector1 /= np.linalg.norm(vector1)  # 单位化vector1
+        fa_xian = np.cross(vector1, hanfeng)
+        fa_xian /= np.linalg.norm(fa_xian) 
+
+        point = []
+        point1 = midpoint + 50 * fa_xian
+        point2 = midpoint - 50 * fa_xian
+
+        Rc2w,tc2w = compute_Rc2w_tc2w(file_path_Tw2c)
+
+        point1_c = np.matmul(Rc2w, point1) + tc2w
+        point2_c = np.matmul(Rc2w, point2) + tc2w
+        a = np.linalg.norm(point1_c)
+        b = np.linalg.norm(point2_c)      
+
+        if a < b:
+            point = point1
+        else:
+            point = point2
+
+        faxian = point - midpoint
+        vector2 =  faxian / np.linalg.norm(faxian)  # 单位化vector2
+
+        fangxiang = vector1  + vector2*1.2
+
+        R_mat, ispingfeng = compute_pose_R(fangxiang, hanfeng, start_point, end_point)
+        if ispingfeng:
+            ##偏转##
+            pz1 = np.array([[1, 0, 0],
+                        [0, np.cos(yaw), -np.sin(yaw)],
+                        [0, np.sin(yaw),  np.cos(yaw)]])
+            pz2 = np.array([[1, 0, 0],
+                        [0, np.cos(-yaw), -np.sin(-yaw)],
+                        [0, np.sin(-yaw),  np.cos(-yaw)]])
+            Z_PI = np.array([[np.cos(np.pi), -np.sin(np.pi), 0],
+                    [np.sin(np.pi), np.cos(np.pi), 0],
+                    [0, 0, 1]])
+            R1_mat = np.matmul(R_mat,pz1)
+            R2_mat = np.matmul(R_mat,pz2)
+
+            sign = check_x_axis_direction(R1_mat)
+            if sign == 1:
+                pass
+            elif sign == -1:
+                R1_mat = np.matmul(R1_mat, Z_PI)
+                R2_mat = np.matmul(R2_mat, Z_PI)
+
+            q1 = R.from_matrix(R1_mat).as_quat()
+            q2 = R.from_matrix(R2_mat).as_quat()
+            q1 = q1.tolist()  # 将NumPy数组转换为列表
+            q2 = q2.tolist()
+            # print("一个点云面的平外缝")
+            # print(q1,q2)
+            result_ping.append(("pw", start_point, end_point, q1, q2))
+            
+            return result_ping,result_shu,result_wai
+        else:
+            ##偏转##
+            E = np.array([[np.cos(-pitch_of_Verticalweld), 0, np.sin(-pitch_of_Verticalweld)],
+                        [0, 1, 0],
+                        [-np.sin(-pitch_of_Verticalweld), 0, np.cos(-pitch_of_Verticalweld)]])
+
+            R_mat = np.matmul(R_mat,E)
+            
+            q1 = R.from_matrix(R_mat).as_quat()
+            q2 = R.from_matrix(R_mat).as_quat()
+            q1 = q1.tolist()  # 将NumPy数组转换为列表
+            q2 = q2.tolist()
+            # print("即一个点云面的竖外缝")
+            # print(q1,q2)
+            result_wai.append(("sw", start_point, end_point, q1, q2))
+            return result_ping,result_shu,result_wai
+
+    else:
+        # 选择位于平面两侧的点
+        # 随机选取data_shu中的第一个点
+        random_index = np.random.randint(0, data_shu.shape[0])
+        vector1 = data_shu[random_index] - midpoint
+        vector1 /= np.linalg.norm(vector1)  # 单位化vector1
+
+        # 随机选取下一个点,直到找到与vector1夹角大于10度的向量
+        found = False
+        while not found:
+            random_index = np.random.randint(0, data_shu.shape[0])
+            random_point = data_shu[random_index] - midpoint
+            vector2 = random_point / np.linalg.norm(random_point)  # 单位化vector2
+            
+            # 计算两个向量之间的夹角(弧度)
+            dot_product = np.dot(vector1, vector2)
+            angle_rad = np.arccos(dot_product)
+            
+            # 判断角度是否大于10度(转换为弧度)
+            if angle_rad > np.deg2rad(20) and angle_rad < np.deg2rad(180):
+                found = True
+                # 如果找到了,则保存vector2
+            else:
+                continue
+
+        # 计算并保存最终的fangxiang向量, vector1与vector2均为单位向量
+        vector1_sim_to_z = np.dot(vector1, [0,0,1]) / (np.linalg.norm(vector1))
+        vector2_sim_to_z = np.dot(vector2, [0,0,1]) / (np.linalg.norm(vector2))
+        if vector1_sim_to_z > vector2_sim_to_z:
+            vector_shu = vector1
+            vector_ping = vector2
+        else:
+            vector_shu = vector2
+            vector_ping = vector1
+        fangxiang = vector_ping + vector_shu*tan(pitch_of_Horizontalweld)
+        # fangxiang = vector1 + vector2
+        fangxiang /= np.linalg.norm(fangxiang)  # 单位化fangxiang
+
+        #########################################根据vector1和vector2判断内缝外缝#########################################
+        point1 = midpoint + 50 * fangxiang 
+        point2 = midpoint - 50 * fangxiang 
+
+        Rc2w,tc2w = compute_Rc2w_tc2w(file_path_Tw2c)
+        
+        point1_c = np.matmul(Rc2w, point1) + tc2w
+        point2_c = np.matmul(Rc2w, point2) + tc2w
+        a = np.linalg.norm(point1_c)
+        b = np.linalg.norm(point2_c)    
+
+        if a < b: # 内缝
+            # print("两个点云面的内缝")
+            fangxiang = fangxiang
+        else: # 外缝
+            # print("两个点云面的外缝")
+            fangxiang = -fangxiang
+
+        R_mat, ispingfeng = compute_pose_R(fangxiang, hanfeng, start_point, end_point)
+        if ispingfeng:
+            ##偏转##
+            corner_of_start_point = corner_angle_discrimination(start_point,data,fangxiang)
+            corner_of_end_point = corner_angle_discrimination(end_point,data,fangxiang)
+            pi4_pz = atan(1 / (sqrt(2) * tan(np.pi/4)))#CL公式
+            yaw_pz =atan(1 / (sqrt(2) * tan(yaw)))
+            if corner_of_start_point:
+                q1 = set_yaw_angle(R_mat,pi4_pz)
+                if not corner_of_end_point:
+                    len_hanfeng = np.linalg.norm(hanfeng)
+                    angle = pi4_pz-(pi4_pz)*len_hanfeng/yaw_rate
+                    if angle < -yaw_pz:
+                        angle =-yaw_pz
+                    q2 = set_yaw_angle(R_mat,angle)
+            if corner_of_end_point:
+                q2 = set_yaw_angle(R_mat,-pi4_pz)
+                if not corner_of_start_point:
+                    len_hanfeng = np.linalg.norm(hanfeng)
+                    angle = -pi4_pz+(pi4_pz)*len_hanfeng/yaw_rate
+                    if angle > yaw_pz:
+                        angle = yaw_pz
+                    q1 = set_yaw_angle(R_mat,angle)
+            if not corner_of_start_point and not corner_of_end_point:     
+                q1 = set_yaw_angle(R_mat,yaw_pz)
+                len_hanfeng = np.linalg.norm(hanfeng)
+                angle = yaw_pz-(pi4_pz)*len_hanfeng/yaw_rate
+                if angle < -yaw_pz:
+                    angle =-yaw_pz
+                q2 = set_yaw_angle(R_mat,angle)
+            
+            result_ping.append(("p", start_point, end_point, q1, q2))
+            
+            return result_ping,result_shu,result_wai
+        else:
+            ##偏转##
+            E = np.array([[np.cos(-pitch_of_Verticalweld), 0, np.sin(-pitch_of_Verticalweld)],
+                        [0, 1, 0],
+                        [-np.sin(-pitch_of_Verticalweld), 0, np.cos(-pitch_of_Verticalweld)]])
+
+            R_mat = np.matmul(R_mat,E)
+            
+            q1 = R.from_matrix(R_mat).as_quat()
+            q2 = R.from_matrix(R_mat).as_quat()
+            q1 = q1.tolist()  # 将NumPy数组转换为列表
+            q2 = q2.tolist()
+            # print(q1,q2)
+            result_wai.append(("s", start_point, end_point, q1, q2))
+            return result_ping,result_shu,result_wai        
+
+def run():
+    global yaw,yaw_rate,pitch_of_Horizontalweld,pitch_of_Verticalweld
+    # yaw = np.pi/8
+    yaw = np.pi/2-rospy.get_param("yaw")
+    pitch_of_Verticalweld = rospy.get_param("pitch_of_Verticalweld")
+    pitch_of_Horizontalweld = rospy.get_param("pitch_of_Horizontalweld")
+    yaw_rate = rospy.get_param("yaw_rate")
+    file_path = rospy.get_param("folder_path")
+    # file_path = ('/home/chen/catkin_ws/data/0603')
+    file_path_pointcloud = os.path.join(file_path, 'pointcloud.txt')
+    file_path_points = os.path.join(file_path, 'points_guihua.txt')
+    file_path_result = os.path.join(file_path, 'result.txt')
+    file_path_Tw2c = os.path.join(file_path, 'Tw2c.txt')
+
+    # 获取数据
+    data = load_point_cloud_from_binary_txt(file_path_pointcloud)
+    start_points, end_points, midpoints, hanfeng = get_hanfeng(file_path_points)
+
+    # 计算位姿
+    result_ping,result_shu,result_wai = [],[],[]
+    for i in range(len(midpoints)):
+        result_ping,result_shu,result_wai = get_quaternion(data, midpoints[i], hanfeng[i], start_points[i], end_points[i],result_ping,result_shu,result_wai, file_path_Tw2c)
+        # print(q1," ",q2)
+    result = result_ping + result_shu + result_wai
+
+    # 打开文件准备写入
+    with open(file_path_result, "w") as file:
+        for group in result:
+            # 对于每个数据组,将每个部分用逗号连接,然后在各部分间插入斜杠
+            line = "/".join([",".join(map(str, sublist)) for sublist in group]) + "\n"
+            file.write(line)
+
+    rospy.loginfo("Welding Angle calculation completed")
+if __name__ == '__main__':     
+    
+    run()

+ 143 - 0
catkin_ws/src/lstrobot_planning/scripts/hjsx.py

@@ -0,0 +1,143 @@
+import numpy as np
+import os
+import rospy
+from math import acos, degrees
+def calculate_distance(point1, point2):
+    return np.linalg.norm(np.array(point1) - np.array(point2))
+
+def calculate_angle_with_xy_plane(point1,point2):
+    # 计算方向向量
+    dir_vector = np.array([point2[0] - point1[0], point2[1] - point1[1], point2[2] - point1[2]])
+    
+    # 计算方向向量在 xy 平面上的投影
+    proj_vector = np.array([point2[0] - point1[0], point2[1] - point1[1], 0])
+    
+    # 计算夹角
+    angle = acos(np.dot(dir_vector, proj_vector) / (np.linalg.norm(dir_vector) * np.linalg.norm(proj_vector)))
+    angle_deg = degrees(angle)
+
+    return angle_deg
+
+def read_points_from_file(file_path):
+    """从文件中读取焊缝数据"""
+    with open(file_path, 'r') as file:
+        lines = file.readlines()
+    data = [line.strip().split('/') for line in lines]
+    points_list = [[tuple(map(float, pair.split(','))) for pair in line] for line in data]
+    return points_list
+########
+# 从文件中读取焊缝起点和终点,并计算两点构成的向量
+def get_hanfeng(file_path):
+
+    data_ping, data_shu = [],[]
+
+    with open(file_path, 'r') as file:
+        # 逐行读取文件内容
+        lines = file.readlines()
+    flag_sequence = 0
+    for line in lines:
+        flag_sequence += 1
+        # 去除行尾的换行符并按'/'分割每一行
+        points_str = line.strip().split('/')
+        
+        point1_str = points_str[0].split(',')
+        point2_str = points_str[1].split(',')
+        
+        # 转换字符串为浮点数列表,构造三维点
+        point1 = [float(coord) for coord in point1_str]
+        point2 = [float(coord) for coord in point2_str]
+
+        angle = calculate_angle_with_xy_plane(point1,point2)
+        
+        if abs(angle) < 30:
+            data_ping.append([point1, point2, flag_sequence])
+        else:
+            data_shu.append([*sorted([point1, point2], key=lambda p: p[2]), flag_sequence]) 
+
+        data = data_ping + data_shu
+
+        # midpoint = [(p2 + p1)/2 for p1, p2 in zip(point1, point2)]
+        # vector = [p2 - p1 for p1, p2 in zip(point1, point2)]
+        
+        # start_points.append(point1)
+        # end_points.append(point2)
+        # midpoints.append(midpoint)  
+        # hanfeng.append(vector)   
+    # return start_points, end_points, midpoints, hanfeng
+    return data_ping, data_shu, data
+
+
+################################################################################################################
+################################################################################################################
+def sort_welds_by_distance_ping(data_ping, reference_point):
+    """根据与参考点的距离对焊缝进行排序"""
+    sorted_data_ping = []
+    for i in range(len(data_ping)):
+        # 计算起点到参考点的距离并排序
+        data_with_distances = [[calculate_distance(start, reference_point),calculate_distance(end, reference_point), start, end,flag_sequence] for start, end,flag_sequence in data_ping]
+        for i in range(len(data_with_distances)):
+            if data_with_distances[i][0] > data_with_distances[i][1]:
+                data_with_distances[i][0] = data_with_distances[i][1]
+                tem = data_with_distances[i][2]
+                data_with_distances[i][2] = data_with_distances[i][3]
+                data_with_distances[i][3] = tem
+        data_with_distances.sort(key=lambda x: x[0])
+
+        # 初始化结果和当前终点
+        sorted_data_ping.append(data_with_distances.pop(0)[-3:])
+        reference_point = sorted_data_ping[-1][1]
+        data_ping = [[start, end,flag_sequence] for distances1,distances2, start,end,flag_sequence in data_with_distances]
+    return sorted_data_ping
+def sort_welds_by_distance_shu(data_shu, reference_point):
+    """根据与参考点的距离对焊缝进行排序"""
+    sorted_data_shu = []
+    for i in range(len(data_shu)):
+        # 计算起点到参考点的距离并排序
+        data_with_distances = [[calculate_distance(start, reference_point), start, end ,flag_sequence] for start, end ,flag_sequence in data_shu]
+        
+        data_with_distances.sort(key=lambda x: x[0])
+
+        # 初始化结果和当前终点
+        sorted_data_shu.append(data_with_distances.pop(0)[-3:])
+        reference_point = sorted_data_shu[-1][1]
+        data_shu = [[start, end ,flag_sequence] for distances, start,end ,flag_sequence in data_with_distances]
+    return sorted_data_shu
+def run():
+    
+    # 定义参考点
+    reference_point = (1172.85077147, -1.50259925, 668.30298144)
+
+    # file_path = '/home/chen/catkin_ws/src/publish_pointcloud/data/pointclouddata/20240520r'
+    file_path = rospy.get_param("folder_path")
+    file_path_pointcloud = os.path.join(file_path, 'pointcloud.txt')
+    file_path_points = os.path.join(file_path, 'points.txt')
+    file_path_result = os.path.join(file_path, 'result.txt')
+    file_path_points_guihua = os.path.join(file_path, 'points_guihua.txt')
+
+    data_ping, data_shu, data = get_hanfeng(file_path_points)
+
+    
+    # 对焊缝排序
+    sorted_data_ping = sort_welds_by_distance_ping(data_ping, reference_point)
+    if len(data_ping) > 0:
+        a = tuple(sorted_data_ping[-1][1])
+    else:
+        a = reference_point
+    sorted_welds_shu = sort_welds_by_distance_shu(data_shu, a)
+    sorted_welds = sorted_data_ping + sorted_welds_shu
+
+    flag_sequence = [flag_sequence for start,end ,flag_sequence in sorted_welds]
+    #传递焊接顺序
+    rospy.set_param('welding_sequence',flag_sequence)
+    sorted_welds_withnoflag = [[start,end]for start,end ,flag_sequence in sorted_welds]
+
+    with open(file_path_points_guihua, "w") as file:
+        for start, end in sorted_welds_withnoflag:
+            # 将每一对起点和终点转换为字符串,并用逗号连接,最后以换行符分隔不同的焊缝对
+            line = "{},{},{}".format(start[0], start[1], start[2]) + "/" + "{},{},{}".format(end[0], end[1], end[2]) + "\n"
+            file.write(line)
+    
+    rospy.loginfo("Welding sequence calculation completed")
+
+if __name__ == '__main__':    
+    run()

+ 884 - 0
catkin_ws/src/lstrobot_planning/scripts/moveitServer2.py

@@ -0,0 +1,884 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# 导入基本ros和moveit库
+from logging.handlers import RotatingFileHandler
+import os
+import rospy, sys
+import moveit_commander      
+import moveit_msgs
+
+from moveit_commander import MoveGroupCommander, PlanningSceneInterface, RobotCommander
+from moveit_msgs.msg import  PlanningScene, ObjectColor,CollisionObject, AttachedCollisionObject,RobotTrajectory
+from moveit_msgs.msg import RobotState
+from moveit_msgs.msg import Constraints, PositionConstraint, OrientationConstraint
+from shape_msgs.msg import SolidPrimitive
+from sensor_msgs.msg import JointState
+import tf.transformations
+from trajectory_msgs.msg import JointTrajectory,JointTrajectoryPoint
+from geometry_msgs.msg import PoseStamped, Pose,Point,Vector3
+
+from copy import deepcopy
+import numpy as np
+import tf
+from tf.transformations import euler_from_quaternion,quaternion_from_euler,quaternion_from_euler, quaternion_multiply
+import math
+import traceback
+import check
+from lstrobot_planning.msg import JointTrajectoryPoint_ex,JointTrajectory_ex
+
+pi = np.pi
+
+class MoveIt_Control:
+    # 初始化程序
+    def __init__(self, is_use_gripper=False):
+        self.home_pose=[]
+        # Init ros config
+        moveit_commander.roscpp_initialize(sys.argv)
+        # 初始化ROS节点
+        rospy.init_node('moveit_control_server', anonymous=False)   
+        self.arm = moveit_commander.MoveGroupCommander('manipulator')
+        self.arm.set_goal_joint_tolerance(0.0001)
+        self.arm.set_goal_position_tolerance(0.0005)
+        self.arm.set_goal_orientation_tolerance(0.1)
+
+        self.end_effector_link = self.arm.get_end_effector_link()
+        # 设置机械臂基座的参考系
+        self.reference_frame = 'base_link'
+        self.arm.set_pose_reference_frame(self.reference_frame)
+
+        # # 设置最大规划时间和是否允许重新规划
+        self.arm.set_planning_time(10)
+        self.arm.allow_replanning(True)
+        planner_id = rospy.get_param("planner_id")
+        # self.arm.set_planner_id(planner_id)
+        # self.arm.set_planner_id("RRTstar")
+        # self.arm.set_planner_id("SBL")
+        # self.arm.set_planner_id("BKPIECE")#速度快,比较稳定
+        # self.arm.set_planner_id("BiEST")#还不错
+        
+        # 设置允许的最大速度和加速度(范围:0~1)
+        robot_params = {
+            'velocity_limits': True,
+            'joint_max_velocity': [3.541, 3.541, 3.733, 6.838, 4.815, 23.655],
+            'acceleration_limits': False,
+            'joint_max_acceleration': [0, 0, 0, 0, 0, 0]
+        }
+        self.arm.set_max_acceleration_scaling_factor(1)
+        self.arm.set_max_velocity_scaling_factor(1)
+
+        # 机械臂初始姿态
+        self.go_home()
+        home_pose=self.get_now_pose()
+        
+    def get_now_pose(self):
+        # 获取机械臂当前位姿
+        current_pose = self.arm.get_current_pose(self.end_effector_link).pose
+        pose=[]
+        pose.append(current_pose.position.x)
+        pose.append(current_pose.position.y)
+        pose.append(current_pose.position.z)
+
+        pose.append(current_pose.orientation.x)
+        pose.append(current_pose.orientation.y)
+        pose.append(current_pose.orientation.z)
+        pose.append(current_pose.orientation.w)
+        # 打印位姿信息       
+        #rospy.lohome_poseinfo("Current Pose: {}".format(pose))
+        return pose
+    
+    def close(self):
+        moveit_commander.roscpp_shutdown()
+        moveit_commander.os._exit(0)
+
+    def create_path_constraints2(self,start_point,end_point,r):#创建路径约束
+        #计算起点指向终点的向量
+        vector = np.array([end_point[0]- start_point[0], end_point[1]- start_point[1], end_point[2]- start_point[2]])
+        height = np.linalg.norm(vector)+0.006  #计算向量或矩阵的范数  用于度量向量或矩阵的大小或长度
+        radius = r
+        
+        # 位置约束
+        position_constraint = PositionConstraint()#创建点位约束
+        position_constraint.header.frame_id = "base_link"#此约束所指的机器人链接
+        position_constraint.link_name = self.end_effector_link
+        position_constraint.target_point_offset = Vector3(0, 0, 0)#目标点的偏移量
+        position_constraint.weight = 1.0#质量 OR 加权因子?
+
+
+        #构建 shape_msgs/SolidPrimitive 消息
+        bounding_volume = SolidPrimitive()
+        bounding_volume.type = SolidPrimitive.CYLINDER#圆柱
+        # bounding_volume.dimensions = [0.003,1]
+        bounding_volume.dimensions = [height,radius]#尺寸  高度 半径
+        position_constraint.constraint_region.primitives.append(bounding_volume)
+
+
+        #构建 geometry_msgs/Pose 消息,用于指定圆柱体在空间中的位置和姿态
+        pose = Pose()
+        pose.position.x = start_point[0] + vector[0] / 2#定义位置(找了个几何中心)
+        pose.position.y = start_point[1] + vector[1] / 2 
+        pose.position.z = start_point[2] + vector[2] / 2
+        # 计算圆柱体的姿态
+        z_axis = np.array([0, 0, 1])
+        axis = np.cross(z_axis, vector) #计算两个向量(向量数组)的叉乘  叉乘返回的数组既垂直于a,又垂直于b
+        angle = np.arccos(np.dot(z_axis, vector) / np.linalg.norm(vector))#反余弦求角度
+        q = tf.transformations.quaternion_about_axis(angle, axis)#通过旋转轴和旋转角返回四元数
+        pose.orientation.x = q[0]
+        pose.orientation.y = q[1]
+        pose.orientation.z = q[2]
+        pose.orientation.w = q[3]
+        position_constraint.constraint_region.primitive_poses.append(pose)
+
+        constraints = Constraints()#创建一个新的约束信息 
+        constraints.position_constraints.append(position_constraint)
+        # constraints.orientation_constraints.append(orientation_constraint)
+        return constraints
+    
+    def move_p_flexible(self,point,points,trajectory,trajectory_with_type,a=1,v=1):
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+        rrr=0.05#初始允许半径
+
+        
+        if trajectory:
+            #起点位置设置为规划组最后一个点
+            state = self.arm.get_current_state()
+            state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+            # 创建路径约束
+            path_constraints = self.create_path_constraints2(points[-1],point,rrr)#将最后一个点和输入的点(焊缝的起始点)做圆柱轨迹约束
+            self.arm.set_path_constraints(path_constraints)#设定约束
+            
+        else:
+            #起点位置设定为当前状态  按理来说是home点 
+            self.go_home()
+            self.home_pose=self.get_now_pose()
+            #rospy.loginfo(self.home_pose)
+            state = self.arm.get_current_state()
+            # 创建路径约束
+            path_constraints = self.create_path_constraints2(self.home_pose,point,rrr)#将当前的点和输入的点(焊缝的起始点)做圆柱轨迹约束
+            self.arm.set_path_constraints(path_constraints)#设定约束
+
+        self.arm.set_pose_target(point, self.end_effector_link)#设定目标点为传入的点
+        self.arm.set_start_state(state)#起点位置设置为规划组最后一个点 或者当前状态(第一个点时)
+        
+        
+        #当前起点规划次数
+        #尝试规划次数
+        b = 16 #尝试规划10次
+        for i in range(b):
+            traj = self.arm.plan()#调用plan进行规划
+            trajj = traj[1] #取出规划的信息
+            error,Limit_margin = check.check_joint_positions(trajj)#检查关节状态 就是检测规划的轨迹有没有“摇花手”
+            
+            if not error:#如果没有摇花手 接受规划
+                rospy.loginfo("本次移动 OK")
+                break
+            else: 
+                rospy.loginfo("移动规划失败-开始第{}次重新规划".format(i+1))
+                if i%2==0 and i!=0:#10次了都没成功 重新修改约束
+                    self.arm.clear_path_constraints()
+                    rrr=rrr+0.1#每次增加10厘米
+                    path_constraints = self.create_path_constraints2(self.home_pose,point,rrr)#将最后一个点和输入的点(焊缝的起始点)做圆柱轨迹约束
+                    self.arm.set_path_constraints(path_constraints)#设定约束
+
+        #规划失败
+        if error:
+            rospy.loginfo("{}次移动规划失败,进程终止".format(b))
+            sys.exit() 
+        #清除约束
+        self.arm.clear_path_constraints()
+        
+        trajj_with_type = mark_the_traj(trajj,"during-l",welding_sequence)
+        trajj_with_type.points[-len(trajj.joint_trajectory.points)].type = "start"  
+        trajj_with_type.points[-1].type = "end"      
+        trajectory_with_type.append(trajj_with_type)
+        points.append(point)
+        trajectory.append(trajj)    
+        return points,trajectory,trajectory_with_type
+    
+
+    # 测试程序用
+    def testRobot(self):
+        try:
+            rospy.loginfo("Test for robot...")
+           
+            file_path_result = os.path.join(folder_path, 'result.txt')
+            all_data = process_welding_data(file_path_result)
+
+            points,trajectory,trajectory_with_type = [],[],[]
+            for i in range(len(all_data)):
+                rospy.loginfo("共读取到%d条焊缝,开始规划第%d条",len(all_data),i+1)
+                start_point = all_data[i][0]
+                end_point = all_data[i][1]
+                q1 = all_data[i][2]
+                q2 = all_data[i][3]
+
+                point11 = [start_point[0]/1000, start_point[1]/1000, start_point[2]/1000, q1[0],q1[1],q1[2],q1[3]]
+                self.move_p(point11)
+                point22 = [end_point[0]/1000, end_point[1]/1000, end_point[2]/1000, q2[0],q2[1],q2[2],q2[3]]
+                self.move_p(point22)
+                rospy.loginfo("第%d条焊缝规划完毕",i+1)
+
+            # joint_position = [x * math.pi / 180 for x in [11.016, 3.716, -19.553, -5.375, -32.4173, 109.158]]
+            # self.move_j(joint_position)
+            # self.show_current_pose()
+            
+            print("Test OK")
+            rospy.sleep(1)
+            
+        except Exception as e:
+            print("Test fail! Exception:", str(e))
+            traceback.print_exc()
+        # except:
+        #     print("Test fail! ")
+
+    def show_current_pose(self):
+        # 获取机械臂当前位姿
+        current_pose = self.arm.get_current_pose(self.end_effector_link).pose
+        pose=[]
+        pose.append(current_pose.position.x)
+        pose.append(current_pose.position.y)
+        pose.append(current_pose.position.z)
+        pose.append(current_pose.orientation.x)
+        pose.append(current_pose.orientation.y)
+        pose.append(current_pose.orientation.z)
+        # 打印位姿信息
+
+        rospy.loginfo("Current Pose: {}".format(pose))
+
+    def set_scene(self):
+        rospy.loginfo("set scene")
+        ## set table
+        self.scene = PlanningSceneInterface()
+        self.scene_pub = rospy.Publisher('planning_scene', PlanningScene, queue_size=5)
+        self.colors = dict()
+        # rospy.sleep(1)
+        table_id = 'table'
+        self.scene.remove_world_object(table_id)
+        rospy.sleep(1)
+        table_size = [2, 2, 0.01]
+        table_pose = PoseStamped()
+        table_pose.header.frame_id = self.reference_frame
+        table_pose.pose.position.x = 0.0
+        table_pose.pose.position.y = 0.0
+        table_pose.pose.position.z = -table_size[2]/2
+        table_pose.pose.orientation.w = 1.0
+
+        box2_id = 'box2'
+        self.scene.remove_world_object(box2_id)
+        rospy.sleep(1)
+        box2_size = [0.01, 0.6, 0.4]
+        box2_pose = PoseStamped()
+        box2_pose.header.frame_id = self.reference_frame
+        box2_pose.pose.position.x = 1.15194-box2_size[0]/2-0.005
+        box2_pose.pose.position.y = -0.707656
+        box2_pose.pose.position.z = 0.4869005
+        box2_pose.pose.orientation.w = 1.0
+
+        box3_id = 'box3'
+        self.scene.remove_world_object(box3_id)
+        rospy.sleep(1)
+        box3_size = [0.2, 0.01, 0.4]
+        box3_pose = PoseStamped()
+        box3_pose.header.frame_id = self.reference_frame
+        box3_pose.pose.position.x = 1.15194+box3_size[0]/2
+        box3_pose.pose.position.y = -0.707656-box3_size[1]/2-0.005
+        box3_pose.pose.position.z = 0.4869005
+        box3_pose.pose.orientation.w = 1.0
+
+        # self.scene.add_box(table_id, table_pose, table_size)
+        # self.scene.add_box(box2_id, box2_pose, box2_size)
+        # self.scene.add_box(box3_id, box3_pose, box3_size)
+
+        self.setColor(table_id, 0.5, 0.5, 0.5, 1.0)
+        self.sendColors()
+
+        rospy.loginfo("set scene end")
+
+    def plan_cartesian_path(self,waypoints):
+        fraction = 0.0  # 路径规划覆盖率
+        maxtries = 100  # 最大尝试规划次数
+        attempts = 0  # 已经尝试规划次数
+
+        # 尝试规划一条笛卡尔空间下的路径,依次通过所有路点
+        while fraction < 1.0 and attempts < maxtries:
+            (plan, fraction) = self.arm.compute_cartesian_path(
+                waypoints,  # waypoint poses,路点列表
+                0.001,  # eef_step,终端步进值
+                0.0,  # jump_threshold,跳跃阈值
+                True)  # avoid_collisions,避障规划
+            attempts += 1
+        if fraction == 1.0:
+            rospy.loginfo("Path computed successfully.")
+            traj = plan
+        else:
+            rospy.loginfo(
+                "Path planning failed with only " + str(fraction) +
+                " success after " + str(maxtries) + " attempts.")   
+        return fraction,plan
+    
+    # 关节规划,输入6个关节角度(单位:弧度)
+    def move_j(self, joint_configuration=None,a=1,v=1):
+        # 设置机械臂的目标位置,使用六轴的位置数据进行描述(单位:弧度)
+        if joint_configuration==None:
+            joint_configuration = [0, -1.5707, 0, -1.5707, 0, 0]
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+        self.arm.set_joint_value_target(joint_configuration)
+        rospy.loginfo("move_j:"+str(joint_configuration))
+        self.arm.go()
+        rospy.sleep(1)
+
+    # 空间规划,输入xyzRPY
+    def move_p(self, tool_configuration=None,a=1,v=1):
+        if tool_configuration==None:
+            tool_configuration = [0.3,0,0.3,0,-np.pi/2,0]
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+
+        target_pose = PoseStamped()
+        target_pose.header.frame_id = 'base_link'
+        target_pose.header.stamp = rospy.Time.now()
+        target_pose.pose.position.x = tool_configuration[0]
+        target_pose.pose.position.y = tool_configuration[1]
+        target_pose.pose.position.z = tool_configuration[2]
+        if len(tool_configuration) == 6:
+            q = quaternion_from_euler(tool_configuration[3],tool_configuration[4],tool_configuration[5])
+            target_pose.pose.orientation.x = q[0]
+            target_pose.pose.orientation.y = q[1]
+            target_pose.pose.orientation.z = q[2]
+            target_pose.pose.orientation.w = q[3]
+        else:
+            target_pose.pose.orientation.x = tool_configuration[3]
+            target_pose.pose.orientation.y = tool_configuration[4]
+            target_pose.pose.orientation.z = tool_configuration[5]
+            target_pose.pose.orientation.w = tool_configuration[6]
+
+        self.arm.set_start_state_to_current_state()
+        self.arm.set_pose_target(target_pose, self.end_effector_link)
+        rospy.loginfo("move_p:" + str(tool_configuration))
+        traj = self.arm.plan()
+        path = traj[1]
+        # file_path = "/home/chen/catkin_ws/src/lstrobot_planning/date/p_traj.txt"
+        # if os.path.exists(file_path):
+        #     os.remove(file_path)
+        # with open(file_path, "w") as file:
+        #     file.write(str(path))
+        self.arm.execute(path)
+        # rospy.sleep(1)
+
+    def move_p2(self,point,points,trajectory,trajectory_with_type,a=1,v=1):
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+        # self.arm.set_start_state_to_current_state()
+        if trajectory:
+            state = self.arm.get_current_state()
+            state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+            self.arm.set_start_state(state)
+            
+        self.arm.set_pose_target(point, self.end_effector_link)
+        rospy.loginfo("move_p:" + str(point))
+        traj = self.arm.plan()
+        trajj = traj[1]
+        error_code =traj[3]
+        rospy.loginfo("Move to start point planned successfully")
+
+        trajj_with_type = mark_the_traj(trajj,"during-p",welding_sequence)
+                   
+        points.append(point)
+        trajectory.append(trajj)
+        trajectory_with_type.append(trajj_with_type)
+        return points,trajectory,trajectory_with_type
+    
+    def move_pl(self,point,points,trajectory,trajectory_with_type,a=1,v=1):
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+
+        #设定约束
+        if trajectory:
+            #起点位置设置为规划组最后一个点
+            state = self.arm.get_current_state()
+            state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+            self.arm.set_start_state(state)#起点位置设置为规划组最后一个点
+        
+        self.arm.set_pose_target(point, self.end_effector_link)#设定目标点为传入的点
+        
+        # 创建路径约束
+        path_constraints = self.create_path_constraints(points[-1],point)#将最后一个点和输入的点(焊缝的起始点)做圆柱轨迹约束
+        self.arm.set_path_constraints(path_constraints)#设定约束
+        
+        #当前起点规划次数
+        #尝试规划次数
+        b = 20 #最多尝试规划10次
+        for i in range(b):
+            traj = self.arm.plan()#调用plan进行规划
+            trajj = traj[1] #取出规划的信息
+            error,Limit_margin = check.check_joint_positions(trajj)#检查关节状态 就是检测规划的轨迹有没有“摇花手”
+            
+            if not error:#如果没有摇花手 接受规划
+                rospy.loginfo("本次焊缝规划 OK")
+                break
+            else: 
+                rospy.loginfo("焊缝规划失败-开始第{}次重新规划".format(i+1))
+                # if i%10==0 and i!=0:#10次了都没成功 将这个点用p2规划
+                #     prePoint = points.pop()#移除列表中最后一个元素  返回被移除的对象
+                #     trajectory.pop()
+                #     trajectory_with_type.pop()
+                #     #清除约束
+                #     self.arm.clear_path_constraints()
+                #     points,trajectory,trajectory_with_type = self.move_p2(prePoint,points,trajectory,trajectory_with_type)
+                #     rospy.loginfo("第{}次尝试使用p2".format((i/10)%1))
+
+        #规划失败
+        if error:
+            rospy.loginfo("{}次焊缝规划失败,进程终止".format(b))
+            sys.exit() 
+        #清除约束
+        self.arm.clear_path_constraints()
+
+        trajj_with_type = mark_the_traj(trajj,"during-l",welding_sequence)
+        trajj_with_type.points[-len(trajj.joint_trajectory.points)].type = "start"  
+        trajj_with_type.points[-1].type = "end"      
+        #如果调用了P2函数 那么这段代码不会导致重复添加?
+        points.append(point)
+        trajectory.append(trajj)
+        trajectory_with_type.append(trajj_with_type)
+        return points,trajectory,trajectory_with_type
+
+    def create_path_constraints(self,start_point,end_point):
+        #计算起点指向终点的向量
+        vector = np.array([end_point[0]- start_point[0], end_point[1]- start_point[1], end_point[2]- start_point[2]])
+        height = np.linalg.norm(vector)+0.002
+        radius = 0.001
+
+        constraints = Constraints()
+        
+        # 位置约束
+        position_constraint = PositionConstraint()
+        position_constraint.header.frame_id = "base_link"
+        position_constraint.link_name = self.end_effector_link
+        position_constraint.target_point_offset = Vector3(0, 0, 0)
+        #构建 shape_msgs/SolidPrimitive 消息
+        bounding_volume = SolidPrimitive()
+        bounding_volume.type = SolidPrimitive.CYLINDER
+        # bounding_volume.dimensions = [0.003,1]
+        bounding_volume.dimensions = [height,radius]
+        #构建 geometry_msgs/Pose 消息,用于指定圆柱体在空间中的位置和姿态
+        pose = Pose()
+        pose.position.x = start_point[0] + vector[0] / 2
+        pose.position.y = start_point[1] + vector[1] / 2 
+        pose.position.z = start_point[2] + vector[2] / 2
+        
+        # 计算圆柱体的旋转矩阵
+        z_axis = np.array([0, 0, 1])
+        axis = np.cross(z_axis, vector)
+        angle = np.arccos(np.dot(z_axis, vector) / np.linalg.norm(vector))
+        q = tf.transformations.quaternion_about_axis(angle, axis)
+        pose.orientation.x = q[0]
+        pose.orientation.y = q[1]
+        pose.orientation.z = q[2]
+        pose.orientation.w = q[3]
+
+        position_constraint.constraint_region.primitives.append(bounding_volume)
+        position_constraint.constraint_region.primitive_poses.append(pose)
+        position_constraint.weight = 1.0
+
+        # 姿态约束
+        # orientation_constraint = OrientationConstraint()
+        # orientation_constraint.header.frame_id = "base_link"
+        # orientation_constraint.link_name = self.end_effector_link
+        # orientation_constraint.orientation = target_pose.orientation
+        # orientation_constraint.absolute_x_axis_tolerance = 0.01
+        # orientation_constraint.absolute_y_axis_tolerance = 0.01
+        # orientation_constraint.absolute_z_axis_tolerance = 0.01
+        # orientation_constraint.weight = 1.0
+
+        constraints.position_constraints.append(position_constraint)
+        # constraints.orientation_constraints.append(orientation_constraint)
+
+        return constraints
+
+    
+    def move_l(self, tool_configuration,waypoints_number=1,a=0.5,v=0.5):
+        if tool_configuration==None:
+            tool_configuration = [0.3,0,0.3,0,-np.pi/2,0]
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+
+        # 设置路点
+        waypoints = []
+        for i in range(waypoints_number):
+            target_pose = PoseStamped()
+            target_pose.header.frame_id = self.reference_frame
+            target_pose.header.stamp = rospy.Time.now()
+            target_pose.pose.position.x = tool_configuration[6*i+0]
+            target_pose.pose.position.y = tool_configuration[6*i+1]
+            target_pose.pose.position.z = tool_configuration[6*i+2]
+            q = quaternion_from_euler(tool_configuration[6*i+3],tool_configuration[6*i+4],tool_configuration[6*i+5])
+            target_pose.pose.orientation.x = q[0]
+            target_pose.pose.orientation.y = q[1]
+            target_pose.pose.orientation.z = q[2]
+            target_pose.pose.orientation.w = q[3]
+            waypoints.append(target_pose.pose)
+        rospy.loginfo("move_l:" + str(tool_configuration))
+        self.arm.set_start_state_to_current_state()
+        fraction = 0.0  # 路径规划覆盖率
+        maxtries = 100  # 最大尝试规划次数
+        attempts = 0  # 已经尝试规划次数
+
+        # 设置机器臂当前的状态作为运动初始状态
+        self.arm.set_start_state_to_current_state()
+
+        # 尝试规划一条笛卡尔空间下的路径,依次通过所有路点
+        while fraction < 1.0 and attempts < maxtries:
+            (plan, fraction) = self.arm.compute_cartesian_path(
+                waypoints,  # waypoint poses,路点列表
+                0.001,  # eef_step,终端步进值
+                0.00,  # jump_threshold,跳跃阈值
+                True)  # avoid_collisions,避障规划
+            attempts += 1
+        if fraction == 1.0:
+            rospy.loginfo("Path computed successfully. Moving the arm.")
+            self.arm.execute(plan)
+            rospy.loginfo("Path execution complete.")
+        else:
+            rospy.loginfo(
+                "Path planning failed with only " + str(fraction) +
+                " success after " + str(maxtries) + " attempts.")
+        rospy.sleep(1)
+
+    def move_l22(self,point,points,trajectory,trajectory_with_type,a=0.5,v=0.5):
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+
+        if trajectory:
+            state = self.arm.get_current_state()
+            state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+            self.arm.set_start_state(state)
+        
+        start_rotation_angle,end_rotation_angle = 0,0
+        new_start_pose,new_end_pose = 0,0
+        num_planed = 0
+        while not start_rotation_angle == 2*pi:
+            waypoints = []
+            target_pose = point_to_PoseStamped(point,self.reference_frame)
+            waypoints.append(target_pose.pose)
+            rospy.loginfo("move_l2:" )
+        
+            num_remake = 2
+            for _ in range(num_remake):
+                num_planed +=1
+                rospy.loginfo("第{}次规划".format(num_planed))
+                rospy.loginfo("new_start_pose:{} new_end_pose:{}".format(new_start_pose,new_end_pose))
+                fraction,traj = self.plan_cartesian_path(waypoints)
+                if fraction == 1:
+                    error,percentage = check.check_joint_positions(traj)
+                    if not error:
+                        break
+            if fraction != 1:
+                break
+            error,percentage = check.check_joint_positions(traj)
+            if error:
+                #三次重规划结束,仍然不符合,插点或转点
+                angle_list = ([0,pi/4,-pi/4,pi/2,-pi/2,pi*3/4,-pi*3/4,pi,2*pi])
+                if start_rotation_angle < pi: 
+                    if end_rotation_angle < pi:
+                        index = angle_list.index(end_rotation_angle)
+                        end_rotation_angle = angle_list[index+1]
+                        new_end_pose = check.angle_adjustment(point,'z', start_rotation_angle)  # 将目标位姿旋转一定角度
+                        point = new_end_pose # 将新的点替换原来位姿
+                    else:
+                        index = angle_list.index(start_rotation_angle)
+                        start_rotation_angle = angle_list[index+1]
+                        new_start_pose = check.angle_adjustment(points[-1],'z', start_rotation_angle)  # 将目标位姿旋转一定角度
+                        #go home,plan p
+                        state = self.arm.get_current_state()
+                        state.joint_state.position = trajectory[-1].joint_trajectory.points[0].positions
+                        self.arm.set_start_state(state)
+                        del points[-1]
+                        del trajectory[-1]
+                        points,trajectory,trajectory_with_type = self.move_p2(new_start_pose,points,trajectory,trajectory_with_type)
+                        state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+                        self.arm.set_start_state(state)
+                        
+                        end_rotation_angle = 0
+  
+            else:
+                break
+        if fraction != 1:
+            rospy.loginfo("Plan Fail,Error code 1")
+            sys.exit() 
+        elif error:
+            rospy.loginfo("Plan Fail,Error code 2")
+            sys.exit()
+        else:
+            traj_with_type = mark_the_traj(traj,"during-l",welding_sequence)
+            traj_with_type.points[-len(traj.joint_trajectory.points)].type = "start"  
+            traj_with_type.points[-1].type = "end"         
+            
+            points.append(point)
+            trajectory.append(traj)
+            trajectory_with_type.append(traj_with_type) 
+            return points,trajectory,trajectory_with_type
+        
+    def go_home(self,a=1,v=1):
+        rospy.loginfo("go_home start")
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+        # “up”为自定义姿态,你可以使用“home”或者其他姿态
+        self.arm.set_named_target('home')
+        self.arm.go()
+        rospy.loginfo("go_home end")
+        # rospy.sleep(1)
+    
+    def go_home_justplan(self,trajectory,trajectory_with_type,a=1,v=1):
+        self.arm.set_max_acceleration_scaling_factor(a)
+        self.arm.set_max_velocity_scaling_factor(v)
+        # “up”为自定义姿态,你可以使用“home”或者其他姿态
+        state = self.arm.get_current_state()
+        state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+        self.arm.set_start_state(state)
+        self.arm.set_named_target('home')
+        traj = self.arm.plan()
+        trajj = traj[1]
+        traj_with_type = mark_the_traj(trajj,"go-home",welding_sequence)
+        trajectory.append(trajj)
+        trajectory_with_type.append(traj_with_type)
+        return trajectory,trajectory_with_type
+    
+    def setColor(self, name, r, g, b, a=0.9):
+        # 初始化moveit颜色对象
+        color = ObjectColor()
+        # 设置颜色值
+        color.id = name
+        color.color.r = r
+        color.color.g = g
+        color.color.b = b
+        color.color.a = a
+        # 更新颜色字典
+        self.colors[name] = color
+
+    # 将颜色设置发送并应用到moveit场景当中
+    def sendColors(self):
+        # 初始化规划场景对象
+        p = PlanningScene()
+        # 需要设置规划场景是否有差异
+        p.is_diff = True
+        # 从颜色字典中取出颜色设置
+        for color in self.colors.values():
+            p.object_colors.append(color)
+        # 发布场景物体颜色设置
+        self.scene_pub.publish(p)
+
+    def path_planning(self,folder_path,gohome=True):
+        file_path_result = os.path.join(folder_path, 'result.txt')
+        all_data = process_welding_data(file_path_result)
+
+        points,trajectory,trajectory_with_type = [],[],[]
+        for i in range(len(all_data)):
+            rospy.loginfo("共读取到%d条焊缝,开始规划第%d条",len(all_data),i+1)
+            start_point = all_data[i][0]
+            end_point = all_data[i][1]
+            q1 = all_data[i][2]
+            q2 = all_data[i][3]
+
+            point11 = [start_point[0]/1000, start_point[1]/1000, start_point[2]/1000, q1[0],q1[1],q1[2],q1[3]]
+            points,trajectory,trajectory_with_type = self.move_p_flexible(point11,points,trajectory,trajectory_with_type)
+            point22 = [end_point[0]/1000, end_point[1]/1000, end_point[2]/1000, q2[0],q2[1],q2[2],q2[3]]
+            points,trajectory,trajectory_with_type = self.move_pl(point22,points,trajectory,trajectory_with_type)
+            rospy.loginfo("第%d条焊缝规划完毕",i+1)
+        if gohome:
+            points,trajectory,trajectory_with_type = self.move_p_flexible(self.home_pose,points,trajectory,trajectory_with_type)
+            trajectory,trajectory_with_type = self.go_home_justplan(trajectory,trajectory_with_type)
+        traj_merge= merge_trajectories(trajectory)
+        trajectory_with_type_merge= merge_trajectories_with_type(trajectory_with_type)
+        rospy.loginfo("All of The trajectory Plan successfully")
+        return trajectory,traj_merge,trajectory_with_type_merge
+    def path_planning_test(self,folder_path,i,reverse=False,gohome=True):
+        file_path_result = os.path.join(folder_path, 'result.txt')
+        all_data = process_welding_data(file_path_result)
+
+        points,trajectory,trajectory_with_type = [],[],[]
+        i -= 1
+        rospy.loginfo("共读取到%d条焊缝,开始规划第%d条",len(all_data),i+1)
+        start_point = all_data[i][0]
+        end_point = all_data[i][1]
+        q1 = all_data[i][2]
+        q2 = all_data[i][3]
+        if reverse:
+            start_point = all_data[i][1]
+            end_point = all_data[i][0]
+            q1 = all_data[i][3]
+            q2 = all_data[i][2]
+
+        point11 = [start_point[0]/1000, start_point[1]/1000, start_point[2]/1000, q1[0],q1[1],q1[2],q1[3]]
+        points,trajectory,trajectory_with_type = self.move_p2(point11,points,trajectory,trajectory_with_type)
+        point22 = [end_point[0]/1000, end_point[1]/1000, end_point[2]/1000, q2[0],q2[1],q2[2],q2[3]]
+        points,trajectory,trajectory_with_type = self.move_pl(point22,points,trajectory,trajectory_with_type)
+        rospy.loginfo("第%d条焊缝规划完毕",i+1)
+        if gohome:
+            trajectory,trajectory_with_type = self.go_home_justplan(trajectory,trajectory_with_type)
+        traj_merge= merge_trajectories(trajectory)
+        trajectory_with_type_merge= merge_trajectories_with_type(trajectory_with_type)
+        rospy.loginfo("All of The trajectory Plan successfully")
+        return trajectory,traj_merge,trajectory_with_type_merge
+def point_to_PoseStamped(point,reference_frame):
+    target_pose = PoseStamped()
+    target_pose.header.frame_id = reference_frame
+    target_pose.header.stamp = rospy.Time.now()
+    target_pose.pose.position.x = point[0]
+    target_pose.pose.position.y = point[1]
+    target_pose.pose.position.z = point[2]
+    if len(point) == 6:
+        q = quaternion_from_euler(point[3],point[4],point[5])
+        target_pose.pose.orientation.x = q[0]
+        target_pose.pose.orientation.y = q[1]
+        target_pose.pose.orientation.z = q[2]
+        target_pose.pose.orientation.w = q[3]
+    else:
+        target_pose.pose.orientation.x = point[3]
+        target_pose.pose.orientation.y = point[4]
+        target_pose.pose.orientation.z = point[5]
+        target_pose.pose.orientation.w = point[6]
+
+    return target_pose
+def calculate_waypoints(start_pose,end_pose,spacing):
+    start_position = np.array([start_pose.pose.position.x, start_pose.pose.position.y, start_pose.pose.position.z])
+    start_orientation = euler_from_quaternion([start_pose.pose.orientation.x,start_pose.pose.orientation.y,start_pose.pose.orientation.z,start_pose.pose.orientation.w])
+    end_position = np.array([end_pose.pose.position.x, end_pose.pose.position.y, end_pose.pose.position.z])
+    end_orientation = euler_from_quaternion([end_pose.pose.orientation.x,end_pose.pose.orientation.y,end_pose.pose.orientation.z,end_pose.pose.orientation.w])
+
+
+    distance = np.linalg.norm(np.array(end_position) - np.array(start_position))
+    num_points = int(distance/spacing)
+    trajectory = []
+    for i in range(num_points + 1):
+        alpha = float(i) / num_points
+        position = [start + alpha * (end - start) for start, end in zip(start_position, end_position)]
+        orientation = [start + alpha * (end - start) for start, end in zip(start_orientation, end_orientation)]
+        trajectory.append(position + orientation)
+
+    return trajectory,num_points + 1
+ 
+def process_welding_data(filename):
+    all_data = []  # 用来存储每一行处理后的数据
+    with open(filename, 'r') as file:
+        for line in file:
+            parts = line.strip().split('/')
+            coordinates_and_poses = [part.split(',') for part in parts[1:]]
+            
+            start_point = tuple(map(float, coordinates_and_poses[0][:3]))  # 使用元组以避免修改
+            end_point = tuple(map(float, coordinates_and_poses[1][:3]))
+            q1 = tuple(map(float, coordinates_and_poses[2][:4]))
+            q2 = tuple(map(float, coordinates_and_poses[3][:4]))
+            
+            # 收集每行处理后的数据
+            all_data.append((start_point, end_point, q1, q2))
+
+    return all_data
+
+def mark_the_traj(traj,TYPE,SEQUENCE):
+    traj_with_type = JointTrajectory_ex()
+    traj_with_type.header = traj.joint_trajectory.header
+    traj_with_type.joint_names = traj.joint_trajectory.joint_names
+    traj_with_type.points = [
+        JointTrajectoryPoint_ex(
+            positions=point.positions,
+            velocities=point.velocities,
+            accelerations=point.accelerations,
+            effort=point.effort,
+            type=TYPE,
+            sequence=SEQUENCE
+        ) for point in traj.joint_trajectory.points
+    ]
+    return traj_with_type
+def merge_trajectories(trajectories):
+    if not trajectories:
+        return None
+    
+    # 创建一个新的 JointTrajectory 对象
+    merged_trajectory = JointTrajectory()
+    merged_trajectory.header = trajectories[0].joint_trajectory.header
+    merged_trajectory.joint_names = trajectories[0].joint_trajectory.joint_names
+    
+    # 初始化时间累加器
+    last_time_from_start = rospy.Duration(0)
+    
+    # 合并所有 trajectories 的 points
+    for traj in trajectories:
+
+        for point in traj.joint_trajectory.points:
+            # 创建新的轨迹点
+            new_point = deepcopy(point)
+            # 累加时间
+            new_point.time_from_start += last_time_from_start
+            merged_trajectory.points.append(new_point)
+        
+        # 更新时间累加器为当前轨迹的最后一个点的时间
+        if traj.joint_trajectory.points:
+            last_time_from_start = traj.joint_trajectory.points[-1].time_from_start + last_time_from_start
+    
+    return merged_trajectory
+def merge_trajectories_with_type(trajectory_with_type):
+    if not trajectory_with_type:
+        return None
+    
+    # 创建一个新的 JointTrajectory 对象
+    merged_trajectory_with_type = JointTrajectory_ex()
+    merged_trajectory_with_type.header = trajectory_with_type[0].header
+    merged_trajectory_with_type.joint_names = trajectory_with_type[0].joint_names
+    
+    # 初始化时间累加器
+    last_time_from_start = rospy.Duration(0)
+    
+    # 合并所有 trajectories 的 points
+    for traj in trajectory_with_type:
+
+        for point in traj.points:
+            # 创建新的轨迹点
+            new_point = deepcopy(point)
+            # 累加时间
+            new_point.time_from_start += last_time_from_start
+            merged_trajectory_with_type.points.append(new_point)
+        
+        # 更新时间累加器为当前轨迹的最后一个点的时间
+        if traj.points:
+            last_time_from_start = traj.points[-1].time_from_start + last_time_from_start
+    
+    return merged_trajectory_with_type
+def pub_trajectories(trajectory_with_type_merge):
+   
+    pub = rospy.Publisher("/joint_path", JointTrajectory_ex, queue_size=5)
+    count = 1
+    rate = rospy.Rate(1)
+    rospy.loginfo("正在发布轨迹信息..")
+    while not rospy.is_shutdown():
+        #轨迹接受完毕,关闭当前发布
+        sign_traj_accepted = str(rospy.get_param("sign_traj_accepted"))
+        if sign_traj_accepted == "1":
+            rospy.set_param("sign_traj_accepted",0)
+            break
+
+        pub.publish(trajectory_with_type_merge)
+        # rospy.loginfo("发布计数,count = %d",count)
+        # count += 1
+        rate.sleep()
+
+if __name__ =="__main__":
+
+    folder_path = rospy.get_param("folder_path")
+    moveit_server = MoveIt_Control(is_use_gripper=False)
+    moveit_server.arm.set_num_planning_attempts(10)
+    
+    #获取规划信息,并规划
+    # folder_path = ("/home/chen/catkin_ws/data/0412")
+    welding_sequence = rospy.get_param('welding_sequence')
+    trajectory,trajectory_merge,trajectory_with_type_merge = moveit_server.path_planning(folder_path)
+    # trajectory,trajectory_merge,trajectory_with_type_merge = moveit_server.path_planning_test(folder_path,1,True)
+    #执行动作
+    moveit_server.arm.execute(trajectory_merge)
+    
+    # for i in range(1 * 2 - 0): #执行到第i条焊缝
+    #     moveit_server.arm.execute(trajectory[i])
+    
+    #发布规划完毕的轨迹信息
+    pub_trajectories(trajectory_with_type_merge)

+ 115 - 0
catkin_ws/src/lstrobot_planning/scripts/set_update_paramter_p.py

@@ -0,0 +1,115 @@
+#! /usr/bin/env python3
+import rospy
+import os
+import hanqiangpose
+import command
+import subprocess
+import hjsx
+import threading
+import numpy as np
+import multiprocessing
+from moveit_msgs.msg import PlanningScene
+from dynamic_reconfigure.client import Client
+from rospy.exceptions import ROSException
+from std_srvs.srv import Empty
+from rospy.service import ServiceException
+
+waited_once = False
+
+def wait_for_topic(topic_name, message_type):
+    try:
+        rospy.loginfo("等待场景地图加载完毕...")
+        message = rospy.wait_for_message(topic_name, message_type, timeout=None)
+        rospy.loginfo(f"场景地图已加载完毕")
+        return message
+    except rospy.ROSException as e:
+        rospy.logerr(f"等待话题 {topic_name} 时程序被中断: {e}")
+        return None
+    
+def clear_octomap():
+    try:
+        clear_octomap_service = rospy.ServiceProxy('/clear_octomap', Empty)  # 创建服务代理
+        clear_octomap_service()  # 尝试调用服务
+        rospy.loginfo("Octomap has been cleared.")
+    except ServiceException as e:
+        rospy.loginfo("Failed to call /clear_octomap service or it is not available. Skipping operation.")
+
+if __name__ == "__main__":
+    rospy.init_node("set_update_paramter_p")
+
+    # 初始化各种类型参数
+    rospy.set_param("sequence_ready",0)
+    rospy.set_param("sign_control",0)
+    rospy.set_param("sign_pointcloud",0)
+    rospy.set_param("sign_traj_accepted",0)
+    rospy.set_param("yaw",np.pi/6)  #内收角(偏航角)
+    rospy.set_param("yaw_rate",100) #偏航角过渡速度(角度变化45度/100mm)
+    rospy.set_param("pitch_of_Horizontalweld",np.pi/4)  #和底面夹角(俯仰角)
+    rospy.set_param("pitch_of_Verticalweld",np.pi/5)
+    rospy.set_param("planner_id","RRTConnect")
+    rospy.set_param("pointcloud_topic","/pointcloud/output")
+    rospy.set_param("culling_radius",7) #焊缝剔除半径
+    # rospy.set_param("/move_group/octomap_resolution",0.006)
+    rospy.set_param("folder_path","/home/chen/catkin_ws/src/publish_pointcloud/publish_pointcloud/data")
+
+    # 显示参数当前值
+    sign_pointcloud = rospy.get_param("sign_pointcloud")
+
+    rospy.loginfo("当前参数值:")
+    rospy.loginfo("sign_pointcloud = %s",sign_pointcloud)
+    rospy.loginfo("yaw = %s",rospy.get_param("yaw")/np.pi*180)
+    rospy.loginfo("pitch_of_Horizontalweld = %s",rospy.get_param("pitch_of_Horizontalweld")/np.pi*180)
+    rospy.loginfo("pitch_of_Verticalweld = %s",rospy.get_param("pitch_of_Verticalweld")/np.pi*180)
+    while True:
+        sign_control = str(rospy.get_param("sign_control"))
+        if sign_control == "0":
+            if not waited_once:
+                print("等待点云数据准备完成...")
+                waited_once = True
+        elif sign_control == "1":
+            # 初始化参数
+            rospy.set_param("sign_control",0)
+            rospy.set_param("sign_traj_accepted",0)
+            
+            # 获取新的文件夹值
+            new_folder_path = rospy.get_param("folder_path")
+            rospy.loginfo("folder_path:%s",new_folder_path)
+            
+            # 清除场景
+            clear_octomap()
+
+            rospy.loginfo("launch pointcloud node now")
+            process = multiprocessing.Process(target=command.launch_publish_pointcloud_background)
+            # 启动子进程
+            process.start()
+            # command.launch_publish_pointcloud()
+
+            hjsx.run()
+            hanqiangpose.run()
+
+            # 等待 /move_group/monitored_planning_scene 话题发布消息
+            planning_scene = wait_for_topic('/move_group/monitored_planning_scene', PlanningScene)
+            rospy.set_param("sign_pointcloud",1)
+            rospy.loginfo("终止点云发布,关闭发布窗口")
+            
+            rospy.loginfo("launch moveitserver node now")
+            process = multiprocessing.Process(target=command.launch_moveit_control_server_background)
+            process.start()
+            
+            #运行结束,重置参数
+            waited_once = False
+ 
+        elif sign_control == "2":
+            # 重置参数
+            rospy.set_param("sign_control",0)
+
+            rospy.set_param("planner_id","BiEST")
+            rospy.loginfo("launch moveitserver node now")
+            process = multiprocessing.Process(target=command.launch_moveit_control_server_background)
+            process.start()
+            rospy.set_param("planner_id","RRTConnect")
+            #运行结束,重置参数
+            waited_once = False
+        
+
+    

+ 79 - 0
catkin_ws/src/lstrobot_planning/src/add_octomap.cpp

@@ -0,0 +1,79 @@
+#include <ros/ros.h>
+#include <moveit/move_group_interface/move_group_interface.h>
+#include <moveit/planning_scene_interface/planning_scene_interface.h>
+#include <octomap_msgs/Octomap.h>
+#include <octomap_msgs/conversions.h>
+#include <octomap/OcTree.h>
+
+void appendScene(const std::string& octoFile)
+{
+    ros::NodeHandle nh("~");
+
+    // 创建 MoveIt MoveGroup Interface
+    moveit::planning_interface::MoveGroupInterface group("manipulator");
+    std::string frameId = group.getPlanningFrame();
+
+    // 从文件加载 OctoMap
+    octomap::OcTree* octree = new octomap::OcTree(octoFile);
+
+    // 将 Octomap 数据转换为 ROS 消息
+    octomap_msgs::Octomap octomap_msg;
+    if (!octomap_msgs::fullMapToMsg(*octree, octomap_msg))
+    {
+        ROS_ERROR("Failed to convert Octomap to ROS message.");
+        return;
+    }
+
+    // 创建 PlanningSceneInterface 实例
+    moveit::planning_interface::PlanningSceneInterface psi;
+
+    // 创建 PlanningScene 消息
+    moveit_msgs::PlanningScene planning_scene_msg;
+    planning_scene_msg.is_diff = true;
+
+    // 设置 Octomap 的相关信息
+    planning_scene_msg.world.octomap.header.frame_id = "base_link";
+    planning_scene_msg.world.octomap.octomap = octomap_msg;
+
+    // 设置Octomap的原点位置
+    // planning_scene_msg.world.octomap.origin.position.x = 0.0;
+    // planning_scene_msg.world.octomap.origin.position.y = 0.0;
+    // planning_scene_msg.world.octomap.origin.position.z = 0.0;
+
+    // // 设置有效的四元数
+    // planning_scene_msg.world.octomap.origin.orientation.x = 0.0;
+    // planning_scene_msg.world.octomap.origin.orientation.y = 0.0;
+    // planning_scene_msg.world.octomap.origin.orientation.z = 0.0;
+    // planning_scene_msg.world.octomap.origin.orientation.w = 1.0;
+
+    planning_scene_msg.world.octomap.header.stamp = ros::Time::now();
+
+    // 将 PlanningScene 消息应用到 MoveIt 中
+    psi.applyPlanningScene(planning_scene_msg);
+
+    delete octree; // 释放内存
+}
+
+int main(int argc, char **argv)
+{
+    ros::init(argc, argv, "append_scene_node");
+    ros::NodeHandle nh;
+
+    // 检查是否传入了OctoMap文件名参数
+    if (argc < 2)
+    {
+        ROS_ERROR("Usage: %s [octomap_file]", argv[0]);
+        return 1;
+    }
+
+    std::string octoFile = argv[1];
+
+    appendScene(octoFile);
+
+    // 确保所有更改都已发送给MoveIt!
+    ros::Duration(1.0).sleep(); // 等待一段时间以确保消息被处理
+
+    ROS_INFO("Planning scene updated with OctoMap.");
+
+    return 0;
+}

+ 148 - 0
catkin_ws/src/lstrobot_planning/src/moveit_cartesian_demo.py

@@ -0,0 +1,148 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import rospy, sys
+import moveit_commander
+from moveit_commander import MoveGroupCommander
+from geometry_msgs.msg import Pose
+from copy import deepcopy
+ 
+class MoveItCartesianDemo:
+    def __init__(self):
+ 
+        # 初始化move_group的API
+        moveit_commander.roscpp_initialize(sys.argv)
+ 
+        # 初始化ROS节点
+        rospy.init_node('moveit_cartesian_demo', anonymous=True)
+ 
+        # 是否需要使用笛卡尔空间的运动规划,获取参数,如果没有设置,则默认为True,即走直线
+        cartesian = rospy.get_param('~cartesian', True)
+                      
+        # 初始化需要使用move group控制的机械臂中的arm group
+        arm = MoveGroupCommander('manipulator')
+        
+        # 当运动规划失败后,允许重新规划
+        arm.allow_replanning(True)
+        
+        # 设置目标位置所使用的参考坐标系
+        arm.set_pose_reference_frame('base_link')
+                
+        # 设置位置(单位:米)和姿态(单位:弧度)的允许误差
+        arm.set_goal_position_tolerance(0.001)
+        arm.set_goal_orientation_tolerance(0.001)
+        
+        # 设置允许的最大速度和加速度
+        arm.set_max_acceleration_scaling_factor(0.5)
+        arm.set_max_velocity_scaling_factor(0.5)
+        
+        # 获取终端link的名称
+        end_effector_link = arm.get_end_effector_link()
+ 
+        # 控制机械臂先回到初始化位置
+        arm.set_named_target('home')
+        arm.go()
+        rospy.sleep(1)
+                                               
+        # 获取当前位姿数据最为机械臂运动的起始位姿
+        start_pose = arm.get_current_pose(end_effector_link).pose
+                
+        # 初始化路点列表
+        waypoints = []
+ 
+        # 如果为True,将初始位姿加入路点列表
+        if cartesian:
+            waypoints.append(start_pose)
+            
+        # 设置路点数据,并加入路点列表,所有的点都加入
+        wpose = deepcopy(start_pose)#拷贝对象
+        wpose.position.z -= 0.2
+ 
+        if cartesian:  #如果设置为True,那么走直线
+            waypoints.append(deepcopy(wpose))
+        else:          #否则就走曲线
+            arm.set_pose_target(wpose)  #自由曲线
+            arm.go()
+            rospy.sleep(1)
+ 
+        wpose.position.x += 0.15
+ 
+        if cartesian:
+            waypoints.append(deepcopy(wpose))
+        else:
+            arm.set_pose_target(wpose)
+            arm.go()
+            rospy.sleep(1)
+        
+        wpose.position.y += 0.1
+ 
+        if cartesian:
+            waypoints.append(deepcopy(wpose))
+        else:
+            arm.set_pose_target(wpose)
+            arm.go()
+            rospy.sleep(1)
+ 
+        wpose.position.x -= 0.15
+        wpose.position.y -= 0.1
+ 
+        if cartesian:
+            waypoints.append(deepcopy(wpose))
+        else:
+            arm.set_pose_target(wpose)
+            arm.go()
+            rospy.sleep(1)
+ 
+ 
+        #规划过程
+ 
+        if cartesian:
+		fraction = 0.0   #路径规划覆盖率
+		maxtries = 100   #最大尝试规划次数
+		attempts = 0     #已经尝试规划次数
+		
+		# 设置机器臂当前的状态作为运动初始状态
+		arm.set_start_state_to_current_state()
+	 
+		# 尝试规划一条笛卡尔空间下的路径,依次通过所有路点
+		while fraction < 1.0 and attempts < maxtries:
+        #规划路径 ,fraction返回1代表规划成功
+		    (plan, fraction) = arm.compute_cartesian_path (
+		                            waypoints,   # waypoint poses,路点列表,这里是5个点
+		                            0.01,        # eef_step,终端步进值,每隔0.01m计算一次逆解判断能否可达
+		                            0.0,         # jump_threshold,跳跃阈值,设置为0代表不允许跳跃
+		                            True)        # avoid_collisions,避障规划
+		    
+		    # 尝试次数累加
+		    attempts += 1
+		    
+		    # 打印运动规划进程
+		    if attempts % 10 == 0:
+		        rospy.loginfo("Still trying after " + str(attempts) + " attempts...")
+		             
+		# 如果路径规划成功(覆盖率100%),则开始控制机械臂运动
+		if fraction == 1.0:
+		    rospy.loginfo("Path computed successfully. Moving the arm.")
+		    arm.execute(plan)
+		    rospy.loginfo("Path execution complete.")
+		# 如果路径规划失败,则打印失败信息
+		else:
+		    rospy.loginfo("Path planning failed with only " + str(fraction) + " success after " + str(maxtries) + " attempts.")  
+ 
+		rospy.sleep(1)
+ 
+        # 控制机械臂先回到初始化位置
+        arm.set_named_target('home')
+        arm.go()
+        rospy.sleep(1)
+        
+        # 关闭并退出moveit
+        moveit_commander.roscpp_shutdown()
+        moveit_commander.os._exit(0)
+ 
+if __name__ == "__main__":
+    try:
+        MoveItCartesianDemo()
+    except rospy.ROSInterruptException:
+        pass
+

+ 44 - 0
catkin_ws/src/lstrobot_planning/src/pcd2octomap.cpp

@@ -0,0 +1,44 @@
+#include <iostream>
+#include <assert.h>
+
+//pcl
+#include <pcl/io/pcd_io.h>
+#include <pcl/point_types.h>
+
+//octomap
+#include <octomap/octomap.h>
+using namespace std;
+
+int main( int argc, char** argv )
+{
+    if (argc != 3)
+    {
+        cout<<"Usage: pcd2octomap <input_file> <output_file>"<<endl;
+        return -1;
+    }
+
+    string input_file = argv[1], output_file = argv[2];
+    pcl::PointCloud<pcl::PointXYZ> cloud;
+    pcl::io::loadPCDFile<pcl::PointXYZ> ( input_file, cloud );
+
+    cout<<"point cloud loaded, piont size = "<<cloud.points.size()<<endl;
+
+    //声明octomap变量
+    cout<<"copy data into octomap..."<<endl;
+    // 创建八叉树对象,参数为分辨率,这里设成了0.05
+    octomap::OcTree tree( 0.005 );
+
+    for (auto p:cloud.points)
+    {
+        // 将点云里的点插入到octomap中
+        tree.updateNode( octomap::point3d(p.x, p.y, p.z), true );
+    }
+
+    // 更新octomap
+    tree.updateInnerOccupancy();
+    // 存储octomap
+    tree.writeBinary( output_file );
+    cout<<"done."<<endl;
+
+    return 0;
+}

+ 14 - 0
catkin_ws/src/mr12urdf20240605/CMakeLists.txt

@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 2.8.3)
+
+project(mr12urdf20240605)
+
+find_package(catkin REQUIRED)
+
+catkin_package()
+
+find_package(roslaunch)
+
+foreach(dir config launch meshes urdf)
+	install(DIRECTORY ${dir}/
+		DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
+endforeach(dir)

+ 1 - 0
catkin_ws/src/mr12urdf20240605/config/joint_names_mr12urdf20240605.yaml

@@ -0,0 +1 @@
+controller_joint_names: ['', 'joint1', 'joint2', 'joint3', 'joint4', 'joint5', 'joint6', ]

+ 20 - 0
catkin_ws/src/mr12urdf20240605/launch/display.launch

@@ -0,0 +1,20 @@
+<launch>
+  <arg
+    name="model" />
+  <param
+    name="robot_description"
+    textfile="$(find mr12urdf20240605)/urdf/mr12urdf20240605.urdf" />
+  <node
+    name="joint_state_publisher_gui"
+    pkg="joint_state_publisher_gui"
+    type="joint_state_publisher_gui" />
+  <node
+    name="robot_state_publisher"
+    pkg="robot_state_publisher"
+    type="robot_state_publisher" />
+  <node
+    name="rviz"
+    pkg="rviz"
+    type="rviz"
+    args="-d $(find mr12urdf20240605)/urdf.rviz" />
+</launch>

+ 20 - 0
catkin_ws/src/mr12urdf20240605/launch/gazebo.launch

@@ -0,0 +1,20 @@
+<launch>
+  <include
+    file="$(find gazebo_ros)/launch/empty_world.launch" />
+  <node
+    name="tf_footprint_base"
+    pkg="tf"
+    type="static_transform_publisher"
+    args="0 0 0 0 0 0 base_link base_footprint 40" />
+  <node
+    name="spawn_model"
+    pkg="gazebo_ros"
+    type="spawn_model"
+    args="-file $(find mr12urdf20240605)/urdf/mr12urdf20240605.urdf -urdf -model mr12urdf20240605"
+    output="screen" />
+  <node
+    name="fake_joint_calibration"
+    pkg="rostopic"
+    type="rostopic"
+    args="pub /calibrated std_msgs/Bool true" />
+</launch>

二進制
catkin_ws/src/mr12urdf20240605/meshes/Link1.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/Link2.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/Link3.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/Link4.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/Link5.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/Link6.STL


二進制
catkin_ws/src/mr12urdf20240605/meshes/base_link.STL


+ 21 - 0
catkin_ws/src/mr12urdf20240605/package.xml

@@ -0,0 +1,21 @@
+<package format="2">
+  <name>mr12urdf20240605</name>
+  <version>1.0.0</version>
+  <description>
+    <p>URDF Description package for mr12urdf20240605</p>
+    <p>This package contains configuration data, 3D models and launch files
+for mr12urdf20240605 robot</p>
+  </description>
+  <author>TODO</author>
+  <maintainer email="TODO@email.com" />
+  <license>BSD</license>
+  <buildtool_depend>catkin</buildtool_depend>
+  <depend>roslaunch</depend>
+  <depend>robot_state_publisher</depend>
+  <depend>rviz</depend>
+  <depend>joint_state_publisher_gui</depend>
+  <depend>gazebo</depend>
+  <export>
+    <architecture_independent />
+  </export>
+</package>

+ 8 - 0
catkin_ws/src/mr12urdf20240605/urdf/mr12urdf20240605.csv

@@ -0,0 +1,8 @@
+Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity
+base_link,-0.0389794721428083,3.18209550907445E-05,0.114464775769165,0,0,0,27.8470958329326,0.333719655951858,-0.000162752951771119,-0.0150515703369821,0.572256719027697,6.64144679179418E-05,0.74716855955823,0,0,0,0,0,0,package://mr12urdf20240605/meshes/base_link.STL,0,1,1,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/base_link.STL,,base_link-1,坐标系word,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
+Link1,0.0015836,0.02481,-0.16429,0,0,0,28.856,0.80293,0.2052,-0.085925,0.84748,-0.048338,0.87668,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link1.STL,1,1,1,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link1.STL,,link1rebuild-1,坐标系1,基准轴1,joint1,revolute,0,0,0.55,0,0,0,base_link,0,0,1,150,3.541,-2.878,2.878,,,,,,,,
+Link2,0.318649688799688,-0.000235571433145232,0.186136694407231,0,0,0,7.80684304255034,0.0281236828911867,0.000281518665603689,-0.00939923269411962,0.185870193003645,1.16807601383937E-05,0.200135929390865,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link2.STL,1,1,1,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link2.STL,,link2-1,坐标系2,基准轴2,joint2,revolute,0.14974,0.035343,0,1.5708,-1.5708,0,Link1,0,0,-1,150,3.541,-2.529,1.396,,,,,,,,
+Link3,0.108553296371736,-0.0970725190395638,0.00155584136936515,0,0,0,13.1020677700115,0.0894771695987357,0.00373169975921231,0.00305911419576535,0.0755527499176048,0.00497831742143842,0.0627128517779011,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link3.STL,1,1,1,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link3.STL,,link3rebuild2-1,坐标系3,基准轴3,joint3,revolute,0.76075,0,0.033754,0,0,0,Link2,0,0,-1,150,3.733,-1.308,2.529,,,,,,,,
+Link4,0.0144892098854688,-0.000636132360795127,-0.376459479520837,0,0,0,8.67998704574409,0.466226625992446,0.000500906822306766,-0.015294045664646,0.451075373457536,0.000649456671583942,0.036563182959402,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link4.STL,0,1,1,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link4.STL,,link4-1,坐标系4,基准轴4,joint4,revolute,0.19783,-1.0829,0,1.5708,0,0,Link3,0,0,1,88.5,6.838,-3.314,3.314,,,,,,,,
+Link5,-6.1697E-06,-0.048434,-0.0024999,0,0,0,1.2351,0.0041541,-7.1529E-06,-1.1135E-05,0.0031617,0.00015352,0.0035434,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link5.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link5.STL,,link5-1,坐标系5,基准轴5,joint5,revolute,0,0,0,1.5708,1.5708,0,Link4,0,0,-1,45.52,4.815,-3.663,0.75,,,,,,,,
+Link6,0.048649,-0.00090428,0.27553,0,0,0,1.8877,0.0086566,0.00012203,-0.00084157,0.0053122,0.00012437,0.0064842,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link6.STL,0.75294,0.75294,0.75294,1,0,0,0,0,0,0,package://mr12urdf20240605/meshes/Link6.STL,,hanqiangrebuild-2;0517A-1;0516h-1,坐标系6,基准轴6,joint6,revolute,0,0,0,1.5708,0,0,Link5,0,0,-1,32.64,23.655,-3.838,3.838,,,,,,,,

+ 430 - 0
catkin_ws/src/mr12urdf20240605/urdf/mr12urdf20240605.urdf

@@ -0,0 +1,430 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
+     Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
+     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
+<robot
+  name="mr12urdf20240605">
+  <link
+    name="base_link">
+    <!-- <inertial>
+      <origin
+        xyz="-0.0389794721428083 3.18209550907445E-05 0.114464775769165"
+        rpy="0 0 0" />
+      <mass
+        value="27.8470958329326" />
+      <inertia
+        ixx="0.333719655951858"
+        ixy="-0.000162752951771119"
+        ixz="-0.0150515703369821"
+        iyy="0.572256719027697"
+        iyz="6.64144679179418E-05"
+        izz="0.74716855955823" />
+    </inertial> -->
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/base_link.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0 1 1 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/base_link.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <link
+    name="Link1">
+    <inertial>
+      <origin
+        xyz="0.0015836 0.02481 -0.16429"
+        rpy="0 0 0" />
+      <mass
+        value="28.856" />
+      <inertia
+        ixx="0.80293"
+        ixy="0.2052"
+        ixz="-0.085925"
+        iyy="0.84748"
+        iyz="-0.048338"
+        izz="0.87668" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link1.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="1 1 1 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link1.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint1"
+    type="revolute">
+    <origin
+      xyz="0 0 0.55"
+      rpy="0 0 0" />
+    <parent
+      link="base_link" />
+    <child
+      link="Link1" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-2.878"
+      upper="2.878"
+      effort="150"
+      velocity="3.541" />
+  </joint>
+  <link
+    name="Link2">
+    <inertial>
+      <origin
+        xyz="0.318649688799688 -0.000235571433145232 0.186136694407231"
+        rpy="0 0 0" />
+      <mass
+        value="7.80684304255034" />
+      <inertia
+        ixx="0.0281236828911867"
+        ixy="0.000281518665603689"
+        ixz="-0.00939923269411962"
+        iyy="0.185870193003645"
+        iyz="1.16807601383937E-05"
+        izz="0.200135929390865" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link2.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="1 1 1 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link2.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint2"
+    type="revolute">
+    <origin
+      xyz="0.14974 0.035343 0"
+      rpy="1.5708 -1.5708 0" />
+    <parent
+      link="Link1" />
+    <child
+      link="Link2" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-2.529"
+      upper="1.396"
+      effort="150"
+      velocity="3.541" />
+  </joint>
+  <link
+    name="Link3">
+    <inertial>
+      <origin
+        xyz="0.108553296371736 -0.0970725190395638 0.00155584136936515"
+        rpy="0 0 0" />
+      <mass
+        value="13.1020677700115" />
+      <inertia
+        ixx="0.0894771695987357"
+        ixy="0.00373169975921231"
+        ixz="0.00305911419576535"
+        iyy="0.0755527499176048"
+        iyz="0.00497831742143842"
+        izz="0.0627128517779011" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link3.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="1 1 1 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link3.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint3"
+    type="revolute">
+    <origin
+      xyz="0.76075 0 0.033754"
+      rpy="0 0 0" />
+    <parent
+      link="Link2" />
+    <child
+      link="Link3" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-1.308"
+      upper="2.529"
+      effort="150"
+      velocity="3.733" />
+  </joint>
+  <link
+    name="Link4">
+    <inertial>
+      <origin
+        xyz="0.0144892098854688 -0.000636132360795127 -0.376459479520837"
+        rpy="0 0 0" />
+      <mass
+        value="8.67998704574409" />
+      <inertia
+        ixx="0.466226625992446"
+        ixy="0.000500906822306766"
+        ixz="-0.015294045664646"
+        iyy="0.451075373457536"
+        iyz="0.000649456671583942"
+        izz="0.036563182959402" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link4.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0 1 1 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link4.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint4"
+    type="revolute">
+    <origin
+      xyz="0.19783 -1.0829 0"
+      rpy="1.5708 0 0" />
+    <parent
+      link="Link3" />
+    <child
+      link="Link4" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-1.6"
+      upper="1.6"
+      effort="88.5"
+      velocity="6.838" />
+  </joint>
+  <link
+    name="Link5">
+    <inertial>
+      <origin
+        xyz="-6.1697E-06 -0.048434 -0.0024999"
+        rpy="0 0 0" />
+      <mass
+        value="1.2351" />
+      <inertia
+        ixx="0.0041541"
+        ixy="-7.1529E-06"
+        ixz="-1.1135E-05"
+        iyy="0.0031617"
+        iyz="0.00015352"
+        izz="0.0035434" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link5.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.79216 0.81961 0.93333 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link5.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint5"
+    type="revolute">
+    <origin
+      xyz="0 0 0"
+      rpy="1.5708 1.5708 0" />
+    <parent
+      link="Link4" />
+    <child
+      link="Link5" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-1.6"
+      upper="0.75"
+      effort="45.52"
+      velocity="4.815" />
+  </joint>
+  <link
+    name="Link6">
+    <inertial>
+      <origin
+        xyz="0.048649 -0.00090428 0.27553"
+        rpy="0 0 0" />
+      <mass
+        value="1.8877" />
+      <inertia
+        ixx="0.0086566"
+        ixy="0.00012203"
+        ixz="-0.00084157"
+        iyy="0.0053122"
+        iyz="0.00012437"
+        izz="0.0064842" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link6.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.75294 0.75294 0.75294 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://mr12urdf20240605/meshes/Link6.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint6"
+    type="revolute">
+    <origin
+      xyz="0 0 0"
+      rpy="1.5708 0 0" />
+    <parent
+      link="Link5" />
+    <child
+      link="Link6" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-3.838"
+      upper="3.838"
+      effort="32.64"
+      velocity="23.655" />
+  </joint>
+
+    <joint
+  name="joint_flp"
+  type="fixed">
+    <parent
+	link="Link6"/>
+    <child
+	link="link_flp"/>
+    <!-- 法兰盘 -->
+    <origin rpy=" 0 0 3.1415926" xyz="0  0  0.100"/>
+  </joint>
+
+  <link name="link_flp">
+    <collision>
+      <geometry>
+        <box size="0.0001 0.0001 0.0001"/>
+      </geometry>
+      <origin rpy="0 0 0" xyz="0 0 0"/>
+    </collision>
+  </link>
+
+  <joint
+  name="joint_end"
+  type="fixed">
+    <parent
+	link="link_flp"/>
+    <child
+	link="link_end"/>
+    <origin rpy="0.0 0.325888 3.1415926" xyz="-0.06371  0.004214  0.7387658"/>
+  </joint>
+
+  <link name="link_end">
+  </link>
+
+
+</robot>