grasp_actions_alg_node.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _grasp_actions_alg_node_h_
00026 #define _grasp_actions_alg_node_h_
00027 
00028 #include <iri_base_algorithm/iri_base_algorithm.h>
00029 
00030 // [publisher subscriber headers]
00031 
00032 // [service client headers]
00033 #include <iri_wam_common_msgs/bhand_cmd.h>
00034 #include <iri_wam_common_msgs/joints_move.h>
00035 #include <iri_wam_common_msgs/wamInverseKinematics.h>
00036 
00037 // [action server client headers]
00038 #include <actionlib/client/simple_action_client.h>
00039 #include <iri_action_server/iri_action_server.h>
00040 #include <iri_wam_common_msgs/SimpleBhandPickUpAction.h>
00041 #include <iri_dynamixel_gripper/openAction.h>
00042 #include <iri_dynamixel_gripper/closeAction.h>
00043 
00044 #include <geometry_msgs/Pose.h>
00045 #include <geometry_msgs/PoseStamped.h>
00046 #include <object_manipulation_msgs/GripperTranslation.h>
00047 
00048 #include "grasp_generator.h"
00049 #include "grasp_actions_alg.h"
00050 
00054 class GraspActionsAlgNode : public algorithm_base::IriBaseAlgorithm<GraspActionsAlgorithm>
00055 {
00056   // Finger configuration is composed by a list of BarrettHand commands
00057   // defined as strings
00058   typedef std::vector<std::string> FingersConfiguration;
00059 
00060   private:
00061     std::string pre_grasp_fingers_configuration_;
00062     std::string grasp_fingers_configuration_;
00063     int status_;
00064     GraspGenerator grasp_generator_;
00065 
00066     // [publisher attributes]
00067 
00068     // [subscriber attributes]
00069 
00070     // [service attributes]
00071 
00072     // [client attributes]
00073     ros::ServiceClient                        bhand_cmd_client_;
00074     ros::ServiceClient                        joints_move_client_;
00075     ros::ServiceClient                        wam_bhand_ik_client_;
00076 
00077     // Execute barrett hand commands through the bhand_cmd service
00078     void moveFingersBHand(const FingersConfiguration & finger_config);
00079     // Execute gripper commands (open and close) through the dynamixel_motor action
00080     void moveFingersGripper(const FingersConfiguration & finger_config);
00081     
00082     void moveFingers(const FingersConfiguration & finger_config);
00083     void moveArm(const geometry_msgs::PoseStamped pose);
00084     void run_grasp_actions(const GraspPhaseSequence & actions);
00085 
00086     // [action server attributes]
00087     IriActionServer<iri_wam_common_msgs::SimpleBhandPickUpAction> pickup_aserver_;
00088     void pickupStartCallback(const iri_wam_common_msgs::SimpleBhandPickUpGoalConstPtr& goal);
00089     void pickupStopCallback(void);
00090     bool pickupIsFinishedCallback(void);
00091     bool pickupHasSucceedCallback(void);
00092     void pickupGetResultCallback(iri_wam_common_msgs::SimpleBhandPickUpResultPtr& result);
00093     void pickupGetFeedbackCallback(iri_wam_common_msgs::SimpleBhandPickUpFeedbackPtr& feedback);
00094 
00095     // [action client attributes]
00096     actionlib::SimpleActionClient<iri_dynamixel_gripper::openAction> open_gripper_client_;
00097     iri_dynamixel_gripper::openGoal open_gripper_goal_;
00098     void open_gripperMakeActionRequest();
00099     void open_gripperDone(const actionlib::SimpleClientGoalState& state,  const iri_dynamixel_gripper::openResultConstPtr& result);
00100     void open_gripperActive();
00101     void open_gripperFeedback(const iri_dynamixel_gripper::openFeedbackConstPtr& feedback);
00102 
00103     actionlib::SimpleActionClient<iri_dynamixel_gripper::closeAction> close_gripper_client_;
00104     iri_dynamixel_gripper::closeGoal close_gripper_goal_;
00105     void close_gripperMakeActionRequest();
00106     void close_gripperDone(const actionlib::SimpleClientGoalState& state,  const iri_dynamixel_gripper::closeResultConstPtr& result);
00107     void close_gripperActive();
00108     void close_gripperFeedback(const iri_dynamixel_gripper::closeFeedbackConstPtr& feedback);
00109 
00110     // node parameters for param server
00111     bool using_bhand_;
00112     
00113   public:
00120     GraspActionsAlgNode(void);
00121 
00128     ~GraspActionsAlgNode(void);
00129 
00130   protected:
00143     void mainNodeThread(void);
00144 
00157     void node_config_update(Config &config, uint32_t level);
00158 
00165     void addNodeDiagnostics(void);
00166 
00167     // [diagnostic functions]
00168     
00169     // [test functions]
00170 };
00171 
00172 #endif


iri_grasp_actions
Author(s): pmonso
autogenerated on Fri Dec 6 2013 20:14:56