|
@@ -23,7 +23,7 @@ from tf.transformations import euler_from_quaternion,quaternion_from_euler,quate
|
|
|
import math
|
|
|
import traceback
|
|
|
from lstrobot_planning.msg import JointTrajectoryPoint_ex,JointTrajectory_ex
|
|
|
-
|
|
|
+import json
|
|
|
|
|
|
pi = np.pi
|
|
|
|
|
@@ -436,43 +436,42 @@ class py_msgs():
|
|
|
xyz_list=[]
|
|
|
type=[]
|
|
|
|
|
|
-def ROS2PY_msgs(msgs,m_sr):
|
|
|
+def ROS2PY_msgs(msgs, m_sr):
|
|
|
for i in range(len(msgs.points)):
|
|
|
py_msgs.point.xyz_list.append(msgs.points[i].positions)
|
|
|
py_msgs.point.type.append(msgs.points[i].type)
|
|
|
- py_msgs.fail=m_sr.hf_fail.copy()
|
|
|
- py_msgs.shun_xv=msgs.points[0].sequence.copy()
|
|
|
+ py_msgs.fail = m_sr.hf_fail.copy()
|
|
|
+ py_msgs.shun_xv = msgs.points[0].sequence.copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- print(py_msgs.shun_xv)
|
|
|
- print(py_msgs.fial)
|
|
|
|
|
|
+ message = {
|
|
|
+ 'positions': py_msgs.point.xyz_list,
|
|
|
+ 'flags': py_msgs.point.type,
|
|
|
+ 'weld_order': py_msgs.shun_xv,
|
|
|
+ 'failed': py_msgs.fail,
|
|
|
+ }
|
|
|
+ return json.dumps(message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ =="__main__":
|
|
|
+
|
|
|
+
|
|
|
|
|
|
folder_path = rospy.get_param("folder_path")
|
|
|
-
|
|
|
rospy.init_node('moveit_control_server', anonymous=False)
|
|
|
moveit_server = MoveIt_Control(is_use_gripper=False)
|
|
|
|
|
|
welding_sequence = rospy.get_param('welding_sequence')
|
|
|
trajectory,trajectory_merge,trajectory_with_type_merge = moveit_server.path_planning(folder_path)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ moveit_server.arm.execute(trajectory_merge)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
rospy.set_param("sign_control",0)
|