Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #include <ros/ros.h>
00034 #include <gtest/gtest.h>
00035 #include <boost/thread.hpp>
00036 #include <actionlib/client/simple_action_client.h>
00037 #include <pr2_plugs_msgs/WigglePlugAction.h>
00038 #include <pr2_common_action_msgs/ArmMoveIKAction.h>
00039 #include <actionlib/server/simple_action_server.h>
00040 
00041 
00042 void spinThread()
00043 {
00044   ros::spin();
00045 }
00046 
00047 void ik_execute(const pr2_common_action_msgs::ArmMoveIKGoalConstPtr& goal, actionlib::SimpleActionServer<pr2_common_action_msgs::ArmMoveIKAction>* as)
00048 {
00049   as->setSucceeded();
00050 }
00051 
00052 
00053 
00054 TEST(ActionServerTest, wiggle_plug)
00055 {
00056   ros::NodeHandle n;
00057   boost::thread spin_thread(&spinThread);
00058 
00059   actionlib::SimpleActionServer<pr2_common_action_msgs::ArmMoveIKAction> ik_server(n, "r_arm_ik", boost::bind(&ik_execute, _1, &ik_server), false);
00060   ik_server.start();
00061 
00062   actionlib::SimpleActionClient<pr2_plugs_msgs::WigglePlugAction> ac("wiggle_plug"); 
00063 
00064 
00065   EXPECT_TRUE(ac.waitForServer(ros::Duration(15.0)));
00066   ros::shutdown();
00067   spin_thread.join();
00068   
00069 }
00070 
00071 int main(int argc, char **argv){
00072   testing::InitGoogleTest(&argc, argv);
00073   ros::init(argc, argv, "wiggle_plug_tests");
00074   return RUN_ALL_TESTS();
00075 
00076 }