actionExecutorPickupObject.cpp
Go to the documentation of this file.
00001 #include "tidyup_actions/actionExecutorPickupObject.h"
00002 #include <pluginlib/class_list_macros.h>
00003 #include "tidyup_utils/planning_scene_interface.h"
00004 
00005 PLUGINLIB_DECLARE_CLASS(tidyup_actions, action_executor_pickup_object,
00006         tidyup_actions::ActionExecutorPickupObject,
00007         continual_planning_executive::ActionExecutorInterface)
00008 
00009 namespace tidyup_actions
00010 {
00011 
00012     bool ActionExecutorPickupObject::fillGoal(tidyup_msgs::GraspObjectGoal & goal,
00013             const DurativeAction & a, const SymbolicState & current)
00014     {
00015         if(!PlanningSceneInterface::instance()->resetPlanningScene())   // FIXME try anyways?
00016             ROS_ERROR("%s: PlanningScene reset failed.", __PRETTY_FUNCTION__);
00017 
00018         ROS_ASSERT(a.parameters.size() == 4);
00019         string location = a.parameters[0];
00020         goal.pickup_object = a.parameters[1];
00021         goal.static_object = a.parameters[2];
00022         goal.arm = a.parameters[3];
00023 
00024         return true;
00025     }
00026 
00027     void ActionExecutorPickupObject::updateState(const actionlib::SimpleClientGoalState & actionReturnState,
00028             const tidyup_msgs::GraspObjectResult & result,
00029             const DurativeAction & a, SymbolicState & current)
00030     {
00031         ROS_INFO("PickupObject returned result");
00032         ROS_ASSERT(a.parameters.size() == 4);
00033         string location = a.parameters[0];
00034         string object = a.parameters[1];
00035         string static_object = a.parameters[2];
00036         string arm = a.parameters[3];
00037 // TODO: set grasp in symbolic state?       result.grasp;
00038         if(actionReturnState == actionlib::SimpleClientGoalState::SUCCEEDED) {
00039             ROS_INFO("PickupObject succeeded.");
00040             current.setBooleanPredicate("grasped", object + " " + arm, true);
00041             current.setBooleanPredicate("on", object + " " + static_object, false);
00042             current.setBooleanPredicate("graspable-from", object + " " + location + " left_arm", false);
00043             current.setBooleanPredicate("graspable-from", object + " " + location + " right_arm", false);
00044             //current.setObjectFluent("object-detected-from", object, "robot_location"); // FIXME hack, unset this
00045             // TODO: set false for other locations as well?
00046         }
00047         current.setObjectFluent("arm-state", arm, "arm_unknown");
00048         current.setBooleanPredicate("searched", location, false);
00049         current.setBooleanPredicate("recent-detected-objects", location, false);
00050     }
00051 
00052 };
00053 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


tidyup_actions
Author(s): Christian Dornhege, Andreas Hertle
autogenerated on Wed Dec 26 2012 16:11:46