00001 00002 #include "bwi_kr_execution/ExecutePlanAction.h" 00003 00004 #include <actionlib/client/simple_action_client.h> 00005 00006 #include <ros/ros.h> 00007 00008 typedef actionlib::SimpleActionClient<bwi_kr_execution::ExecutePlanAction> Client; 00009 00010 using namespace std; 00011 00012 int main(int argc, char**argv) { 00013 ros::init(argc, argv, "meeting_experiment"); 00014 ros::NodeHandle n; 00015 00016 ros::NodeHandle privateNode("~"); 00017 string meeting; 00018 privateNode.param<string>("meeting",meeting,"bwi_meeting"); 00019 00020 ROS_INFO_STREAM("getting ready for meeting " << meeting); 00021 00022 Client client("/action_executor/execute_plan", true); 00023 client.waitForServer(); 00024 00025 bwi_kr_execution::ExecutePlanGoal goal; 00026 00027 bwi_kr_execution::AspRule rule; 00028 bwi_kr_execution::AspFluent fluent; 00029 fluent.name = "not allinmeeting"; 00030 fluent.variables.push_back(meeting); 00031 rule.body.push_back(fluent); 00032 00033 bwi_kr_execution::AspRule flag_rule; 00034 bwi_kr_execution::AspFluent find_person_flag; 00035 find_person_flag.name = "findPersonTask"; 00036 flag_rule.head.push_back(find_person_flag); 00037 00038 00039 goal.aspGoal.push_back(rule); 00040 goal.aspGoal.push_back(flag_rule); 00041 00042 00043 ROS_INFO("sending goal"); 00044 client.sendGoalAndWait(goal); 00045 00046 if (client.getState() == actionlib::SimpleClientGoalState::ABORTED) { 00047 ROS_INFO("Aborted"); 00048 } 00049 else if (client.getState() == actionlib::SimpleClientGoalState::PREEMPTED) { 00050 ROS_INFO("Preempted"); 00051 } 00052 00053 else if (client.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) { 00054 ROS_INFO("Succeeded!"); 00055 } 00056 else 00057 ROS_INFO("Terminated"); 00058 00059 return 0; 00060 }