00001
00002 #include <ros/ros.h>
00003 #include <actionlib/server/simple_action_server.h>
00004
00005 #include "pr2_gripper_click/GripperClickPickupAction.h"
00006 #include "pr2_gripper_click/GripperClickPlaceAction.h"
00007
00008 class ActionTest
00009 {
00010
00011 public:
00012
00013 actionlib::SimpleActionServer<pr2_gripper_click::GripperClickPickupAction> *pickup_action_server_;
00014
00015 actionlib::SimpleActionServer<pr2_gripper_click::GripperClickPlaceAction> *place_action_server_;
00016
00017 ros::NodeHandle update_nh_;
00018
00019 void pickupActionCallback(const pr2_gripper_click::GripperClickPickupGoal::ConstPtr &goal)
00020 {
00021 ROS_INFO("Received goal");
00022 pr2_gripper_click::GripperClickPickupResult result;
00023 pickup_action_server_->setAborted(result);
00024 ROS_INFO("Goal aborted");
00025 }
00026
00027 void placeActionCallback(const pr2_gripper_click::GripperClickPlaceGoal::ConstPtr &goal)
00028 {
00029 }
00030
00031 ActionTest() : update_nh_("")
00032 {
00033 pickup_action_server_ = new actionlib::SimpleActionServer<pr2_gripper_click::GripperClickPickupAction>(update_nh_,
00034 "gripper_click_pickup_ui",
00035 boost::bind(&ActionTest::pickupActionCallback, this, _1));
00036 ROS_INFO("Pickup action server started");
00037
00038
00039
00040
00041
00042 }
00043
00044 ~ActionTest()
00045 {
00046 delete pickup_action_server_; pickup_action_server_ = NULL;
00047
00048 ROS_INFO("Action servers deleted");
00049 }
00050 };
00051
00052 int main(int argc, char **argv)
00053 {
00054 ros::init(argc, argv, "test_actions");
00055 ActionTest at;
00056 ros::spin();
00057 }