|
@@ -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") #4条焊缝
|
|
|
- #rospy.set_param("folder_path","/home/tong/moveir_ws/data/6_Welds") #6条焊缝
|
|
|
+ #rospy.set_param("folder_path","/home/tong/catkin_ws/data/20240913-1") #4条焊缝
|
|
|
+ rospy.set_param("folder_path","/home/tong/catkin_ws/data/6_Welds") #6条焊缝
|
|
|
|
|
|
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---按任意键退出程序---")
|
|
|
+ # termios.tcflush(sys.stdin, termios.TCIFLUSH) #清空键盘缓冲区
|
|
|
+ # print("---1.加载点云数据并规划---\n---2.仅重新规划路径---\n---按任意键退出程序---")
|
|
|
|
|
|
- user_input=input("请选择1-2(默认enter为2): ")
|
|
|
- if user_input=="":
|
|
|
- user_input='2'
|
|
|
+ # 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)
|
|
|
- #rosnode.kill_nodes(["set_update_paramter_p"])
|
|
|
+ # 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)
|
|
|
|