|
@@ -18,7 +18,6 @@ import actionlib_msgs.msg._GoalStatusArray
|
|
|
import sys
|
|
|
import time
|
|
|
import termios
|
|
|
-import rosnode
|
|
|
|
|
|
def wait_for_topic(topic_name, message_type):
|
|
|
try:
|
|
@@ -31,10 +30,11 @@ def wait_for_topic(topic_name, message_type):
|
|
|
def clear_octomap():
|
|
|
try:
|
|
|
clear_octomap_service = rospy.ServiceProxy('/clear_octomap', Empty)
|
|
|
+ clear_octomap_service.wait_for_service()
|
|
|
clear_octomap_service()
|
|
|
rospy.loginfo("Octomap has been cleared.")
|
|
|
- except ServiceException as e:
|
|
|
- rospy.loginfo("Failed to call /clear_octomap service or it is not available. Skipping operation.")
|
|
|
+ except rospy.ServiceException as e:
|
|
|
+ rospy.logerr(f"Failed to call /clear_octomap service or it is not available: {e}. Skipping operation.")
|
|
|
|
|
|
waited_once = False
|
|
|
tim_list=[]
|
|
@@ -58,8 +58,8 @@ if __name__ == "__main__":
|
|
|
rospy.set_param("pitch_of_Horizontalweld",np.pi/4)
|
|
|
rospy.set_param("pitch_of_Verticalweld",np.pi/5)
|
|
|
rospy.set_param("culling_radius",0)
|
|
|
- rospy.set_param("folder_path","/root/catkin_ws/data")
|
|
|
-
|
|
|
+
|
|
|
+ rospy.set_param("folder_path","/home/tong/catkin_ws/data/6_Welds")
|
|
|
|
|
|
rospy.loginfo("当前参数值:")
|
|
|
rospy.loginfo("sign_pointcloud = %s", rospy.get_param("sign_pointcloud"))
|
|
@@ -74,20 +74,19 @@ if __name__ == "__main__":
|
|
|
if sign_control == "0":
|
|
|
if not waited_once:
|
|
|
print("等待点云数据准备完成...")
|
|
|
- termios.tcflush(sys.stdin, termios.TCIFLUSH)
|
|
|
- print("---1.加载点云数据并规划---\n---2.仅重新规划路径---\n---按任意键退出程序---")
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- user_input=input("请选择1-2(默认enter为2): ")
|
|
|
- if user_input=="":
|
|
|
- user_input='2'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- rospy.set_param("cishu",rospy.get_param("cishu")+1)
|
|
|
- if(user_input =='1' or user_input=='2'):
|
|
|
- rospy.set_param("sign_control", user_input)
|
|
|
- else:
|
|
|
- command.close_rviz("/usr/bin/python3 /opt/ros/noetic/bin/roslaunch lstrobot_moveit_config_0605 demo.launch")
|
|
|
- sys.exit(0)
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
waited_once = True
|
|
|
elif sign_control == "1":
|
|
|
|
|
@@ -126,6 +125,7 @@ if __name__ == "__main__":
|
|
|
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()
|
|
|
|
|
@@ -141,5 +141,8 @@ if __name__ == "__main__":
|
|
|
|
|
|
waited_once = False
|
|
|
|
|
|
-
|
|
|
+ else:
|
|
|
+ rospy.loginfo("正在关闭规划程序...")
|
|
|
+ command.close_rviz("/usr/bin/python3 /opt/ros/noetic/bin/roslaunch lstrobot_moveit_config_0605 demo.launch")
|
|
|
+ exit(0)
|
|
|
|