bzx пре 5 месеци
родитељ
комит
d6f7c2e85b
83 измењених фајлова са 1522 додато и 1862 уклоњено
  1. BIN
      ren_yuan/src/a9/meshes/Link_1.STL
  2. BIN
      ren_yuan/src/a9/meshes/Link_2.STL
  3. BIN
      ren_yuan/src/a9/meshes/Link_3.STL
  4. BIN
      ren_yuan/src/a9/meshes/Link_4.STL
  5. BIN
      ren_yuan/src/a9/meshes/Link_5.STL
  6. BIN
      ren_yuan/src/a9/meshes/Link_6.STL
  7. BIN
      ren_yuan/src/a9/meshes/Link_7.STL
  8. BIN
      ren_yuan/src/a9/meshes/base_link.STL
  9. 0 9
      ren_yuan/src/a9/urdf/a9.csv
  10. 0 465
      ren_yuan/src/a9/urdf/a9.urdf
  11. 0 465
      ren_yuan/src/a9/urdf/a9(复件).urdf
  12. 1 1
      ren_yuan/src/fanuc_ry/CMakeLists.txt
  13. 0 0
      ren_yuan/src/fanuc_ry/config/joint_names_fanuc_ry.yaml
  14. 2 2
      ren_yuan/src/fanuc_ry/launch/display.launch
  15. 1 1
      ren_yuan/src/fanuc_ry/launch/gazebo.launch
  16. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_1.STL
  17. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_2.STL
  18. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_3.STL
  19. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_4.STL
  20. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_5.STL
  21. BIN
      ren_yuan/src/fanuc_ry/meshes/Link_6.STL
  22. BIN
      ren_yuan/src/fanuc_ry/meshes/base_link.STL
  23. 3 3
      ren_yuan/src/fanuc_ry/package.xml
  24. 8 0
      ren_yuan/src/fanuc_ry/urdf/fanuc_ry.csv
  25. 413 0
      ren_yuan/src/fanuc_ry/urdf/fanuc_ry.urdf
  26. 11 0
      ren_yuan/src/fanuc_ry_moveit_config/.setup_assistant
  27. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/CMakeLists.txt
  28. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/cartesian_limits.yaml
  29. 0 1
      ren_yuan/src/fanuc_ry_moveit_config/config/chomp_planning.yaml
  30. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/config/fake_controllers.yaml
  31. 7 20
      ren_yuan/src/fanuc_ry_moveit_config/config/fanuc_ry.srdf
  32. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/gazebo_controllers.yaml
  33. 77 91
      ren_yuan/src/fanuc_ry_moveit_config/config/gazebo_fanuc_ry.urdf
  34. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/joint_limits.yaml
  35. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/kinematics.yaml
  36. 2 1
      ren_yuan/src/fanuc_ry_moveit_config/config/ompl_planning.yaml
  37. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/ros_controllers.yaml
  38. 1 2
      ren_yuan/src/fanuc_ry_moveit_config/config/sensors_3d.yaml
  39. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/simple_moveit_controllers.yaml
  40. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/config/stomp_planning.yaml
  41. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/chomp_planning_pipeline.launch.xml
  42. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/default_warehouse_db.launch
  43. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/demo.launch
  44. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/demo_gazebo.launch
  45. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/fake_moveit_controller_manager.launch.xml
  46. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/fanuc_ry_moveit_sensor_manager.launch.xml
  47. 2 2
      ren_yuan/src/fanuc_ry_moveit_config/launch/gazebo.launch
  48. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/joystick_control.launch
  49. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/move_group.launch
  50. 80 90
      ren_yuan/src/fanuc_ry_moveit_config/launch/moveit.rviz
  51. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/moveit_rviz.launch
  52. 2 2
      ren_yuan/src/fanuc_ry_moveit_config/launch/ompl-chomp_planning_pipeline.launch.xml
  53. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/ompl_planning_pipeline.launch.xml
  54. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/pilz_industrial_motion_planner_planning_pipeline.launch.xml
  55. 5 5
      ren_yuan/src/fanuc_ry_moveit_config/launch/planning_context.launch
  56. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/planning_pipeline.launch.xml
  57. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/ros_control_moveit_controller_manager.launch.xml
  58. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/ros_controllers.launch
  59. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/run_benchmark_ompl.launch
  60. 5 9
      ren_yuan/src/fanuc_ry_moveit_config/launch/sensor_manager.launch.xml
  61. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/setup_assistant.launch
  62. 2 2
      ren_yuan/src/fanuc_ry_moveit_config/launch/simple_moveit_controller_manager.launch.xml
  63. 1 1
      ren_yuan/src/fanuc_ry_moveit_config/launch/stomp_planning_pipeline.launch.xml
  64. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/trajectory_execution.launch.xml
  65. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/warehouse.launch
  66. 0 0
      ren_yuan/src/fanuc_ry_moveit_config/launch/warehouse_settings.launch.xml
  67. 5 5
      ren_yuan/src/fanuc_ry_moveit_config/package.xml
  68. 51 0
      ren_yuan/src/lst_robot_r/README.md
  69. 475 0
      ren_yuan/src/lst_robot_r/hanqiangpose.py
  70. 0 70
      ren_yuan/src/lst_robot_r/scripts/CloudFunc.py
  71. 0 145
      ren_yuan/src/lst_robot_r/scripts/check.py
  72. 2 2
      ren_yuan/src/lst_robot_r/scripts/command.py
  73. 0 16
      ren_yuan/src/lst_robot_r/scripts/decorator_time.py
  74. 2 2
      ren_yuan/src/lst_robot_r/scripts/dycl_0506.py
  75. 0 90
      ren_yuan/src/lst_robot_r/scripts/hanqiangpose.py
  76. 148 65
      ren_yuan/src/lst_robot_r/scripts/hjsx.py
  77. 171 160
      ren_yuan/src/lst_robot_r/scripts/moveitServer2.py
  78. 0 23
      ren_yuan/src/lst_robot_r/scripts/pcd2binary.py
  79. 0 38
      ren_yuan/src/lst_robot_r/scripts/rotation_pcd.py
  80. 24 51
      ren_yuan/src/lst_robot_r/scripts/start.py
  81. 0 11
      ren_yuan/src/robot_config/.setup_assistant
  82. 1 1
      ren_yuan/src/visual/CMakeLists.txt
  83. 9 0
      ren_yuan/说明.txt

BIN
ren_yuan/src/a9/meshes/Link_1.STL


BIN
ren_yuan/src/a9/meshes/Link_2.STL


BIN
ren_yuan/src/a9/meshes/Link_3.STL


BIN
ren_yuan/src/a9/meshes/Link_4.STL


BIN
ren_yuan/src/a9/meshes/Link_5.STL


BIN
ren_yuan/src/a9/meshes/Link_6.STL


BIN
ren_yuan/src/a9/meshes/Link_7.STL


BIN
ren_yuan/src/a9/meshes/base_link.STL


+ 0 - 9
ren_yuan/src/a9/urdf/a9.csv

@@ -1,9 +0,0 @@
-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.110121070288428,-0.0129999995820303,0.159000000973282,0,0,0,0.0148298653353077,2.02744416702812E-06,-1.54215522606031E-15,-3.37592192750916E-14,1.40267326461625E-06,-2.76126618174793E-15,1.40267288470545E-06,0,0,0,0,0,0,package://a9/meshes/base_link.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/base_link.STL,,FANUC M-10iA8L - 底座-1,Origin_global,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
-Link_1,0.802922442229256,0.00984539192698494,1.19598646678643,0,0,0,8.19341168850207,0.19323050511757,0.0386299594946521,-0.388616965148905,1.42567974975729,0.0128991341474255,1.24513273855516,0,0,0,0,0,0,package://a9/meshes/Link_1.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_1.STL,,FANUC M-10iA8L - 1-1,Origin_joint_1,Axis_joint_1,joint_1,revolute,0,0,0.278,0,0,0,base_link,0,0,1,0,0,-3,3,,,,,,,,
-Link_2,0.117746157865896,0.0426453911640452,1.20871486266949,0,0,0,8.19341168850207,0.723493788556202,0.0285843029943905,-0.653933580723206,1.42567974975729,0.0290103266895879,0.714869455116528,0,0,0,0,0,0,package://a9/meshes/Link_2.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_2.STL,,FANUC M-10iA8L - 2-1,Origin_joint_2,Axis_joint_2,joint_2,revolute,0.15,-0.0328,0.172,0,0.47052,0,Link_1,0,1,0,0,0,-3,3,,,,,,,,
-Link_3,0.00164806841162357,0.0743961632896021,-0.0125870623969895,0,0,0,1.10722558532838,0.00281804497282514,1.0820613146504E-05,-2.30905562044302E-05,0.00127732014523064,5.62797076557556E-06,0.0028367630953507,0,0,0,0,0,0,package://a9/meshes/Link_3.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_3.STL,,FANUC M-10iA8L - 3-1,Origin_joint_3,Axis_joint_3,joint_3,revolute,-0.59925,0,0.50037,0,-0.28892,0,Link_2,0,1,0,0,0,-3,3,,,,,,,,
-Link_4,0.751501000756241,-0.00505225715113682,0.690060032582326,0,0,0,8.19341168850207,0.419099372956719,-0.0348631653478693,-0.581012917159635,1.42564974048808,-0.0218580250133829,1.01929387998522,0,0,0,0,0,0,package://a9/meshes/Link_4.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_4.STL,,FANUC M-10iA8L - 4-1,Origin_joint_4,Axis_joint_4,joint_4,revolute,-0.084223,0.0347,0.16884,-3.119,-1.0471,-0.013042,Link_3,0.86603,0,0.5,0,0,-3,3,,,,,,,,
-Link_5,0.206551018322306,-0.00505225715114058,-0.104834036546721,0,0,0,8.19341168850207,0.745717188604768,0.0281122476978264,-0.653399595391099,1.42564974048808,0.030048545471202,0.69267606433717,0,0,0,0,0,0,package://a9/meshes/Link_5.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_5.STL,,FANUC M-10iA8L - 5-1,Origin_joint_5,Axis_joint_5,joint_5,revolute,0.92436,0,0.53588,3.1416,-0.25867,3.1416,Link_4,0,1,0,0,0,-3,3,,,,,,,,
-Link_6,0.12280626304832,0.10284172733946,-0.0673247079199191,0,0,0,8.19341168850207,1.25065484857243,-0.370837141231599,-0.214061773475593,0.581725625286335,-0.544088624970368,1.03166251957125,0,0,0,0,0,0,package://a9/meshes/Link_6.STL,1,1,0,1,0,0,0,0,0,0,package://a9/meshes/Link_6.STL,,FANUC M-10iA8L - 6-1,Origin_joint_6,Axis_joint_6,joint_6,revolute,0.037697,-0.0006997,-0.064094,0.44032,0.19669,-0.83053,Link_5,0.49999,0,-0.86603,0,0,-3,3,,,,,,,,
-Link_7,0.0296425829147993,-6.47728578861279E-06,0.162281442392356,0,0,0,7.07143232149748,0.0103947066541271,8.00167786886164E-07,0.00131122028195651,0.0112643862205598,-2.38846633634112E-06,0.0065729384023248,0,0,0,0,0,0,package://a9/meshes/Link_7.STL,0.752941176470588,0.752941176470588,0.752941176470588,1,0,0,0,0,0,0,package://a9/meshes/Link_7.STL,,META激光跟踪-2,Origin_joint_72,Axis_joint_7,joint_7,fixed,0,0,0,-2.6972,0.28661,-2.1066,Link_6,0,0,0,,,,,,,,,,,,

+ 0 - 465
ren_yuan/src/a9/urdf/a9.urdf

@@ -1,465 +0,0 @@
-<?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="a9">
-  <link name="world" />
-  
-  <joint name="world_joint" type="fixed">
-    <parent link="world" />
-    <child link = "base_link" />
-    <origin xyz="0.0 0.0 2.17" rpy="0.0 3.14 0.0" />
-  </joint>
-  
-  <link
-    name="base_link">
-    <inertial>
-      <origin
-        xyz="-0.110121070288428 -0.0129999995820303 0.159000000973282"
-        rpy="0 0 0" />
-      <mass
-        value="0.0148298653353077" />
-      <inertia
-        ixx="2.02744416702812E-06"
-        ixy="-1.54215522606031E-15"
-        ixz="-3.37592192750916E-14"
-        iyy="1.40267326461625E-06"
-        iyz="-2.76126618174793E-15"
-        izz="1.40267288470545E-06" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/base_link.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/base_link.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <link
-    name="Link_1">
-    <inertial>
-      <origin
-        xyz="0.802922442229256 0.00984539192698494 1.19598646678643"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.19323050511757"
-        ixy="0.0386299594946521"
-        ixz="-0.388616965148905"
-        iyy="1.42567974975729"
-        iyz="0.0128991341474255"
-        izz="1.24513273855516" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_1.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_1.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_1"
-    type="revolute">
-    <origin
-      xyz="0 0 0.278"
-      rpy="0 0 0" />
-    <parent
-      link="base_link" />
-    <child
-      link="Link_1" />
-    <axis
-      xyz="0 0 1" />
-    <limit
-      lower="-2.965"
-      upper="2.965"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_2">
-    <inertial>
-      <origin
-        xyz="0.117746157865896 0.0426453911640452 1.20871486266949"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.723493788556202"
-        ixy="0.0285843029943905"
-        ixz="-0.653933580723206"
-        iyy="1.42567974975729"
-        iyz="0.0290103266895879"
-        izz="0.714869455116528" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_2.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_2.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_2"
-    type="revolute">
-    <origin
-      xyz="0.15 -0.0328 0.172"
-      rpy="0 0.47052 0" />
-    <parent
-      link="Link_1" />
-    <child
-      link="Link_2" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-2.27"
-      upper="2.27"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_3">
-    <inertial>
-      <origin
-        xyz="0.00164806841162357 0.0743961632896021 -0.0125870623969895"
-        rpy="0 0 0" />
-      <mass
-        value="1.10722558532838" />
-      <inertia
-        ixx="0.00281804497282514"
-        ixy="1.0820613146504E-05"
-        ixz="-2.30905562044302E-05"
-        iyy="0.00127732014523064"
-        iyz="5.62797076557556E-06"
-        izz="0.0028367630953507" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_3.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_3.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_3"
-    type="revolute">
-    <origin
-      xyz="-0.59925 0 0.50037"
-      rpy="0 -0.28892 0" />
-    <parent
-      link="Link_2" />
-    <child
-      link="Link_3" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-4.0"
-      upper="4.0"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_4">
-    <inertial>
-      <origin
-        xyz="0.751501000756241 -0.00505225715113682 0.690060032582326"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.419099372956719"
-        ixy="-0.0348631653478693"
-        ixz="-0.581012917159635"
-        iyy="1.42564974048808"
-        iyz="-0.0218580250133829"
-        izz="1.01929387998522" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_4.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_4.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_4"
-    type="revolute">
-    <origin
-      xyz="-0.084223 0.0347 0.16884"
-      rpy="-3.119 -1.0471 -0.013042" />
-    <parent
-      link="Link_3" />
-    <child
-      link="Link_4" />
-    <axis
-      xyz="0.86603 0 0.5" />
-    <limit
-      lower="-3.49"
-      upper="3.49"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_5">
-    <inertial>
-      <origin
-        xyz="0.206551018322306 -0.00505225715114058 -0.104834036546721"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.745717188604768"
-        ixy="0.0281122476978264"
-        ixz="-0.653399595391099"
-        iyy="1.42564974048808"
-        iyz="0.030048545471202"
-        izz="0.69267606433717" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_5.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_5.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_5"
-    type="revolute">
-    <origin
-      xyz="0.92436 0 0.53588"
-      rpy="3.1416 -0.25867 3.1416" />
-    <parent
-      link="Link_4" />
-    <child
-      link="Link_5" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-2.49"
-      upper="2.49"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_6">
-    <inertial>
-      <origin
-        xyz="0.12280626304832 0.10284172733946 -0.0673247079199191"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="1.25065484857243"
-        ixy="-0.370837141231599"
-        ixz="-0.214061773475593"
-        iyy="0.581725625286335"
-        iyz="-0.544088624970368"
-        izz="1.03166251957125" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_6.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_6.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_6"
-    type="revolute">
-    <origin
-      xyz="0.037697 -0.0006997 -0.064094"
-      rpy="0.44032 0.19669 -0.83053" />
-    <parent
-      link="Link_5" />
-    <child
-      link="Link_6" />
-    <axis
-      xyz="0.49999 0 -0.86603" />
-    <limit
-      lower="-7.855"
-      upper="7.855"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_7">
-    <inertial>
-      <origin
-        xyz="0.0296425829147993 -6.47728578861279E-06 0.162281442392356"
-        rpy="0 0 0" />
-      <mass
-        value="7.07143232149748" />
-      <inertia
-        ixx="0.0103947066541271"
-        ixy="8.00167786886164E-07"
-        ixz="0.00131122028195651"
-        iyy="0.0112643862205598"
-        iyz="-2.38846633634112E-06"
-        izz="0.0065729384023248" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_7.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_7.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_7"
-    type="fixed">
-    <origin
-      xyz="0 0 0"
-      rpy="-2.6972 0.28661 -2.1066" />
-    <parent
-      link="Link_6" />
-    <child
-      link="Link_7" />
-    <axis
-      xyz="0 0 0" />
-  </joint>
-  
-  <link name="end_link_now" />
-  
-  <joint name="end_joint" type="fixed">
-    <parent link="Link_7" />
-    <child link = "end_link_now" />
-    <origin xyz="-0.045 0.0 0.4" rpy="0.0 0.4 3.14" />
-  </joint>
-  
-</robot>

+ 0 - 465
ren_yuan/src/a9/urdf/a9(复件).urdf

@@ -1,465 +0,0 @@
-<?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="a9">
-  <link name="world" />
-  
-  <joint name="world_joint" type="fixed">
-    <parent link="world" />
-    <child link = "base_link" />
-    <origin xyz="0.0 0.0 2.17" rpy="0.0 3.14 0.0" />
-  </joint>
-  
-  <link
-    name="base_link">
-    <inertial>
-      <origin
-        xyz="-0.110121070288428 -0.0129999995820303 0.159000000973282"
-        rpy="0 0 0" />
-      <mass
-        value="0.0148298653353077" />
-      <inertia
-        ixx="2.02744416702812E-06"
-        ixy="-1.54215522606031E-15"
-        ixz="-3.37592192750916E-14"
-        iyy="1.40267326461625E-06"
-        iyz="-2.76126618174793E-15"
-        izz="1.40267288470545E-06" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/base_link.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/base_link.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <link
-    name="Link_1">
-    <inertial>
-      <origin
-        xyz="0.802922442229256 0.00984539192698494 1.19598646678643"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.19323050511757"
-        ixy="0.0386299594946521"
-        ixz="-0.388616965148905"
-        iyy="1.42567974975729"
-        iyz="0.0128991341474255"
-        izz="1.24513273855516" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_1.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_1.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_1"
-    type="revolute">
-    <origin
-      xyz="0 0 0.278"
-      rpy="0 0 0" />
-    <parent
-      link="base_link" />
-    <child
-      link="Link_1" />
-    <axis
-      xyz="0 0 1" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_2">
-    <inertial>
-      <origin
-        xyz="0.117746157865896 0.0426453911640452 1.20871486266949"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.723493788556202"
-        ixy="0.0285843029943905"
-        ixz="-0.653933580723206"
-        iyy="1.42567974975729"
-        iyz="0.0290103266895879"
-        izz="0.714869455116528" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_2.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_2.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_2"
-    type="revolute">
-    <origin
-      xyz="0.15 -0.0328 0.172"
-      rpy="0 0.47052 0" />
-    <parent
-      link="Link_1" />
-    <child
-      link="Link_2" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_3">
-    <inertial>
-      <origin
-        xyz="0.00164806841162357 0.0743961632896021 -0.0125870623969895"
-        rpy="0 0 0" />
-      <mass
-        value="1.10722558532838" />
-      <inertia
-        ixx="0.00281804497282514"
-        ixy="1.0820613146504E-05"
-        ixz="-2.30905562044302E-05"
-        iyy="0.00127732014523064"
-        iyz="5.62797076557556E-06"
-        izz="0.0028367630953507" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_3.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_3.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_3"
-    type="revolute">
-    <origin
-      xyz="-0.59925 0 0.50037"
-      rpy="0 -0.28892 0" />
-    <parent
-      link="Link_2" />
-    <child
-      link="Link_3" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_4">
-    <inertial>
-      <origin
-        xyz="0.751501000756241 -0.00505225715113682 0.690060032582326"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.419099372956719"
-        ixy="-0.0348631653478693"
-        ixz="-0.581012917159635"
-        iyy="1.42564974048808"
-        iyz="-0.0218580250133829"
-        izz="1.01929387998522" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_4.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_4.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_4"
-    type="revolute">
-    <origin
-      xyz="-0.084223 0.0347 0.16884"
-      rpy="-3.119 -1.0471 -0.013042" />
-    <parent
-      link="Link_3" />
-    <child
-      link="Link_4" />
-    <axis
-      xyz="0.86603 0 0.5" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_5">
-    <inertial>
-      <origin
-        xyz="0.206551018322306 -0.00505225715114058 -0.104834036546721"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="0.745717188604768"
-        ixy="0.0281122476978264"
-        ixz="-0.653399595391099"
-        iyy="1.42564974048808"
-        iyz="0.030048545471202"
-        izz="0.69267606433717" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_5.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_5.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_5"
-    type="revolute">
-    <origin
-      xyz="0.92436 0 0.53588"
-      rpy="3.1416 -0.25867 3.1416" />
-    <parent
-      link="Link_4" />
-    <child
-      link="Link_5" />
-    <axis
-      xyz="0 1 0" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_6">
-    <inertial>
-      <origin
-        xyz="0.12280626304832 0.10284172733946 -0.0673247079199191"
-        rpy="0 0 0" />
-      <mass
-        value="8.19341168850207" />
-      <inertia
-        ixx="1.25065484857243"
-        ixy="-0.370837141231599"
-        ixz="-0.214061773475593"
-        iyy="0.581725625286335"
-        iyz="-0.544088624970368"
-        izz="1.03166251957125" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_6.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="1 1 0 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_6.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_6"
-    type="revolute">
-    <origin
-      xyz="0.037697 -0.0006997 -0.064094"
-      rpy="0.44032 0.19669 -0.83053" />
-    <parent
-      link="Link_5" />
-    <child
-      link="Link_6" />
-    <axis
-      xyz="0.49999 0 -0.86603" />
-    <limit
-      lower="-3.8"
-      upper="3.8"
-      effort="0"
-      velocity="0" />
-  </joint>
-  <link
-    name="Link_7">
-    <inertial>
-      <origin
-        xyz="0.0296425829147993 -6.47728578861279E-06 0.162281442392356"
-        rpy="0 0 0" />
-      <mass
-        value="7.07143232149748" />
-      <inertia
-        ixx="0.0103947066541271"
-        ixy="8.00167786886164E-07"
-        ixz="0.00131122028195651"
-        iyy="0.0112643862205598"
-        iyz="-2.38846633634112E-06"
-        izz="0.0065729384023248" />
-    </inertial>
-    <visual>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_7.STL" />
-      </geometry>
-      <material
-        name="">
-        <color
-          rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
-      </material>
-    </visual>
-    <collision>
-      <origin
-        xyz="0 0 0"
-        rpy="0 0 0" />
-      <geometry>
-        <mesh
-          filename="package://a9/meshes/Link_7.STL" />
-      </geometry>
-    </collision>
-  </link>
-  <joint
-    name="joint_7"
-    type="fixed">
-    <origin
-      xyz="0 0 0"
-      rpy="-2.6972 0.28661 -2.1066" />
-    <parent
-      link="Link_6" />
-    <child
-      link="Link_7" />
-    <axis
-      xyz="0 0 0" />
-  </joint>
-  
-  <link name="end_link_now" />
-  
-  <joint name="end_joint" type="fixed">
-    <parent link="Link_7" />
-    <child link = "end_link_now" />
-    <origin xyz="-0.045 0.0 0.4" rpy="0.0 0.4 3.14" />
-  </joint>
-  
-</robot>

+ 1 - 1
ren_yuan/src/a9/CMakeLists.txt → ren_yuan/src/fanuc_ry/CMakeLists.txt

@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 2.8.3)
 
-project(a9)
+project(fanuc_ry)
 
 find_package(catkin REQUIRED)
 

+ 0 - 0
ren_yuan/src/a9/config/joint_names_a9.yaml → ren_yuan/src/fanuc_ry/config/joint_names_fanuc_ry.yaml


+ 2 - 2
ren_yuan/src/a9/launch/display.launch → ren_yuan/src/fanuc_ry/launch/display.launch

@@ -3,7 +3,7 @@
     name="model" />
   <param
     name="robot_description"
-    textfile="$(find a9)/urdf/a9.urdf" />
+    textfile="$(find fanuc_ry)/urdf/fanuc_ry.urdf" />
   <node
     name="joint_state_publisher_gui"
     pkg="joint_state_publisher_gui"
@@ -16,5 +16,5 @@
     name="rviz"
     pkg="rviz"
     type="rviz"
-    args="-d $(find a9)/urdf.rviz" />
+    args="-d $(find fanuc_ry)/urdf.rviz" />
 </launch>

+ 1 - 1
ren_yuan/src/a9/launch/gazebo.launch → ren_yuan/src/fanuc_ry/launch/gazebo.launch

@@ -10,7 +10,7 @@
     name="spawn_model"
     pkg="gazebo_ros"
     type="spawn_model"
-    args="-file $(find a9)/urdf/a9.urdf -urdf -model a9"
+    args="-file $(find fanuc_ry)/urdf/fanuc_ry.urdf -urdf -model fanuc_ry"
     output="screen" />
   <node
     name="fake_joint_calibration"

BIN
ren_yuan/src/fanuc_ry/meshes/Link_1.STL


BIN
ren_yuan/src/fanuc_ry/meshes/Link_2.STL


BIN
ren_yuan/src/fanuc_ry/meshes/Link_3.STL


BIN
ren_yuan/src/fanuc_ry/meshes/Link_4.STL


BIN
ren_yuan/src/fanuc_ry/meshes/Link_5.STL


BIN
ren_yuan/src/fanuc_ry/meshes/Link_6.STL


BIN
ren_yuan/src/fanuc_ry/meshes/base_link.STL


+ 3 - 3
ren_yuan/src/a9/package.xml → ren_yuan/src/fanuc_ry/package.xml

@@ -1,10 +1,10 @@
 <package format="2">
-  <name>a9</name>
+  <name>fanuc_ry</name>
   <version>1.0.0</version>
   <description>
-    <p>URDF Description package for a9</p>
+    <p>URDF Description package for fanuc_ry</p>
     <p>This package contains configuration data, 3D models and launch files
-for a9 robot</p>
+for fanuc_ry robot</p>
   </description>
   <author>TODO</author>
   <maintainer email="TODO@email.com" />

+ 8 - 0
ren_yuan/src/fanuc_ry/urdf/fanuc_ry.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.0067459,0.00048961,0.12827,0,0,0,13.511,0.1373,0.00087636,0.003867,0.14276,4.9465E-05,0.11338,0,0,0,0,0,0,package://fanuc_ry/meshes/base_link.STL,0.26667,0.26667,0.26667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/base_link.STL,,底座-1,基坐标系,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
+Link_1,0.046629,0.040325,0.11902,0,0,0,10.873,0.1054,-0.0045186,-0.021996,0.13842,-0.018604,0.12811,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_1.STL,0.26667,0.26667,0.26667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_1.STL,,轴1-1,Origin_joint_1,Axis_joint_1,joint_1,revolute,0,0,0.277,0,0,0,base_link,0,0,1,0,0,-3,3,,,,,,,,
+Link_2,0.079218,0.046804,0.19413,0,0,0,37.391,11.84,0.35759,-5.9826,16.808,0.31317,5.2925,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_2.STL,0.26667,0.26667,0.26667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_2.STL,,轴2-1,Origin_joint_2,Axis_joint_2,joint_2,revolute,0.15,-0.042195,0.173,0,0,0,Link_1,0,1,0,0,0,-3,3,,,,,,,,
+Link_3,0.0819232659965815,0.0488957476294858,0.0997479026407966,0,0,0,5.31125443623239,0.0377023601596469,-0.00198499744122145,-0.00823986510994731,0.0380505516425425,-0.00237816508450241,0.0202238320497431,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_3.STL,0.266666666666667,0.266666666666667,0.266666666666667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_3.STL,,轴3-1,Origin_joint_3,Axis_joint_3,joint_3,revolute,0,0,0.78,0,0,0,Link_2,0,-1,0,0,0,-3,3,,,,,,,,
+Link_4,0.475870558811332,-0.0337629939092132,-0.00126165368026476,0,0,0,6.90672216285316,0.0193668843618062,0.048070034103511,-0.000520432981432283,0.433691694631167,0.000101052935278791,0.439756920518466,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_4.STL,0.266666666666667,0.266666666666667,0.266666666666667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_4.STL,,轴4-1,Origin_joint_4,Axis_joint_4,joint_4,revolute,0.18449,0.042195,0.2,0,0,0,Link_3,-1,0,0,0,0,-3,3,,,,,,,,
+Link_5,-1.00678870289315,0.00460908463366021,-0.785340384700437,0,0,0,37.3909058444352,11.8404562839242,0.357586794323293,-5.9825947327725,16.8076547081665,0.313167595336379,5.29248954036271,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_5.STL,0.266666666666667,0.266666666666667,0.266666666666667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_5.STL,,轴5-1,Origin_joint_5,Axis_joint_5,joint_5,revolute,0.90151,0,-0.00052875,0,0,0,Link_4,0,-1,0,0,0,-3,3,,,,,,,,
+Link_6,-0.0165412016845266,0.0951891558056374,0.119534910446276,0,0,0,0.789056328743544,0.00166815677862568,-0.000330967965728139,6.08102317073045E-06,0.00102524254386583,-1.68914833733875E-06,0.0013292952791531,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_6.STL,0.266666666666667,0.266666666666667,0.266666666666667,1,0,0,0,0,0,0,package://fanuc_ry/meshes/Link_6.STL,,轴6-1;相机支架总成-1,Origin_joint_6,Axis_joint_6,joint_6,revolute,0.093994,0,0.0005287,0,0,0,Link_5,0,0,1,0,0,-3,3,,,,,,,,

+ 413 - 0
ren_yuan/src/fanuc_ry/urdf/fanuc_ry.urdf

@@ -0,0 +1,413 @@
+<?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="fanuc_ry">
+  
+  <link name="world_link" />
+  <joint name="world_joint" type="fixed">
+    <parent link="world_link" />
+    <child link="base_link" />
+    <origin xyz="0 0 2.17" rpy="0 3.14 0" />
+  </joint>
+  
+  <link
+    name="base_link">
+    <!-- <inertial>
+      <origin
+        xyz="0.0067459 0.00048961 0.12827"
+        rpy="0 0 0" />
+      <mass
+        value="13.511" />
+      <inertia
+        ixx="0.1373"
+        ixy="0.00087636"
+        ixz="0.003867"
+        iyy="0.14276"
+        iyz="4.9465E-05"
+        izz="0.11338" />
+    </inertial> -->
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/base_link.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.26667 0.26667 0.26667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/base_link.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <link
+    name="Link_1">
+    <inertial>
+      <origin
+        xyz="0.046629 0.040325 0.11902"
+        rpy="0 0 0" />
+      <mass
+        value="10.873" />
+      <inertia
+        ixx="0.1054"
+        ixy="-0.0045186"
+        ixz="-0.021996"
+        iyy="0.13842"
+        iyz="-0.018604"
+        izz="0.12811" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_1.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.26667 0.26667 0.26667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_1.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_1"
+    type="revolute">
+    <origin
+      xyz="0 0 0.277"
+      rpy="0 0 0" />
+    <parent
+      link="base_link" />
+    <child
+      link="Link_1" />
+    <axis
+      xyz="0 0 1" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+  <link
+    name="Link_2">
+    <inertial>
+      <origin
+        xyz="0.079218 0.046804 0.19413"
+        rpy="0 0 0" />
+      <mass
+        value="37.391" />
+      <inertia
+        ixx="11.84"
+        ixy="0.35759"
+        ixz="-5.9826"
+        iyy="16.808"
+        iyz="0.31317"
+        izz="5.2925" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_2.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.26667 0.26667 0.26667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_2.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_2"
+    type="revolute">
+    <origin
+      xyz="0.15 -0.042195 0.173"
+      rpy="0 0 0" />
+    <parent
+      link="Link_1" />
+    <child
+      link="Link_2" />
+    <axis
+      xyz="0 1 0" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+  <link
+    name="Link_3">
+    <inertial>
+      <origin
+        xyz="0.0819232659965815 0.0488957476294858 0.0997479026407966"
+        rpy="0 0 0" />
+      <mass
+        value="5.31125443623239" />
+      <inertia
+        ixx="0.0377023601596469"
+        ixy="-0.00198499744122145"
+        ixz="-0.00823986510994731"
+        iyy="0.0380505516425425"
+        iyz="-0.00237816508450241"
+        izz="0.0202238320497431" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_3.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.266666666666667 0.266666666666667 0.266666666666667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_3.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_3"
+    type="revolute">
+    <origin
+      xyz="0 0 0.78"
+      rpy="0 0 0" />
+    <parent
+      link="Link_2" />
+    <child
+      link="Link_3" />
+    <axis
+      xyz="0 -1 0" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+  <link
+    name="Link_4">
+    <inertial>
+      <origin
+        xyz="0.475870558811332 -0.0337629939092132 -0.00126165368026476"
+        rpy="0 0 0" />
+      <mass
+        value="6.90672216285316" />
+      <inertia
+        ixx="0.0193668843618062"
+        ixy="0.048070034103511"
+        ixz="-0.000520432981432283"
+        iyy="0.433691694631167"
+        iyz="0.000101052935278791"
+        izz="0.439756920518466" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_4.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.266666666666667 0.266666666666667 0.266666666666667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_4.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_4"
+    type="revolute">
+    <origin
+      xyz="0.18449 0.042195 0.2"
+      rpy="0 0 0" />
+    <parent
+      link="Link_3" />
+    <child
+      link="Link_4" />
+    <axis
+      xyz="-1 0 0" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+  <link
+    name="Link_5">
+    <inertial>
+      <origin
+        xyz="-1.00678870289315 0.00460908463366021 -0.785340384700437"
+        rpy="0 0 0" />
+      <mass
+        value="37.3909058444352" />
+      <inertia
+        ixx="11.8404562839242"
+        ixy="0.357586794323293"
+        ixz="-5.9825947327725"
+        iyy="16.8076547081665"
+        iyz="0.313167595336379"
+        izz="5.29248954036271" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_5.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.266666666666667 0.266666666666667 0.266666666666667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_5.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_5"
+    type="revolute">
+    <origin
+      xyz="0.90151 0 -0.00052875"
+      rpy="0 0 0" />
+    <parent
+      link="Link_4" />
+    <child
+      link="Link_5" />
+    <axis
+      xyz="0 -1 0" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+  <link
+    name="Link_6">
+    <inertial>
+      <origin
+        xyz="-0.0165412016845266 0.0951891558056374 0.119534910446276"
+        rpy="0 0 0" />
+      <mass
+        value="0.789056328743544" />
+      <inertia
+        ixx="0.00166815677862568"
+        ixy="-0.000330967965728139"
+        ixz="6.08102317073045E-06"
+        iyy="0.00102524254386583"
+        iyz="-1.68914833733875E-06"
+        izz="0.0013292952791531" />
+    </inertial>
+    <visual>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_6.STL" />
+      </geometry>
+      <material
+        name="">
+        <color
+          rgba="0.266666666666667 0.266666666666667 0.266666666666667 1" />
+      </material>
+    </visual>
+    <collision>
+      <origin
+        xyz="0 0 0"
+        rpy="0 0 0" />
+      <geometry>
+        <mesh
+          filename="package://fanuc_ry/meshes/Link_6.STL" />
+      </geometry>
+    </collision>
+  </link>
+  <joint
+    name="joint_6"
+    type="revolute">
+    <origin
+      xyz="0.093994 0 0.0005287"
+      rpy="0 -1.57 3.14" />
+    <parent
+      link="Link_5" />
+    <child
+      link="Link_6" />
+    <axis
+      xyz="0 0 -1" />
+    <limit
+      lower="-3"
+      upper="3"
+      effort="0"
+      velocity="0" />
+  </joint>
+
+  <link name="link_tool">
+  </link>
+
+  <joint name="joint_tool" type="fixed">
+    <parent link="Link_6"/>
+    <child link="link_tool"/>
+    <origin xyz="0.051 0.1209 0.3147" rpy="0 0 -0.400"/>
+  </joint>
+
+</robot>

+ 11 - 0
ren_yuan/src/fanuc_ry_moveit_config/.setup_assistant

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

+ 1 - 1
ren_yuan/src/robot_config/CMakeLists.txt → ren_yuan/src/fanuc_ry_moveit_config/CMakeLists.txt

@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.1.3)
-project(robot_config)
+project(fanuc_ry_moveit_config)
 
 find_package(catkin REQUIRED)
 

+ 0 - 0
ren_yuan/src/robot_config/config/cartesian_limits.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/cartesian_limits.yaml


+ 0 - 1
ren_yuan/src/robot_config/config/chomp_planning.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/chomp_planning.yaml

@@ -16,4 +16,3 @@ collision_threshold: 0.07
 use_stochastic_descent: true
 enable_failure_recovery: false
 max_recovery_attempts: 5
-trajectory_initialization_method: "fillTrajectory"

+ 1 - 1
ren_yuan/src/robot_config/config/fake_controllers.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/fake_controllers.yaml

@@ -10,4 +10,4 @@ controller_list:
       - joint_6
 initial:  # Define initial robot poses per group
   - group: manipulator
-    pose: home
+    pose: home

+ 7 - 20
ren_yuan/src/robot_config/config/a9.srdf → ren_yuan/src/fanuc_ry_moveit_config/config/fanuc_ry.srdf

@@ -3,24 +3,16 @@
     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="a9">
+<robot name="fanuc_ry">
     <!--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="world" tip_link="end_link_now"/>
+        <chain base_link="world_link" tip_link="link_tool"/>
     </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="joint_1" value="0"/>
-        <joint name="joint_2" value="-1.1311"/>
-        <joint name="joint_3" value="1.459"/>
-        <joint name="joint_4" value="-3.158"/>
-        <joint name="joint_5" value="-0.258"/>
-        <joint name="joint_6" value="-0.022"/>
-    </group_state>
     <group_state name="zero" group="manipulator">
         <joint name="joint_1" value="0"/>
         <joint name="joint_2" value="0"/>
@@ -29,13 +21,13 @@
         <joint name="joint_5" value="0"/>
         <joint name="joint_6" value="0"/>
     </group_state>
-    <group_state name="ready" group="manipulator">
+    <group_state name="home" group="manipulator">
         <joint name="joint_1" value="0"/>
-        <joint name="joint_2" value="-1.278"/>
-        <joint name="joint_3" value="1.459"/>
+        <joint name="joint_2" value="-1.5182"/>
+        <joint name="joint_3" value="-1.5265"/>
         <joint name="joint_4" value="0"/>
-        <joint name="joint_5" value="2.490"/>
-        <joint name="joint_6" value="3.102"/>
+        <joint name="joint_5" value="1.75"/>
+        <joint name="joint_6" 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="Link_1" link2="Link_2" reason="Adjacent"/>
@@ -43,14 +35,9 @@
     <disable_collisions link1="Link_1" link2="base_link" reason="Adjacent"/>
     <disable_collisions link1="Link_2" link2="Link_3" reason="Adjacent"/>
     <disable_collisions link1="Link_2" link2="Link_5" reason="Never"/>
-    <disable_collisions link1="Link_2" link2="Link_6" reason="Never"/>
     <disable_collisions link1="Link_3" link2="Link_4" reason="Adjacent"/>
     <disable_collisions link1="Link_3" link2="Link_5" reason="Never"/>
     <disable_collisions link1="Link_3" link2="Link_6" reason="Never"/>
-    <disable_collisions link1="Link_3" link2="Link_7" reason="Never"/>
     <disable_collisions link1="Link_4" link2="Link_5" reason="Adjacent"/>
-    <disable_collisions link1="Link_4" link2="Link_6" reason="Never"/>
     <disable_collisions link1="Link_5" link2="Link_6" reason="Adjacent"/>
-    <disable_collisions link1="Link_5" link2="Link_7" reason="Never"/>
-    <disable_collisions link1="Link_6" link2="Link_7" reason="Adjacent"/>
 </robot>

+ 0 - 0
ren_yuan/src/robot_config/config/gazebo_controllers.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/gazebo_controllers.yaml


+ 77 - 91
ren_yuan/src/robot_config/config/gazebo_a9.urdf → ren_yuan/src/fanuc_ry_moveit_config/config/gazebo_fanuc_ry.urdf

@@ -2,45 +2,59 @@
 <!-- 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="a9">
-    <link name="world" />
+<robot name="fanuc_ry">
+    <link name="world_link" />
     <joint name="world_joint" type="fixed">
-        <parent link="world" />
+        <parent link="world_link" />
         <child link="base_link" />
-        <origin xyz="0.0 0.0 2.17" rpy="0.0 3.14 0.0" />
+        <origin xyz="0 0 2.17" rpy="0 3.14 0" />
     </joint>
     <link name="base_link">
-        <inertial>
-            <origin xyz="-0.110121070288428 -0.0129999995820303 0.159000000973282" rpy="0 0 0" />
-            <mass value="0.0148298653353077" />
-            <inertia ixx="2.02744416702812E-06" ixy="-1.54215522606031E-15" ixz="-3.37592192750916E-14" iyy="1.40267326461625E-06" iyz="-2.76126618174793E-15" izz="1.40267288470545E-06" />
-        </inertial>
+        <!-- <inertial>
+      <origin
+        xyz="0.0067459 0.00048961 0.12827"
+        rpy="0 0 0" />
+      <mass
+        value="13.511" />
+      <inertia
+        ixx="0.1373"
+        ixy="0.00087636"
+        ixz="0.003867"
+        iyy="0.14276"
+        iyz="4.9465E-05"
+        izz="0.11338" />
+    </inertial> -->
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/base_link.STL" />
+                <mesh filename="package://fanuc_ry/meshes/base_link.STL" />
             </geometry>
             <material name="">
-                <color rgba="1 1 0 1" />
+                <color rgba="0.26667 0.26667 0.26667 1" />
             </material>
         </visual>
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/base_link.STL" />
+                <mesh filename="package://fanuc_ry/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="Link_1">
         <inertial>
-            <origin xyz="0.802922442229256 0.00984539192698494 1.19598646678643" rpy="0 0 0" />
-            <mass value="8.19341168850207" />
-            <inertia ixx="0.19323050511757" ixy="0.0386299594946521" ixz="-0.388616965148905" iyy="1.42567974975729" iyz="0.0128991341474255" izz="1.24513273855516" />
+            <origin xyz="0.046629 0.040325 0.11902" rpy="0 0 0" />
+            <mass value="10.873" />
+            <inertia ixx="0.1054" ixy="-0.0045186" ixz="-0.021996" iyy="0.13842" iyz="-0.018604" izz="0.12811" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_1.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_1.STL" />
             </geometry>
             <material name="">
                 <color rgba="1 1 0 1" />
@@ -49,27 +63,27 @@
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_1.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_1.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_1" type="revolute">
-        <origin xyz="0 0 0.278" rpy="0 0 0" />
+        <origin xyz="0 0 0.277" rpy="0 0 0" />
         <parent link="base_link" />
         <child link="Link_1" />
         <axis xyz="0 0 1" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
     <link name="Link_2">
         <inertial>
-            <origin xyz="0.117746157865896 0.0426453911640452 1.20871486266949" rpy="0 0 0" />
-            <mass value="8.19341168850207" />
-            <inertia ixx="0.723493788556202" ixy="0.0285843029943905" ixz="-0.653933580723206" iyy="1.42567974975729" iyz="0.0290103266895879" izz="0.714869455116528" />
+            <origin xyz="0.079218 0.046804 0.19413" rpy="0 0 0" />
+            <mass value="37.391" />
+            <inertia ixx="11.84" ixy="0.35759" ixz="-5.9826" iyy="16.808" iyz="0.31317" izz="5.2925" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_2.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_2.STL" />
             </geometry>
             <material name="">
                 <color rgba="1 1 0 1" />
@@ -78,27 +92,27 @@
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_2.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_2.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_2" type="revolute">
-        <origin xyz="0.15 -0.0328 0.172" rpy="0 0.47052 0" />
+        <origin xyz="0.15 -0.042195 0.173" rpy="0 0 0" />
         <parent link="Link_1" />
         <child link="Link_2" />
         <axis xyz="0 1 0" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
     <link name="Link_3">
         <inertial>
-            <origin xyz="0.00164806841162357 0.0743961632896021 -0.0125870623969895" rpy="0 0 0" />
-            <mass value="1.10722558532838" />
-            <inertia ixx="0.00281804497282514" ixy="1.0820613146504E-05" ixz="-2.30905562044302E-05" iyy="0.00127732014523064" iyz="5.62797076557556E-06" izz="0.0028367630953507" />
+            <origin xyz="0.0819232659965815 0.0488957476294858 0.0997479026407966" rpy="0 0 0" />
+            <mass value="5.31125443623239" />
+            <inertia ixx="0.0377023601596469" ixy="-0.00198499744122145" ixz="-0.00823986510994731" iyy="0.0380505516425425" iyz="-0.00237816508450241" izz="0.0202238320497431" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_3.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_3.STL" />
             </geometry>
             <material name="">
                 <color rgba="1 1 0 1" />
@@ -107,27 +121,27 @@
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_3.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_3.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_3" type="revolute">
-        <origin xyz="-0.59925 0 0.50037" rpy="0 -0.28892 0" />
+        <origin xyz="0 0 0.78" rpy="0 0 0" />
         <parent link="Link_2" />
         <child link="Link_3" />
-        <axis xyz="0 1 0" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <axis xyz="0 -1 0" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
     <link name="Link_4">
         <inertial>
-            <origin xyz="0.751501000756241 -0.00505225715113682 0.690060032582326" rpy="0 0 0" />
-            <mass value="8.19341168850207" />
-            <inertia ixx="0.419099372956719" ixy="-0.0348631653478693" ixz="-0.581012917159635" iyy="1.42564974048808" iyz="-0.0218580250133829" izz="1.01929387998522" />
+            <origin xyz="0.475870558811332 -0.0337629939092132 -0.00126165368026476" rpy="0 0 0" />
+            <mass value="6.90672216285316" />
+            <inertia ixx="0.0193668843618062" ixy="0.048070034103511" ixz="-0.000520432981432283" iyy="0.433691694631167" iyz="0.000101052935278791" izz="0.439756920518466" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_4.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_4.STL" />
             </geometry>
             <material name="">
                 <color rgba="1 1 0 1" />
@@ -136,27 +150,27 @@
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_4.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_4.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_4" type="revolute">
-        <origin xyz="-0.084223 0.0347 0.16884" rpy="-3.119 -1.0471 -0.013042" />
+        <origin xyz="0.18449 0.042195 0.2" rpy="0 0 0" />
         <parent link="Link_3" />
         <child link="Link_4" />
-        <axis xyz="0.86603 0 0.5" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <axis xyz="-1 0 0" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
     <link name="Link_5">
         <inertial>
-            <origin xyz="0.206551018322306 -0.00505225715114058 -0.104834036546721" rpy="0 0 0" />
-            <mass value="8.19341168850207" />
-            <inertia ixx="0.745717188604768" ixy="0.0281122476978264" ixz="-0.653399595391099" iyy="1.42564974048808" iyz="0.030048545471202" izz="0.69267606433717" />
+            <origin xyz="-1.00678870289315 0.00460908463366021 -0.785340384700437" rpy="0 0 0" />
+            <mass value="37.3909058444352" />
+            <inertia ixx="11.8404562839242" ixy="0.357586794323293" ixz="-5.9825947327725" iyy="16.8076547081665" iyz="0.313167595336379" izz="5.29248954036271" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_5.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_5.STL" />
             </geometry>
             <material name="">
                 <color rgba="1 1 0 1" />
@@ -165,79 +179,51 @@
         <collision>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_5.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_5.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_5" type="revolute">
-        <origin xyz="0.92436 0 0.53588" rpy="3.1416 -0.25867 3.1416" />
+        <origin xyz="0.90151 0 -0.00052875" rpy="0 0 0" />
         <parent link="Link_4" />
         <child link="Link_5" />
-        <axis xyz="0 1 0" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <axis xyz="0 -1 0" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
     <link name="Link_6">
         <inertial>
-            <origin xyz="0.12280626304832 0.10284172733946 -0.0673247079199191" rpy="0 0 0" />
-            <mass value="8.19341168850207" />
-            <inertia ixx="1.25065484857243" ixy="-0.370837141231599" ixz="-0.214061773475593" iyy="0.581725625286335" iyz="-0.544088624970368" izz="1.03166251957125" />
+            <origin xyz="-0.0165412016845266 0.0951891558056374 0.119534910446276" rpy="0 0 0" />
+            <mass value="0.789056328743544" />
+            <inertia ixx="0.00166815677862568" ixy="-0.000330967965728139" ixz="6.08102317073045E-06" iyy="0.00102524254386583" iyz="-1.68914833733875E-06" izz="0.0013292952791531" />
         </inertial>
         <visual>
             <origin xyz="0 0 0" rpy="0 0 0" />
             <geometry>
-                <mesh filename="package://a9/meshes/Link_6.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_6.STL" />
             </geometry>
             <material name="">
-                <color rgba="1 1 0 1" />
+                <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://a9/meshes/Link_6.STL" />
+                <mesh filename="package://fanuc_ry/meshes/Link_6.STL" />
             </geometry>
         </collision>
     </link>
     <joint name="joint_6" type="revolute">
-        <origin xyz="0.037697 -0.0006997 -0.064094" rpy="0.44032 0.19669 -0.83053" />
+        <origin xyz="0.093994 0 0.0005287" rpy="0 -1.57 3.14" />
         <parent link="Link_5" />
         <child link="Link_6" />
-        <axis xyz="0.49999 0 -0.86603" />
-        <limit lower="-3.8" upper="3.8" effort="0" velocity="0" />
+        <axis xyz="0 0 -1" />
+        <limit lower="-3" upper="3" effort="0" velocity="0" />
     </joint>
-    <link name="Link_7">
-        <inertial>
-            <origin xyz="0.0296425829147993 -6.47728578861279E-06 0.162281442392356" rpy="0 0 0" />
-            <mass value="7.07143232149748" />
-            <inertia ixx="0.0103947066541271" ixy="8.00167786886164E-07" ixz="0.00131122028195651" iyy="0.0112643862205598" iyz="-2.38846633634112E-06" izz="0.0065729384023248" />
-        </inertial>
-        <visual>
-            <origin xyz="0 0 0" rpy="0 0 0" />
-            <geometry>
-                <mesh filename="package://a9/meshes/Link_7.STL" />
-            </geometry>
-            <material name="">
-                <color rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
-            </material>
-        </visual>
-        <collision>
-            <origin xyz="0 0 0" rpy="0 0 0" />
-            <geometry>
-                <mesh filename="package://a9/meshes/Link_7.STL" />
-            </geometry>
-        </collision>
-    </link>
-    <joint name="joint_7" type="fixed">
-        <origin xyz="0 0 0" rpy="-2.6972 0.28661 -2.1066" />
+    <link name="link_tool" />
+    <joint name="joint_tool" type="fixed">
         <parent link="Link_6" />
-        <child link="Link_7" />
-        <axis xyz="0 0 0" />
-    </joint>
-    <link name="end_link_now" />
-    <joint name="end_joint" type="fixed">
-        <parent link="Link_7" />
-        <child link="end_link_now" />
-        <origin xyz="-0.045 0.0 0.4" rpy="0.0 0.4 3.14" />
+        <child link="link_tool" />
+        <origin xyz="0.051 0.1209 0.3107" rpy="0 0 0" />
     </joint>
     <transmission name="trans_joint_1">
         <type>transmission_interface/SimpleTransmission</type>

+ 0 - 0
ren_yuan/src/robot_config/config/joint_limits.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/joint_limits.yaml


+ 0 - 0
ren_yuan/src/robot_config/config/kinematics.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/kinematics.yaml


+ 2 - 1
ren_yuan/src/robot_config/config/ompl_planning.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/ompl_planning.yaml

@@ -165,7 +165,6 @@ planner_configs:
     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:
-  default_planner_config: RRTConnect
   planner_configs:
     - AnytimePathShortening
     - SBL
@@ -194,3 +193,5 @@ manipulator:
     - AITstar
     - ABITstar
     - BITstar
+  projection_evaluator: joints(joint1,joint2)
+  longest_valid_segment_fraction: 0.001

+ 0 - 0
ren_yuan/src/robot_config/config/ros_controllers.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/ros_controllers.yaml


+ 1 - 2
ren_yuan/src/robot_config/config/sensors_3d.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/sensors_3d.yaml

@@ -6,5 +6,4 @@ sensors:
     padding_scale: 1.0
     point_cloud_topic: /pointcloud/output
     point_subsample: 1
-    sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
-
+    sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater

+ 0 - 0
ren_yuan/src/robot_config/config/simple_moveit_controllers.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/simple_moveit_controllers.yaml


+ 0 - 0
ren_yuan/src/robot_config/config/stomp_planning.yaml → ren_yuan/src/fanuc_ry_moveit_config/config/stomp_planning.yaml


+ 1 - 1
ren_yuan/src/robot_config/launch/chomp_planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/chomp_planning_pipeline.launch.xml

@@ -17,5 +17,5 @@
   <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 robot_config)/config/chomp_planning.yaml" />
+  <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/chomp_planning.yaml" />
 </launch>

+ 1 - 1
ren_yuan/src/robot_config/launch/default_warehouse_db.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/default_warehouse_db.launch

@@ -2,7 +2,7 @@
 
   <arg name="reset" default="false"/>
   <!-- If not specified, we'll use a default database location -->
-  <arg name="moveit_warehouse_database_path" default="$(find robot_config)/default_warehouse_mongo_db" />
+  <arg name="moveit_warehouse_database_path" default="$(find fanuc_ry_moveit_config)/default_warehouse_mongo_db" />
 
   <!-- Launch the warehouse with the configured database location -->
   <include file="$(dirname)/warehouse.launch">

+ 1 - 1
ren_yuan/src/robot_config/launch/demo.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/demo.launch

@@ -6,7 +6,7 @@
   <!-- 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 robot_config)/default_warehouse_mongo_db" />
+  <arg name="db_path" default="$(find fanuc_ry_moveit_config)/default_warehouse_mongo_db" />
 
   <!-- By default, we are not in debug mode -->
   <arg name="debug" default="false" />

+ 0 - 0
ren_yuan/src/robot_config/launch/demo_gazebo.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/demo_gazebo.launch


+ 1 - 1
ren_yuan/src/robot_config/launch/fake_moveit_controller_manager.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/fake_moveit_controller_manager.launch.xml

@@ -7,6 +7,6 @@
   <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 robot_config)/config/fake_controllers.yaml"/>
+  <rosparam subst_value="true" file="$(find fanuc_ry_moveit_config)/config/fake_controllers.yaml"/>
 
 </launch>

+ 0 - 0
ren_yuan/src/robot_config/launch/a9_moveit_sensor_manager.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/fanuc_ry_moveit_sensor_manager.launch.xml


+ 2 - 2
ren_yuan/src/robot_config/launch/gazebo.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/gazebo.launch

@@ -13,7 +13,7 @@
   </include>
 
   <!-- Set the robot urdf on the parameter server -->
-  <param name="robot_description" textfile="$(find robot_config)/config/gazebo_a9.urdf" />
+  <param name="robot_description" textfile="$(find fanuc_ry_moveit_config)/config/gazebo_fanuc_ry.urdf" />
 
   <!-- Unpause the simulation after loading the robot model -->
   <arg name="unpause" value="$(eval '' if arg('paused') else '-unpause')" />
@@ -23,7 +23,7 @@
     respawn="false" output="screen" />
 
   <!-- Load the controller parameters onto the parameter server -->
-  <rosparam file="$(find robot_config)/config/gazebo_controllers.yaml" />
+  <rosparam file="$(find fanuc_ry_moveit_config)/config/gazebo_controllers.yaml" />
   <include file="$(dirname)/ros_controllers.launch"/>
 
   <!-- Spawn the Gazebo ROS controllers -->

+ 0 - 0
ren_yuan/src/robot_config/launch/joystick_control.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/joystick_control.launch


+ 1 - 1
ren_yuan/src/robot_config/launch/move_group.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/move_group.launch

@@ -77,7 +77,7 @@
 
   <!-- Sensors Functionality -->
   <include ns="move_group" file="$(dirname)/sensor_manager.launch.xml" if="$(arg allow_trajectory_execution)">
-    <arg name="moveit_sensor_manager" value="a9" />
+    <arg name="moveit_sensor_manager" value="fanuc_ry" />
   </include>
 
   <!-- Start the actual move_group node/action server -->

+ 80 - 90
ren_yuan/src/robot_config/launch/moveit.rviz → ren_yuan/src/fanuc_ry_moveit_config/launch/moveit.rviz

@@ -5,10 +5,11 @@ Panels:
     Property Tree Widget:
       Expanded:
         - /MotionPlanning1/Scene Geometry1
-        - /MotionPlanning1/Planning Request1
-        - /RobotModel1/Links1
+        - /TF1/Frames1
+        - /TF1/Tree1
+        - /Axes1
       Splitter Ratio: 0.5
-    Tree Height: 370
+    Tree Height: 808
   - Class: rviz/Help
     Name: Help
   - Class: rviz/Views
@@ -39,7 +40,7 @@ Visualization Manager:
         Z: 0
       Plane: XY
       Plane Cell Count: 10
-      Reference Frame: base_link
+      Reference Frame: world_link
       Value: true
     - Acceleration_Scaling_Factor: 0.1
       Class: moveit_rviz_plugin/MotionPlanning
@@ -103,21 +104,16 @@ Visualization Manager:
             Show Axes: false
             Show Trail: false
             Value: true
-          Link_7:
-            Alpha: 1
-            Show Axes: false
-            Show Trail: false
-            Value: true
           base_link:
             Alpha: 1
             Show Axes: false
             Show Trail: false
             Value: true
-          end_link_now:
+          link_tool:
             Alpha: 1
             Show Axes: false
             Show Trail: false
-          world:
+          world_link:
             Alpha: 1
             Show Axes: false
             Show Trail: false
@@ -150,7 +146,7 @@ Visualization Manager:
         Show Workspace: false
         Start State Alpha: 1
         Start State Color: 0; 255; 0
-      Planning Scene Topic: move_group/monitored_planning_scene
+      Planning Scene Topic: /move_group/monitored_planning_scene
       Robot Description: robot_description
       Scene Geometry:
         Scene Alpha: 1
@@ -197,21 +193,16 @@ Visualization Manager:
             Show Axes: false
             Show Trail: false
             Value: true
-          Link_7:
-            Alpha: 1
-            Show Axes: false
-            Show Trail: false
-            Value: true
           base_link:
             Alpha: 1
             Show Axes: false
             Show Trail: false
             Value: true
-          end_link_now:
+          link_tool:
             Alpha: 1
             Show Axes: false
             Show Trail: false
-          world:
+          world_link:
             Alpha: 1
             Show Axes: false
             Show Trail: false
@@ -220,6 +211,63 @@ Visualization Manager:
         Show Robot Visual: false
       Value: true
       Velocity_Scaling_Factor: 0.1
+    - Class: rviz/TF
+      Enabled: true
+      Filter (blacklist): ""
+      Filter (whitelist): ""
+      Frame Timeout: 15
+      Frames:
+        All Enabled: false
+        Link_1:
+          Value: false
+        Link_2:
+          Value: false
+        Link_3:
+          Value: false
+        Link_4:
+          Value: false
+        Link_5:
+          Value: false
+        Link_6:
+          Value: false
+        base_link:
+          Value: true
+        link_tool:
+          Value: false
+        world_link:
+          Value: false
+      Marker Alpha: 1
+      Marker Scale: 1
+      Name: TF
+      Show Arrows: false
+      Show Axes: true
+      Show Names: false
+      Tree:
+        world_link:
+          base_link:
+            Link_1:
+              Link_2:
+                Link_3:
+                  Link_4:
+                    Link_5:
+                      Link_6:
+                        link_tool:
+                          {}
+      Update Interval: 0
+      Value: true
+    - Class: rviz/MarkerArray
+      Enabled: true
+      Marker Topic: /rviz_visual_tools
+      Name: MarkerArray
+      Namespaces:
+        Path: true
+        Text: true
+        point0  1.260560  -0.018740  1.496050: true
+        point0  1.334610  -0.019910  1.499610: true
+        point1  1.260620  0.017340  1.498150: true
+        point1  1.334480  0.017110  1.498570: true
+      Queue Size: 100
+      Value: true
     - Alpha: 1
       Class: rviz/RobotModel
       Collision Enabled: false
@@ -260,21 +308,16 @@ Visualization Manager:
           Show Axes: false
           Show Trail: false
           Value: true
-        Link_7:
-          Alpha: 1
-          Show Axes: false
-          Show Trail: false
-          Value: true
         base_link:
           Alpha: 1
           Show Axes: false
           Show Trail: false
           Value: true
-        end_link_now:
+        link_tool:
           Alpha: 1
           Show Axes: false
           Show Trail: false
-        world:
+        world_link:
           Alpha: 1
           Show Axes: false
           Show Trail: false
@@ -284,73 +327,20 @@ Visualization Manager:
       Update Interval: 0
       Value: true
       Visual Enabled: true
-    - Class: rviz/MarkerArray
-      Enabled: true
-      Marker Topic: rviz_visual_tools
-      Name: MarkerArray
-      Namespaces:
-        {}
-      Queue Size: 100
-      Value: true
     - Alpha: 1
       Class: rviz/Axes
       Enabled: true
-      Length: 0.054999999701976776
+      Length: 0.07999999821186066
       Name: Axes
       Radius: 0.009999999776482582
-      Reference Frame: end_link_now
+      Reference Frame: link_tool
       Show Trail: false
       Value: true
-    - Class: rviz/TF
-      Enabled: false
-      Filter (blacklist): ""
-      Filter (whitelist): ""
-      Frame Timeout: 15
-      Frames:
-        All Enabled: true
-      Marker Alpha: 1
-      Marker Scale: 1
-      Name: TF
-      Show Arrows: true
-      Show Axes: true
-      Show Names: true
-      Tree:
-        {}
-      Update Interval: 0
-      Value: false
-    - 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: Intensity
-      Decay Time: 0
-      Enabled: false
-      Invert Rainbow: false
-      Max Color: 255; 255; 255
-      Min Color: 0; 0; 0
-      Name: PointCloud2
-      Position Transformer: XYZ
-      Queue Size: 10
-      Selectable: true
-      Size (Pixels): 3
-      Size (m): 0.009999999776482582
-      Style: Flat Squares
-      Topic: /pointcloud/output
-      Unreliable: false
-      Use Fixed Frame: true
-      Use rainbow: true
-      Value: false
   Enabled: true
   Global Options:
     Background Color: 48; 48; 48
     Default Light: true
-    Fixed Frame: base_link
+    Fixed Frame: world_link
     Frame Rate: 30
   Name: root
   Tools:
@@ -362,7 +352,7 @@ Visualization Manager:
   Views:
     Current:
       Class: rviz/Orbit
-      Distance: 2.2325363159179688
+      Distance: 0.2017788290977478
       Enable Stereo Rendering:
         Stereo Eye Separation: 0.05999999865889549
         Stereo Focal Distance: 1
@@ -370,17 +360,17 @@ Visualization Manager:
         Value: false
       Field of View: 0.75
       Focal Point:
-        X: 0.9615159630775452
-        Y: -0.2659122049808502
-        Z: -1.0034211874008179
+        X: -1.2660410404205322
+        Y: 0.010858980938792229
+        Z: 0.6525150537490845
       Focal Shape Fixed Size: true
       Focal Shape Size: 0.05000000074505806
       Invert Z Axis: false
       Name: Current View
       Near Clip Distance: 0.009999999776482582
-      Pitch: 0.5497965812683105
-      Target Frame: world
-      Yaw: 5.431985855102539
+      Pitch: 0.07520197331905365
+      Target Frame: world_link
+      Yaw: 3.3168013095855713
     Saved: ~
 Window Geometry:
   Displays:
@@ -394,7 +384,7 @@ Window Geometry:
     collapsed: false
   MotionPlanning - Trajectory Slider:
     collapsed: false
-  QMainWindow State: 000000ff00000000fd0000000100000000000001f3000003b9fc0200000007fb000000100044006900730070006c006100790073010000003d00000203000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a00560069006500770073000000010c000000a4000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000001600000016fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e00670100000246000001b00000017d00ffffff00000587000003b900000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+  QMainWindow State: 000000ff00000000fd0000000100000000000001f3000003b9fc0200000007fb000000100044006900730070006c006100790073010000003d000003b9000000c900fffffffb0000000800480065006c00700000000342000000bb0000006e00fffffffb0000000a00560069006500770073000000010c000000a4000000a400fffffffb0000000c00430061006d00650072006100000002ff000001610000000000000000fb0000001e004d006f00740069006f006e00200050006c0061006e006e0069006e00670100000374000001890000000000000000fb00000044004d006f00740069006f006e0050006c0061006e006e0069006e00670020002d0020005400720061006a006500630074006f0072007900200053006c00690064006500720000000000ffffffff0000001600000016fb0000001c004d006f00740069006f006e0050006c0061006e006e0069006e00670000000254000001a20000017d00ffffff00000587000003b900000001000000020000000100000002fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
   Views:
     collapsed: false
   Width: 1920

+ 0 - 0
ren_yuan/src/robot_config/launch/moveit_rviz.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/moveit_rviz.launch


+ 2 - 2
ren_yuan/src/robot_config/launch/ompl-chomp_planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/ompl-chomp_planning_pipeline.launch.xml

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

+ 1 - 1
ren_yuan/src/robot_config/launch/ompl_planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/ompl_planning_pipeline.launch.xml

@@ -19,6 +19,6 @@
   <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 robot_config)/config/ompl_planning.yaml"/>
+  <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/ompl_planning.yaml"/>
 
 </launch>

+ 0 - 0
ren_yuan/src/robot_config/launch/pilz_industrial_motion_planner_planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/pilz_industrial_motion_planner_planning_pipeline.launch.xml


+ 5 - 5
ren_yuan/src/robot_config/launch/planning_context.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/planning_context.launch

@@ -6,20 +6,20 @@
   <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 a9)/urdf/a9.urdf"/>
+  <param if="$(arg load_robot_description)" name="$(arg robot_description)" textfile="$(find fanuc_ry)/urdf/fanuc_ry.urdf"/>
 
   <!-- The semantic description that corresponds to the URDF -->
-  <param name="$(arg robot_description)_semantic" textfile="$(find robot_config)/config/a9.srdf" />
+  <param name="$(arg robot_description)_semantic" textfile="$(find fanuc_ry_moveit_config)/config/fanuc_ry.srdf" />
 
   <!-- Load updated joint limits (override information from URDF) -->
   <group ns="$(arg robot_description)_planning">
-    <rosparam command="load" file="$(find robot_config)/config/joint_limits.yaml"/>
-    <rosparam command="load" file="$(find robot_config)/config/cartesian_limits.yaml"/>
+    <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/joint_limits.yaml"/>
+    <rosparam command="load" file="$(find fanuc_ry_moveit_config)/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 robot_config)/config/kinematics.yaml"/>
+    <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/kinematics.yaml"/>
 
   </group>
 

+ 0 - 0
ren_yuan/src/robot_config/launch/planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/planning_pipeline.launch.xml


+ 0 - 0
ren_yuan/src/robot_config/launch/ros_control_moveit_controller_manager.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/ros_control_moveit_controller_manager.launch.xml


+ 1 - 1
ren_yuan/src/robot_config/launch/ros_controllers.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/ros_controllers.launch

@@ -2,7 +2,7 @@
 <launch>
 
   <!-- Load joint controller configurations from YAML file to parameter server -->
-  <rosparam file="$(find robot_config)/config/ros_controllers.yaml" command="load"/>
+  <rosparam file="$(find fanuc_ry_moveit_config)/config/ros_controllers.yaml" command="load"/>
 
   <!-- Load the controllers -->
   <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"

+ 1 - 1
ren_yuan/src/robot_config/launch/run_benchmark_ompl.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/run_benchmark_ompl.launch

@@ -15,7 +15,7 @@
 
   <!-- 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 robot_config)/config/ompl_planning.yaml"/>
+    <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/ompl_planning.yaml"/>
   </node>
 
 </launch>

+ 5 - 9
ren_yuan/src/robot_config/launch/sensor_manager.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/sensor_manager.launch.xml

@@ -3,19 +3,15 @@
   <!-- This file makes it easy to include the settings for sensor managers -->
 
   <!-- Params for 3D sensors config -->
-  <rosparam command="load" file="$(find robot_config)/config/sensors_3d.yaml" />
-  <!-- <rosparam command="load" file="$(find lstrobot_moveit_config_0605)/config/sensors_3d2.yaml" /> -->
+  <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/sensors_3d.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" /> 
+  <param name="octomap_resolution" type="double" value="0.002" />
+  <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="a9" />
+  <arg name="moveit_sensor_manager" default="fanuc_ry" />
   <include file="$(dirname)/$(arg moveit_sensor_manager)_moveit_sensor_manager.launch.xml" />
 
-
-
 </launch>

+ 1 - 1
ren_yuan/src/robot_config/launch/setup_assistant.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/setup_assistant.launch

@@ -8,7 +8,7 @@
 
   <!-- Run -->
   <node pkg="moveit_setup_assistant" type="moveit_setup_assistant" name="moveit_setup_assistant"
-        args="--config_pkg=robot_config"
+        args="--config_pkg=fanuc_ry_moveit_config"
         launch-prefix="$(arg launch_prefix)"
         required="true"
         output="screen" />

+ 2 - 2
ren_yuan/src/robot_config/launch/simple_moveit_controller_manager.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/simple_moveit_controller_manager.launch.xml

@@ -3,6 +3,6 @@
   <param name="moveit_controller_manager" value="moveit_simple_controller_manager/MoveItSimpleControllerManager" />
 
   <!-- Load controller list to the parameter server -->
-  <rosparam file="$(find robot_config)/config/simple_moveit_controllers.yaml" />
-  <rosparam file="$(find robot_config)/config/ros_controllers.yaml" />
+  <rosparam file="$(find fanuc_ry_moveit_config)/config/simple_moveit_controllers.yaml" />
+  <rosparam file="$(find fanuc_ry_moveit_config)/config/ros_controllers.yaml" />
 </launch>

+ 1 - 1
ren_yuan/src/robot_config/launch/stomp_planning_pipeline.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/stomp_planning_pipeline.launch.xml

@@ -19,5 +19,5 @@
   <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 robot_config)/config/stomp_planning.yaml"/>
+  <rosparam command="load" file="$(find fanuc_ry_moveit_config)/config/stomp_planning.yaml"/>
 </launch>

+ 0 - 0
ren_yuan/src/robot_config/launch/trajectory_execution.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/trajectory_execution.launch.xml


+ 0 - 0
ren_yuan/src/robot_config/launch/warehouse.launch → ren_yuan/src/fanuc_ry_moveit_config/launch/warehouse.launch


+ 0 - 0
ren_yuan/src/robot_config/launch/warehouse_settings.launch.xml → ren_yuan/src/fanuc_ry_moveit_config/launch/warehouse_settings.launch.xml


+ 5 - 5
ren_yuan/src/robot_config/package.xml → ren_yuan/src/fanuc_ry_moveit_config/package.xml

@@ -1,12 +1,12 @@
 <package>
 
-  <name>robot_config</name>
+  <name>fanuc_ry_moveit_config</name>
   <version>0.3.0</version>
   <description>
-     An automatically generated package with all the configuration and launch files for using the a9 with the MoveIt Motion Planning Framework
+     An automatically generated package with all the configuration and launch files for using the fanuc_ry with the MoveIt Motion Planning Framework
   </description>
-  <author email="123@163.com">123</author>
-  <maintainer email="123@163.com">123</maintainer>
+  <author email="ryrobot@123.com">ryrobot</author>
+  <maintainer email="ryrobot@123.com">ryrobot</maintainer>
 
   <license>BSD</license>
 
@@ -35,7 +35,7 @@
   <!-- <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>a9</run_depend>
+  <run_depend>fanuc_ry</run_depend>
 
 
 </package>

+ 51 - 0
ren_yuan/src/lst_robot_r/README.md

@@ -0,0 +1,51 @@
+## README
+### 1.运行代码
+1. source工作空间
+2. sudo chmod +x *.py文件
+3. roslaunch lst_robot_r start.launch
+
+### 2.package(SRC)
+1. **lst_robot_r**  
+1.1 **launch**-launch启动文件  
+2.2 **msg**-自定义消息  
+3.3 **scripts**-Python代码  
+
+2. **a9**  
+2.1 **config**-机械臂先关配置文件  
+2.2 **launch**-launch启动文件  
+2.3 **meshes**-机械臂STL文件  
+2.4 **urdf**-机械臂urdf模型  
+
+3. **robot_config**  
+3.1 **config**-moveit配置文件,常用srdf(修改机器人配置)  
+3.2 **launch**-launch启动文件,包括demo.launch文件  
+
+4. **Data**  
+4.1 点云数据,起始点终点数据,导出的其他的数据(轨迹关节值、末端执行器笛卡尔坐标)  
+
+5. **visual**  
+5.1 规划结果可视化  
+
+## 2024.9.30
+- 添加修改笛卡尔路径参数的函数(速度,加速度)
+- 修正机械臂的初始姿态(home位姿)
+- 修改焊接姿态,固定焊接位姿
+
+## 2024.10.12
+- 增加点云数据,起始点终点数据,测试碰撞检测
+
+## 2024.10.17
+- 修改规划逻辑(简单避障),规划完一条焊缝后,末端执行器向上移动0.1m,然后继续规划下一条焊缝
+- 修改urdf关节运动范围为FAUNC m10iA-8L实际运动范围  
+
+## 2024.10.29
+- 配置机械臂moveit_config文件
+- 修改仿真模型为fanuc_m10iA/8l
+- 更新2024-9-23-L/try分支代码为最新
+
+## 2024.10.30
+- 待完成:尝试使用plan()代替compute_cartesian_path(),来进行全局避障规划(会出现翻转的情况,应该是初始位姿的问题)
+- 待完成:尝试使用OMPL-CHOMP规划适配器进行规划,即前端使用OMPL获得初始路径,后端使用CHOMP对路径进行优化,提高精度和避障效果
+
+## 2024.10.31(hjsx.py)
+- 修改焊接顺序,使得两条平行焊缝的焊接方向相同

+ 475 - 0
ren_yuan/src/lst_robot_r/hanqiangpose.py

@@ -0,0 +1,475 @@
+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):
+    #旋转矩阵  X  Z
+    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):#d读 Tw2c.txt 一个4x4矩阵?
+    """相机和基底坐标系的转换关系"""
+    # 读取文件
+    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]#3x3部分
+    tw2c = data[:3,-1]#三行四列部分  没有写成列向量??? python 转置都一样?
+
+    # print("RW2c")
+    # print(Rw2c)
+    # print("tw2c")
+    # print(tw2c)
+    # print(tw2c.T)
+    Rc2w = Rw2c.T#求转置矩阵
+    tc2w = -np.matmul(Rc2w, tw2c)#计算矩阵乘积
+    
+    return Rc2w,tc2w
+
+def compute_pose_R(fangxiang, hanfeng,start_point, end_point):
+    """wg根据计算出的焊接时z轴负方向的向量(fangxiang)和由起点指向终点的向量(hanfeng)计算旋转矩阵""" #得到的是fangxiang向量相对于基坐标系原点的姿态变换矩阵 多了个绕x转180的变换
+    x, y, z = fangxiang
+
+    # 计算旋转角度
+    rotx = -np.arctan2(y, z)#投影到yz平面的的夹角
+    roty = np.arctan2(x, np.sqrt(y**2 + z**2))#向量和yz面的夹角
+
+    # 构造旋转矩阵 rot x y   先绕x转不影响向量和yz面的夹角?
+    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))#先转到XOZ  再转到X  相当于通过将方向向量转到z轴上的方式 让焊缝向量转到XOY平面 通过方向向量和焊缝向量的正交关系求出向量在Z轴上的转角
+    # 区分平缝竖缝
+    angle = calculate_angle_with_xy_plane(start_point,end_point)#计算起始点的向量与xy平面的夹角
+    ispingfeng = abs(angle) < 30
+    if ispingfeng: #一个是y起转 一个是x起转  差90度  不然竖缝的话焊枪就朝向两面开口方向  差90度就是能够向上的同时朝向开口方向
+        rotz = np.arctan2(bb[0], -bb[1])
+    else:
+        rotz = np.arctan2(bb[1], bb[0])
+    # 构造旋转矩阵 rot z x
+    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)))
+    #A*(B*(C*D))              x*y*z*x(180)
+    return R_mat, ispingfeng
+#TODO 
+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)) #返回这些点相对tree的索引数组
+    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#返回 distances 中符合条件的元素的下标的列表
+    # 使用布尔索引过滤出符合条件的索引
+    filtered_indices = indices[distance_filter]#根据布尔索引 从 distance_filter 返回indices对应元素的列表 也就是符合条件的点的下标
+    # 提取符合条件的点
+    data_circular = data[filtered_indices]#
+
+    #以上步骤筛选点云中距离 midpoint(焊缝向量的中点) 周围半径r=30内的所有点 并再次筛选出这些点到 midpoint 的距离大于10的点
+
+    # 可视化
+    # 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))#利用点积公式得到cos值
+        
+        if abs(anglecos) <= 0.015:#如果cos<=0.015 也就是角度 >=89.14
+            # 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])
+
+    #至此 获取了刚刚提取的  10<r<30 的点云中 垂直于中点为起点的 垂直方向的点云(一个小半扇形)
+ ##################################################
+ ##################################################
+    random_point = data_shu[np.random.randint(0, len(data_shu))]#获取data中任意一点
+    # 与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)#得到v的终点离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 只有一列,侧着拍得外缝
+    #如果距离都小于10说明 在焊缝向量中点10<r<30的球体内 取的所有的垂直焊缝的点都在同一平面上也就是说点云只有焊缝的其中一个面  只有侧着拍外缝或某种角度拍内缝才会出现
+    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#应该是取法向量上距离 midpoint 为50的两个点
+        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 #得到焊接方向?  1:1.2是 与法向量所垂直平面 50°
+
+        R_mat, ispingfeng = compute_pose_R(fangxiang, hanfeng, start_point, end_point)#应该是焊缝向量到焊枪位姿的转换(焊枪位姿和焊接方向fangxiang是相反的方向)?
+        if ispingfeng:#左右歪的角度---平缝绕焊枪的x转  竖缝绕焊枪的y转  应该都是右乘 相对于自己的轴转  
+            ##偏转矩阵 x  x  z  ##
+            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)#如果z轴朝上了 将它转180  问题是咋会朝下
+            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()#应该是RPY转四元数
+            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:
+            ##偏转矩阵 y ##
+            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(40) and angle_rad < np.deg2rad(140):  #40 到 140度的夹角都加入计算 原本是20 到180
+                found = True
+                # 如果找到了,则保存vector2
+            else:
+                continue
+
+        # 计算并保存最终的fangxiang向量, vector1与vector2均为单位向量
+        vector1_sim_to_z = np.dot(vector1, [0,0,1]) / (np.linalg.norm(vector1))#计算vector1 在 z 轴方向上的投影,也就是 vector1 的 z 分量。
+        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公式      35.26°
+            yaw_pz =atan(1 / (sqrt(2) * tan(yaw)))#不懂为啥这么变换   反正变换了肯定是比原来角度小?
+            #print(f"yaw:{degrees(yaw)},yaw_pz:{degrees(yaw_pz)}")
+            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")#偏航角过渡速度(角度变化45度/100mm)
+    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)#读points_guihua.txt 并处理得到起点 终点 中点 向量
+
+    # 计算位姿
+    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()

+ 0 - 70
ren_yuan/src/lst_robot_r/scripts/CloudFunc.py

@@ -1,70 +0,0 @@
-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])

+ 0 - 145
ren_yuan/src/lst_robot_r/scripts/check.py

@@ -1,145 +0,0 @@
-import rospy, sys
-import numpy as np
-from tf.transformations import euler_from_quaternion,quaternion_from_euler,quaternion_from_euler, quaternion_multiply
-
-#####检查关节限位#####
-def check_joint_positions(joint_trajectory):
-    is_limited = False      #初始化为满足限制条件
-    Limit_margin = True     #限制边界,初始化为True,用来检查是否超出限制条件
-    
-    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)):    #遍历但前轨迹点的每个关节点,这里是joint_positions1
-                position_diff = abs(joint_positions1[j] - joint_positions2[j])  #计算相邻关节轨迹点的关节点绝对差值,归一化到[-pi,pi]
-                
-                if position_diff > 6:   #限位阈值,6rad=343.8度
-                    rospy.loginfo("发生大角度翻转: point{}-joint{}:{}".format(i,j+1,joint_positions1))
-                    
-                    #关节限位值
-                    joint_limt =[[],[],[],[-1.6,1.6],[],[-3.838,3.838]] 
-                    
-                    #设定限位点为当前关节点
-                    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.3:        
-                        Limit_margin = True  
-                    else:
-                        Limit_margin = False
-                    rospy.loginfo("margin = {}".format(margin))
-                    is_limited = True           
-                    break
-                
-                if position_diff > 3:    #限位阈值,3rad=171.9度
-                    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("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])     #len>6,默认为四元数
-    if axis == 'z':
-        q_rotation = quaternion_from_euler(0, 0, angle)     #绕z轴旋转,转换得到关于z轴的旋转四元数
-    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)      #q_new为调整后的姿态四元数,值初始姿态四元数乘以旋转四元数
-    pose[3:] = q_new    #将q_new放入pose列表中的3号索引以后的位置
-    return pose
-
-
-
-# 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")
-    
-
-
-

+ 2 - 2
ren_yuan/src/lst_robot_r/scripts/command.py

@@ -3,7 +3,7 @@ import subprocess
 import rospy
 import os
 
-file_path = "moveitServer2"
+#file_path = "moveitServer2"
 script_directory = os.path.dirname(os.path.abspath(__file__))
 
 import signal
@@ -25,7 +25,7 @@ def load_visual():
     command = "rosrun visual visual_node"
     subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', command])
 def load_rviz():
-    command = "roslaunch robot_config demo.launch"
+    command = "roslaunch fanuc_ry_moveit_config demo.launch"
     subprocess.Popen(['gnome-terminal', '--', 'bash', '-c', command])
 def launch_publish_pointcloud():
     file_name = "dycl_0506.py"

+ 0 - 16
ren_yuan/src/lst_robot_r/scripts/decorator_time.py

@@ -1,16 +0,0 @@
-#!/usr/bin/env python3
-import rospy
-import time
-
-#定义一个装饰器,用来计算函数运行时间
-#使用方法:在需要计算运行时间的函数前面加上@decorator_time
-
-def decorator_time(func):
-    def wrapper(*args, **kwargs):
-        start_time = time.time()
-        result = func(*args, **kwargs)
-        end_time = time.time()
-        elapsed_time = end_time - start_time
-        rospy.loginfo(f"Time taken by {func.__name__}: {elapsed_time:.4f} seconds")
-        return result
-    return wrapper

+ 2 - 2
ren_yuan/src/lst_robot_r/scripts/dycl_0506.py

@@ -82,7 +82,7 @@ def load_point_cloud_from_binary_txt(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)
+#pcd = pcd.voxel_down_sample(voxel_size = 4)
 
 ################################去掉焊缝周围的点云#################################
 # 计算焊缝向量
@@ -112,7 +112,7 @@ ptCloud_scaled2.points = o3d.utility.Vector3dVector(data_scaled2)
 def build_pointcloud2_msg(points):
     msg = PointCloud2()
     msg.header.stamp = rospy.Time(0)
-    msg.header.frame_id = "world"#base_link
+    msg.header.frame_id = "world_link"
 
     if len(points.shape) == 3:
         msg.height = points.shape[1]

+ 0 - 90
ren_yuan/src/lst_robot_r/scripts/hanqiangpose.py

@@ -1,90 +0,0 @@
-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,sin,cos
-
-def rpy2quaternion(roll, pitch, yaw):#zyx
-    x=sin(roll/2)*cos(pitch/2)*cos(yaw/2)-cos(roll/2)*sin(pitch/2)*sin(yaw/2)
-    y=cos(roll/2)*sin(pitch/2)*cos(yaw/2)+sin(roll/2)*cos(pitch/2)*sin(yaw/2)
-    z=cos(roll/2)*cos(pitch/2)*sin(yaw/2)-sin(roll/2)*sin(pitch/2)*cos(yaw/2)
-    w=cos(roll/2)*cos(pitch/2)*cos(yaw/2)+sin(roll/2)*sin(pitch/2)*sin(yaw/2)
-    return [x, y, z, w]
-
-
-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 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 run():
-    file_path = rospy.get_param("folder_path")
-    file_path_points = os.path.join(file_path, 'points_guihua.txt')
-    file_path_result = os.path.join(file_path, 'result.txt')
-
-    result=[]
-    start_points, end_points, midpoints, hanfeng = get_hanfeng(file_path_points)
-    # 计算位姿
-    for i in range(len(hanfeng)): 
-        if(calculate_angle_with_xy_plane(start_points[i], end_points[i])<45):#平缝
-            q1 = rpy2quaternion(0,0,3*np.pi/4)    #ping
-            q2 = rpy2quaternion(0,0,3*np.pi/4)
-            result.append(("s", start_points[i], end_points[i], q1, q2))
-        else:
-            q1 = rpy2quaternion(0,np.pi/4,0)      #shu
-            q2 = rpy2quaternion(0,np.pi/4,0)
-            result.append(("s", start_points[i], end_points[i], q1, q2))
-
-
-    # 打开文件准备写入
-    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()
-    

+ 148 - 65
ren_yuan/src/lst_robot_r/scripts/hjsx.py

@@ -1,11 +1,14 @@
 import numpy as np
 import os
 import rospy
-from math import acos, degrees
+from math import acos, degrees,tan,atan,sqrt,sin,cos
+from scipy.spatial.transform import Rotation as R
 
+#求向量的模
 def calculate_distance(point1, point2):
     return np.linalg.norm(np.array(point1) - np.array(point2))
 
+#计算焊缝向量与xy平面夹角 用于判断是平缝还是竖缝
 def calculate_angle_with_xy_plane(point1,point2):
     # 计算方向向量
     dir_vector = np.array([point2[0] - point1[0], point2[1] - point1[1], point2[2] - point1[2]])
@@ -19,16 +22,9 @@ def calculate_angle_with_xy_plane(point1,point2):
 
     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):
+
+# 从文件中读取焊缝起点和终点,并分为平缝和竖缝
+def read_hanfeng_from_point_txt(file_path):
 
     data_ping, data_shu = [],[]
 
@@ -50,95 +46,182 @@ def get_hanfeng(file_path):
 
         angle = calculate_angle_with_xy_plane(point1,point2)
         
-        if abs(angle) < 30:     #与xy平面夹角小于30
+        if abs(angle) <  rospy.get_param("ping_sta"):#用于判断平缝的角
             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
+    return data_ping, data_shu
 
 
-################################################################################################################
-################################################################################################################
 def sort_welds_by_distance_ping(data_ping, reference_point):
     """根据与参考点的距离对焊缝进行排序"""
-    sorted_data_ping = []
+    sorted_data_ping = []#一定放for外
     for i in range(len(data_ping)):
-        # 计算起点到参考点的距离并排序
+        # 计算起点到参考点的距离并排序[[起点与参考点距离,终点与参考点距离,起点坐标,终点坐标,焊缝序号(与points文件中顺序对应)],[],[]....]
         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]:
+            if data_with_distances[i][0] > data_with_distances[i][1]:#若起点比终点离参考点更远 则互换起始点 且将第一个元素变为最近的点(后面用lambda针对第一个元素大小排序)
                 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])
+        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]
+        sorted_data_ping.append(data_with_distances.pop(0)[-3:])  # 取出data_with_distances第一个元素的 起点坐标 终点坐标  焊缝序号
+        #reference_point = sorted_data_ping[-1][1] #参考点变更为 sorted_data_ping中的最后一个点   即寻找离当前焊缝终点最近的
+
+        data_ping = [[start, end,flag_sequence] for distances1,distances2, start,end,flag_sequence in data_with_distances]#从弹出已经排好的点的数组重新更新被处理列表
+        
+        #将起始点位置交换回来,保证平缝焊接方向一致   
+        # for i in range(len(sorted_data_ping)):
+        #     sorted_data_ping[i][0], sorted_data_ping[i][1] = sorted_data_ping[i][1], sorted_data_ping[i][0]
+            
+    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])
+#         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 compute_pose_R(fangxiang, hanfeng):
+    """wg根据计算出的焊接时z轴负方向的向量(fangxiang)和由起点指向终点的向量(hanfeng)计算旋转矩阵""" #得到的是fangxiang向量相对于基坐标系原点的姿态变换矩阵 多了个绕x转180的变换
+    x, y, z = fangxiang
+
+    # 计算旋转角度
+    rotx = -np.arctan2(y, z)#投影到yz平面的的夹角
+    roty = np.arctan2(x, np.sqrt(y**2 + z**2))#向量和yz面的夹角
+
+    # 构造旋转矩阵 rot x y   先绕x转不影响向量和yz面的夹角?
+    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))#先转到XOZ  再转到X  相当于通过将方向向量转到z轴上的方式 让焊缝向量转到XOY平面 通过方向向量和焊缝向量的正交关系求出向量在Z轴上的转角
+    # 区分平缝竖缝
+
+    rotz = np.arctan2(-bb[1], -bb[0])
+
+    # 构造旋转矩阵 rot z x
+    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)))
+    #R_mat = np.matmul(A, np.matmul(B, D))
+    #A*(B*(C*D))              x*y*z*x(180)
+    return R_mat
 
-        # 初始化结果和当前终点
-        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)
+    result=[]
+
+    # 定义参考点,排序
+    #reference_point = (1172.85077147, -1.50259925, 668.30298144)
+    reference_point = (0.0,0.0, 0.0)
 
-    # 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)
+    data_ping, data_shu= read_hanfeng_from_point_txt(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
-
+    # 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  #[[起点,终点,序号],[],[]。。。。]
+    
+    #传递焊接顺序(points读入时的编号,从零开始)
     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)
+    # 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 len(sorted_welds_withnoflag)!=2:
+        rospy.loginfo("焊缝数量错误!!!!")
+        exit(0)
+    
+    point1=sorted_welds_withnoflag[0]
+    point2=sorted_welds_withnoflag[1]
+
+    middle1=[(point1[0][0]+point1[1][0])/2,(point1[0][1]+point1[1][1])/2,(point1[0][2]+point1[1][2])/2]
+    middle2=[(point2[0][0]+point2[1][0])/2,(point2[0][1]+point2[1][1])/2,(point2[0][2]+point2[1][2])/2]
+    
+    hanfeng1=[point1[1][0]-point1[0][0],point1[1][1]-point1[0][1],point1[1][2]-point1[0][2]]
+    hanfeng2=[point2[1][0]-point2[0][0],point2[1][1]-point2[0][1],point2[1][2]-point2[0][2]]
+    #sorted_welds    #[[起点,终点,序号],[],[]。。。。]
+
+
+    faxiang=[middle2[0]-middle1[0],middle2[1]-middle1[1],middle2[2]-middle1[2]]
+    shuzhi=np.cross(faxiang,hanfeng1)#向量叉乘 
+
+    faxiang/= np.linalg.norm(faxiang)  # 单位化
+    shuzhi /= np.linalg.norm(shuzhi)  # 单位化
     
-    rospy.loginfo("Welding sequence calculation completed")
+    fangxiang=faxiang+shuzhi*4 #arctan(4)=76度
+    mat=compute_pose_R(fangxiang,hanfeng1)
+    q = R.from_matrix(mat).as_quat()#应该是RPY转四元数
+    result.append(("s", point1[0],point1[1], q, q))
+
+    fangxiang=-faxiang+shuzhi*4 #arctan(4)=76度
+    mat=compute_pose_R(fangxiang,hanfeng1)
+    q = R.from_matrix(mat).as_quat()#应该是RPY转四元数
+    result.append(("s", point2[0],point2[1], q, q))
+
+
+    # 打开文件准备写入
+    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("顺序与姿态规划完毕 0v0")
+
 
 if __name__ == '__main__':    
     run()
+
+
+
+    
+   
+
+
+   

+ 171 - 160
ren_yuan/src/lst_robot_r/scripts/moveitServer2.py

@@ -25,8 +25,7 @@ import traceback
 from lst_robot_r.msg import JointTrajectoryPoint_ex,JointTrajectory_ex
 import json
 import termios
-from decorator_time import decorator_time
-import check
+
 
 pi = np.pi
 
@@ -36,7 +35,7 @@ class MoveIt_Control:
         self.home_pose=[]
         self.hf_num=0#焊缝计数 从0开始
         self.hf_fail=[]
-        # Init ros config
+        # Init ros configs
         moveit_commander.roscpp_initialize(sys.argv)
         self.robot = moveit_commander.RobotCommander()
         
@@ -65,8 +64,9 @@ class MoveIt_Control:
         self.home_pose=self.get_now_pose()
         #self.go_ready()
 
+
     #TODO plan_cartesian_path
-    def plan_cartesian_path_LLL(self,point_s,point_e,waypoints,trajectory,trajectory_with_type,a=1,v=1):
+    def plan_cartesian_path_LLL(self,point_s,point_e,waypoints,trajectory,trajectory_with_type,v=1):
         fraction = 0.0  # 路径规划覆盖率
         maxtries = 50  # 最大尝试规划次数
         attempts = 0  # 已经尝试规划次数
@@ -112,15 +112,15 @@ class MoveIt_Control:
             (plan, fraction) = self.arm.compute_cartesian_path(
                 waypoint,  # waypoint poses,路点列表
                 0.001,  # eef_step,终端步进值
-                0.0,  # jump_threshold,跳跃阈值
-                True)  # avoid_collisions,避障规划
+                0.0,    # jump_threshold,跳跃阈值
+                True)   # avoid_collisions,避障规划
             attempts += 1
 
         if fraction == 1.0 :
             rospy.loginfo("Path computed successfully.")
             #traj = plan
             trajj = plan #取出规划的信息
-            retimed_planed=self.retime_plan(trajj)
+            retimed_planed=self.retime_plan(trajj,v)
             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"
@@ -130,8 +130,7 @@ class MoveIt_Control:
             rospy.loginfo("执行结束")
             trajectory_with_type.append(trajj_with_type)
         else:
-            rospy.loginfo(
-                "fraction=" + str(fraction) + " success after " + str(maxtries))   
+            rospy.loginfo("fraction=" + str(fraction) + " success after " + str(maxtries))   
             
             # rospy.loginfo("本次焊缝规划失败")
             # points.pop()#将本条焊缝的起点从规划中删除
@@ -141,17 +140,17 @@ class MoveIt_Control:
         #self.hf_num=self.hf_num+1#焊缝计数
         return waypoints,trajectory,trajectory_with_type
     
-    def retime_plan(self,traj):
+    #TODO retime_plan
+    def retime_plan(self,traj,v):
         current_state = self.arm.get_current_state()
         
         retimed_traj = self.arm.retime_trajectory(
             current_state,
             traj,
-            velocity_scaling_factor=0.5,
+            velocity_scaling_factor=0.03,
             acceleration_scaling_factor=1)
         
         return retimed_traj
-
     
     def get_now_pose(self):
         # 获取机械臂当前位姿
@@ -169,116 +168,116 @@ class MoveIt_Control:
         #rospy.lohome_poseinfo("Current Pose: {}".format(pose))
         return pose
     
-    #TODO move_p_path_constraints    
-    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.16  #高度延长16cm
-        radius = r
+    def zhu_shi():#折叠注释代码用的
         
-        # 位置约束
-        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
-    
-
-    #TODO move_p_flexible
-    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.09#初始允许半径 9cm
-        er=0
-        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)#将当前的点和输入的点(焊缝的起始点)做圆柱轨迹约束
-        else:
-            #刚开始规划 起点位置设定为当前状态  按理来说是home点 
-            self.go_home()
-            self.home_pose=self.get_now_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)#起点位置设置为规划组最后一个点 或者当前状态(第一个点时)
+    # def create_path_constraints(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.16  
+    #     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
+
+    #     #构建 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)
+
+    #     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.09    #初始允许半径 9cm
+    #     er=0
+    #     if trajectory:
+    #         #起点位置设置为规划组最后一个点
+    #         state = self.arm.get_current_state()
+    #         state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+    #         path_constraints = self.create_path_constraints(points[-1],point,rrr)#将当前的点和输入的点(焊缝的起始点)做圆柱轨迹约束
+    #     else:
+    #         #刚开始规划 起点位置设定为当前状态  按理来说是home点 
+    #         self.go_home()
+    #         self.home_pose=self.get_now_pose()
+    #         state = self.arm.get_current_state()
+    #         path_constraints = self.create_path_constraints(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 = 4 #尝试规划5次  无约束5次
-        for i in range(b):
-            traj = self.arm.plan()#调用plan进行规划
-            error=traj[3]
-            if  error.val == moveit_msgs.msg._MoveItErrorCodes.MoveItErrorCodes.SUCCESS:
-                trajj = traj[1] #取出规划的信息
-                rospy.loginfo("正在检查移动轨迹有效性...")
-                error_c, limit_margin=check.check_joint_positions(trajj)
-                if not error_c:       
-                    rospy.loginfo("本次移动OK")
-                    rospy.loginfo("*******************")
-                    trajj_with_type = mark_the_traj(trajj,"during-p",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)  
-                    break  
-            else:
-                rospy.loginfo("check failed! 移动轨迹无效")
-                rospy.loginfo("移动规划失败-开始第{}次重新规划".format(i+1))
-                self.arm.clear_path_constraints()
-                rrr=rrr+0.2#每次增加20厘米半径
-                rospy.loginfo("R值:{}".format(rrr))
-                if trajectory:
-                    path_constraints = self.create_path_constraints2(points[-1],point,rrr)#将最后一个点和输入的点(焊缝的起始点)做圆柱轨迹约束
-                else:
-                    path_constraints = self.create_path_constraints2(self.home_pose,point,rrr)#将最后一个点和起点(焊缝的起始点)做圆柱轨迹约束
-                self.arm.set_path_constraints(path_constraints)#设定约束
-                if(i>=(b-2)):
-                    rospy.loginfo("所有移动规划尝试失败 取消路径约束")
-                    self.arm.clear_path_constraints()
-                if(i==(b-1)):
-                    rospy.loginfo("所有移动规划尝试失败  焊缝起点不可达")
-                    er=1
-                    break
-        #清除约束
-        self.arm.clear_path_constraints()
+    #     #尝试规划次数
+    #     b = 4 #尝试规划5次  无约束5次
+    #     for i in range(b):
+    #         traj = self.arm.plan()#调用plan进行规划
+    #         error=traj[3]
+    #         if  error.val == moveit_msgs.msg._MoveItErrorCodes.MoveItErrorCodes.SUCCESS:
+    #             trajj = traj[1] #取出规划的信息
+    #             rospy.loginfo("正在检查移动轨迹有效性...")
+    #             error_c, limit_margin=check.check_joint_positions(trajj)
+    #             if not error_c:       
+    #                 rospy.loginfo("本次移动OK")
+    #                 rospy.loginfo("*******************")
+    #                 trajj_with_type = mark_the_traj(trajj,"during-p",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)  
+    #                 break  
+    #         else:
+    #             rospy.loginfo("check failed! 移动轨迹无效")
+    #             rospy.loginfo("移动规划失败-开始第{}次重新规划".format(i+1))
+    #             self.arm.clear_path_constraints()
+    #             rrr=rrr+0.2#每次增加20厘米半径
+    #             rospy.loginfo("R值:{}".format(rrr))
+    #             if trajectory:
+    #                 path_constraints = self.create_path_constraints(points[-1],point,rrr)#将最后一个点和输入的点(焊缝的起始点)做圆柱轨迹约束
+    #             else:
+    #                 path_constraints = self.create_path_constraints(self.home_pose,point,rrr)#将最后一个点和起点(焊缝的起始点)做圆柱轨迹约束
+    #             self.arm.set_path_constraints(path_constraints)#设定约束
+    #             if(i>=(b-2)):
+    #                 rospy.loginfo("所有移动规划尝试失败 取消路径约束")
+    #                 self.arm.clear_path_constraints()
+    #             if(i==(b-1)):
+    #                 rospy.loginfo("所有移动规划尝试失败  焊缝起点不可达")
+    #                 er=1
+    #                 break
+    #     #清除约束
+    #     self.arm.clear_path_constraints()
         
-        return points,trajectory,trajectory_with_type,er
+    #     return points,trajectory,trajectory_with_type,er
     
+        pass
+
 
-    #TODO go_home
-    @decorator_time  
     def go_home(self,a=1,v=1):
         rospy.loginfo("go_home start")
         self.arm.set_max_acceleration_scaling_factor(a)
@@ -289,23 +288,15 @@ class MoveIt_Control:
         rospy.loginfo("go_home end")
         # rospy.sleep(1)
         
-    def go_ready(self,a=1,v=1):
-        rospy.loginfo("go_ready start")
-        self.arm.set_max_acceleration_scaling_factor(a)
-        self.arm.set_max_velocity_scaling_factor(v)
-        self.arm.set_named_target('ready')
-        rospy.loginfo("get_ready end")
-        self.arm.go()
-        rospy.loginfo("go_ready end")
     
-    #TODO go_home_justplan
-    @decorator_time
+
     def go_home_justplan(self,trajectory,trajectory_with_type,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)
         state = self.arm.get_current_state()
-        state.joint_state.position = trajectory[-1].joint_trajectory.points[-1].positions
+        if trajectory:
+            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()
@@ -318,7 +309,7 @@ class MoveIt_Control:
         return trajectory,trajectory_with_type
 
     #TODO path_planning
-    @decorator_time
+
     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)
@@ -334,9 +325,18 @@ class MoveIt_Control:
             point11 = [start_point[0]/1000, start_point[1]/1000, start_point[2]/1000, q1[0],q1[1],q1[2],q1[3]]
             point22 = [end_point[0]/1000, end_point[1]/1000, end_point[2]/1000, q2[0],q2[1],q2[2],q2[3]]
             way_points,trajectory,trajectory_with_type = self.plan_cartesian_path_LLL(point11,point22,way_points,trajectory,trajectory_with_type,v=speed_v)
-
+            
             rospy.loginfo("第%d条焊缝规划完毕",i+1)
             rospy.loginfo("*******************")
+            
+            #向上移动末端执行器
+            if i<len(all_data):
+                up_value=0.1
+                point_up=[point22[0], point22[1], point22[2]-up_value, point22[3], point22[4],point22[5],point22[6]]
+                way_points, trajectory, trajectory_with_type = self.plan_cartesian_path_LLL(point22,point_up,way_points,trajectory,trajectory_with_type,v=speed_v)
+                rospy.loginfo("末端执行器上移完毕")
+                rospy.loginfo("*******************")
+            
         rospy.loginfo("All of The trajectory Plan successfully")
         rospy.loginfo("*******************")
         if gohome:
@@ -454,6 +454,7 @@ def ROS2PY_msgs(msgs, m_sr):
     py_msgs.fail = m_sr.hf_fail.copy()
     py_msgs.shun_xv = msgs.points[0].sequence.copy()
 
+    # 打印规划信息
     # for i in range(len(py_msgs.point.type)):
     #     print(py_msgs.point.xyz_list[i])
     #     print(py_msgs.point.type[i])
@@ -469,40 +470,49 @@ def ROS2PY_msgs(msgs, m_sr):
     #     moveit_server.move_j(py_msgs.point.xyz_list[i])
     #     #input("任意键继续")
 
-def get_valid_input(factor, default):
-    while True:
-        user_input=input(factor)
-        if user_input=="":
-            return default
-        try:
-            value=float(user_input)
-            if 0<value<=1:
-                return value
-            else:
-                rospy.logerr("缩放因子必须在(0, 1]范围内,请重新输入!")
-        except ValueError:
-            rospy.logerr("输入值无效,请根据提示重新输入!")
-
-def get_user_input():
-    """获取用户输入的速度和加速度缩放因子,并在控制台中打印信息和错误提示"""
-    DEFUALT_V = 1.0
-    DEFUALT_A = 1.0
+# def get_valid_input(factor, default):
+#     while True:
+#         user_input=input(factor)
+#         if user_input=="":
+#             return default
+#         try:
+#             value=float(user_input)
+#             if 0<value<=1:
+#                 return value
+#             else:
+#                 rospy.logerr("缩放因子必须在(0, 1]范围内,请重新输入!")
+#         except ValueError:
+#             rospy.logerr("输入值无效,请根据提示重新输入!")
+
+# def get_user_input():
+#     """获取用户输入的速度和加速度缩放因子,并在控制台中打印信息和错误提示"""
+#     DEFUALT_V = 1.0
+#     DEFUALT_A = 1.0
      
-    try:
-        termios.tcflush(sys.stdin, termios.TCIFLUSH)   #清空输入缓存
-        rospy.loginfo("输入缓存区已清空!")
+#     try:
+#         termios.tcflush(sys.stdin, termios.TCIFLUSH)   #清空输入缓存
+#         rospy.loginfo("输入缓存区已清空!")
         
-        vv=get_valid_input("请输入速度缩放因子(0-1, 默认为1): ", DEFUALT_V)
-        #a=get_valid_input("请输入加速度缩放因子(0-1, 默认为1): ", DEFUALT_A)
+#         vv=get_valid_input("请输入速度缩放因子(0-1, 默认为1): ", DEFUALT_V)
+#         #a=get_valid_input("请输入加速度缩放因子(0-1, 默认为1): ", DEFUALT_A)
           
-        #rospy.loginfo(f"用户输入的速度缩放因子为{vv}")
-        return vv
-    except Exception as e:
-        rospy.logerr(f"发生错误:{e}") 
+#         #rospy.loginfo(f"用户输入的速度缩放因子为{vv}")
+#         return vv
+#     except Exception as e:
+#         rospy.logerr(f"发生错误:{e}")
+   
+# def ROS2_msgs_write(msgs, m_sr):
+#     for i in range(len(msgs.points)):
+#         py_msgs.point.xyz_list.append(msgs.points[i].positions)
+    
+#     f_p = os.path.join(folder_path, 'outtt.txt')
+#     with open(f_p,'w') as file:
+#         for point in py_msgs.point.xyz_list:
+#             file.write(' '.join(str(value) for value in point)+ "\n") 
         
 
 if __name__ =="__main__":
-    # from redis_publisher import Publisher
+    # from redis_publisher import Publisher  #注意 可能是史前redis 
     # publisher = Publisher()
 
     folder_path = rospy.get_param("folder_path")
@@ -510,15 +520,16 @@ if __name__ =="__main__":
     moveit_server = MoveIt_Control(is_use_gripper=False)  
     welding_sequence = rospy.get_param('welding_sequence')
 
-    speed_v=1
+    speed_v=0.001
     # speed_v=get_user_input()
     # rospy.loginfo(f"用户输入的速度缩放因子为{speed_v}")
 
     trajectory,trajectory_merge,trajectory_with_type_merge = moveit_server.path_planning(folder_path)
 
-    #moveit_server.go_ready()
+    #moveit_server.go_ready()       #合并后的轨迹也需要从ready点开始执行
     rospy.loginfo("开始执行合并后轨迹")
     moveit_server.arm.execute(trajectory_merge)
+    #ROS2_msgs_write(trajectory_with_type_merge,moveit_server)
     rospy.loginfo("合并后轨迹执行完毕")
     
     rospy.set_param("sign_control",0)

+ 0 - 23
ren_yuan/src/lst_robot_r/scripts/pcd2binary.py

@@ -1,23 +0,0 @@
-import open3d as o3d
-import numpy as np
-
-
-def pcd_to_binary(pcd_file, output_file):
-    pcd = o3d.io.read_point_cloud(pcd_file)
-    points = np.asarray(pcd.points)
-    binary_data = points[:, :3]
-    with open(output_file, 'wb') as f:
-        f.write(binary_data.tobytes())
-
-
-# def binary_to_nparray(binary_file, output_file):
-#     with open(binary_file, 'rb') as f:
-#         binary_data = f.read()
-#     # 将二进制数据转换为 NumPy 数组
-#     point_cloud = np.frombuffer(binary_data, dtype=np.float64).reshape(-1, 3)
-#     np.savetxt(output_file, point_cloud)
-
-
-if __name__ == '__main__':
-    pcd_to_binary(r'/home/tong/renyuan_pointcloud/3/26_LazerData_Hi229204_2.pcd', r'/home/tong/renyuan_pointcloud/3/pointcloud.txt')
-    #binary_to_nparray(r'./pointcloud.txt', r'./111123123123.txt')

+ 0 - 38
ren_yuan/src/lst_robot_r/scripts/rotation_pcd.py

@@ -1,38 +0,0 @@
-#!/usr/bin/env python3
-
-import rospy
-import pcl
-import numpy as np
-
-def main():
-    # 初始化ROS节点
-    rospy.init_node('transform_pcd_node', anonymous=True)
-
-    # 定义点云地图的路径和文件名
-    pcd_path = "/home/tong/renyuan_pointcloud/2/26_LazerData_Hi229204_1.pcd"
-
-    # 读取点云地图
-    cloud = pcl.load(pcd_path)
-
-    # 手动变换点云
-    transformed_points = cloud.to_array()
-    
-    #定义位移向量(沿Z轴方向移动一个单位长度)
-    
-    print("Transformed Points (before translation):", transformed_points)
-    
-    translation_vector = np.array([0, 0, 1000], dtype=np.float32)
-    transformed_points += translation_vector
-    
-    print("Transformed Points (after translation):", transformed_points)
-    
-    # 创建新的点云对象
-    transformed_cloud = pcl.PointCloud()
-    transformed_cloud.from_array(transformed_points.astype(np.float32))
-
-    # 保存旋转后的点云地图到PCD文件中
-    pcl.save(transformed_cloud, "/home/tong/renyuan_pointcloud/2/transformed_point_cloud.pcd")
-
-if __name__ == "__main__":
-    main()
-

+ 24 - 51
ren_yuan/src/lst_robot_r/scripts/start.py

@@ -1,7 +1,6 @@
 #! /usr/bin/env python3
 import rospy
 import os
-import hanqiangpose
 import command
 import subprocess
 import hjsx
@@ -16,7 +15,7 @@ from rospy.service import ServiceException
 
 import actionlib_msgs.msg._GoalStatusArray
 import sys
-import time
+
 def wait_for_topic(topic_name, message_type):
     try:
         message = rospy.wait_for_message(topic_name, message_type, timeout=None)
@@ -35,22 +34,18 @@ def clear_octomap():
 
 waited_once = False
 tim_list=[]
+
 if __name__ == "__main__":
     command.load_rviz()
-    rospy.init_node("set_update_paramter_p")
+    rospy.init_node("start_node")
 
     # 初始化各种类型参数
-
-    rospy.set_param("cishu",0)
-    rospy.set_param("time",0)
-
+    rospy.set_param("ping_sta",45)#用于判断平缝的角度
     rospy.set_param("sign_control",1)
     rospy.set_param("sign_pointcloud",0)
+    rospy.set_param("folder_path","/home/robot/ROS/ren_yuan/data/123")
 
-    #rospy.set_param("folder_path","/home/tong/moveit_ws/data/3")
-    rospy.set_param("folder_path","/home/robot/ROS/ren_yuan/data/2")
 
-   
     rospy.loginfo("等待rviz启动")
     wait_for_topic("/execute_trajectory/status",actionlib_msgs.msg.GoalStatusArray)
     
@@ -64,72 +59,50 @@ if __name__ == "__main__":
                 if aaa=="":
                     aaa='2'
                 #aaa='2'
-
-                rospy.set_param("cishu",rospy.get_param("cishu")+1)
                 if(aaa =='1' or aaa=='2'):
                     rospy.set_param("sign_control",aaa)
                 else:
-                    command.close_rviz("/usr/bin/python3 /opt/ros/noetic/bin/roslaunch robot_config demo.launch")
+                    command.close_rviz("/usr/bin/python3 /opt/ros/noetic/bin/roslaunch fanuc_ry_moveit_config demo.launch")
                     exit(0)
                 waited_once = True
         elif sign_control == "1":
-            # 重置参数
-            #rospy.set_param("sign_control",0)    #在轨迹规划里重置 防止重复调用
-            #rospy.set_param("sign_traj_accepted",0)
-            # 清除场景
+            # 清除场景   点云计算并发布
             clear_octomap()
-            #点云计算并发布
             process = multiprocessing.Process(target=command.launch_publish_pointcloud_background)
             process.start()
 
-            # input("请在rviz中查看点云,然后按回车键继续...")
-            # #计算焊接顺序和焊接姿态
-            # hjsx.run()
-            # hanqiangpose.run()
-            # time.sleep(10)
-            # command.load_visual()
-            # # 等待 /move_group/monitored_planning_scene 话题发布消息
+            #计算焊接顺序和焊接姿态
+            hjsx.run()
+            
+            # 等待 /move_group/monitored_planning_scene 话题发布消息
             rospy.loginfo("等待场景地图加载完毕...")
             wait_for_topic('/move_group/monitored_planning_scene', PlanningScene)
             rospy.loginfo(f"场景地图已加载完毕")
             rospy.set_param("sign_pointcloud",1)
-            # #rospy.loginfo("终止点云发布,关闭发布窗口")
-            
-            # rospy.loginfo("运行moveitserver2.py")
-            # process = multiprocessing.Process(target=command.launch_moveit_control_server_background)
-            # process.start()
 
-            # while rospy.get_param("sign_control"):
-            #     pass
-            # #运行结束,重置参数
+            command.load_visual()
 
-            rospy.set_param("sign_control",0)#记得删除!!!!!!!!!!!!!!!!
-            waited_once = False
+            #rospy.loginfo("运行moveitserver2.py")
+            process = multiprocessing.Process(target=command.launch_moveit_control_server_background)
+            process.start()
+
+
+            while rospy.get_param("sign_control"):
+                pass
+
+            waited_once = False      #运行结束,重置参数
  
         elif sign_control == "2":
-            tim=time.time()
-            rospy.set_param("time",0)
-            # 重置参数
-            #rospy.set_param("sign_control",0)
-            #rospy.set_param("sign_traj_accepted",0)
             hjsx.run()
-            hanqiangpose.run()
             command.load_visual()
+
             process = multiprocessing.Process(target=command.launch_moveit_control_server_background)
             process.start()
 
+
             while rospy.get_param("sign_control"):
                 pass
-
-            # tim=time.time()-tim
-            # tim_list.append(tim)
-            # print("-------------------------------------")
-            # print(f'第{rospy.get_param("cishu")}次规划:')
-            # print(tim_list)
-            # print("")
-            
-            #运行结束,重置参数
             waited_once = False
 
     
-    
+    

+ 0 - 11
ren_yuan/src/robot_config/.setup_assistant

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

+ 1 - 1
ren_yuan/src/visual/CMakeLists.txt

@@ -5,7 +5,7 @@ find_package(catkin REQUIRED COMPONENTS
   roscpp
   rospy
   std_msgs
-  robot_config
+  fanuc_ry_moveit_config
 )
 
 catkin_package(

+ 9 - 0
ren_yuan/说明.txt

@@ -0,0 +1,9 @@
+一、修改了焊接顺序不再为先寻找最近再寻找离上次选择的最近的,转为保持选择离基准点(修改为0.0.0)最近的
+最终的结果是 焊缝相对基准点由远及近,且从近端指向远端
+
+二、修改焊接姿态规划,将其移动到hjsx.py中,节省一次读写,且姿态的规划不再是基于世界坐标系的,而是与焊缝绑定(待测试)
+
+三、修改关节限位(未完成)
+
+四、修改moveit代码  加入规划失败检测 一条焊缝失败则两条都不焊
+