LCOV - code coverage report
Current view: top level - include/ros_end_effector - RosServiceHandler.h (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 1 1 100.0 %
Date: 2021-10-05 16:55:17 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright 2020 <copyright holder> <email>
       3             :  *
       4             :  * Licensed under the Apache License, Version 2.0 (the "License");
       5             :  * you may not use this file except in compliance with the License.
       6             :  * You may obtain a copy of the License at
       7             :  *
       8             :  *     http://www.apache.org/licenses/LICENSE-2.0
       9             :  *
      10             :  * Unless required by applicable law or agreed to in writing, software
      11             :  * distributed under the License is distributed on an "AS IS" BASIS,
      12             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13             :  * See the License for the specific language governing permissions and
      14             :  * limitations under the License.
      15             :  */
      16             : 
      17             : #ifndef ROSSERVICEHANDLER_H
      18             : #define ROSSERVICEHANDLER_H
      19             : 
      20             : #include <ros/ros.h>
      21             : #include <ros_end_effector/MapActionHandler.h>
      22             : #include <rosee_msg/GraspingPrimitiveAggregated.h>
      23             : #include <rosee_msg/GraspingPrimitiveAggregatedAvailable.h>
      24             : #include <rosee_msg/SelectablePairInfo.h>
      25             : #include <rosee_msg/GraspingActionsAvailable.h>
      26             : #include <rosee_msg/GraspingAction.h>
      27             : #include <rosee_msg/MotorPosition.h>
      28             : #include <rosee_msg/HandInfo.h>
      29             : #include <rosee_msg/NewGenericGraspingAction.h>
      30             : #include <rosee_msg/NewGenericGraspingActionSrv.h>
      31             : 
      32             : 
      33             : namespace ROSEE {
      34             : /**
      35             :  * @todo write docs
      36             :  */
      37          41 : class RosServiceHandler
      38             : {
      39             : public:
      40             :     /**
      41             :      * Default constructor
      42             :      */
      43             :     RosServiceHandler(ros::NodeHandle *nh, ROSEE::MapActionHandler::Ptr, std::string path2saveYamlGeneric);
      44             :     bool init(unsigned int nFinger);
      45             : 
      46             :     //this response is filled by UROSEE in the initialization
      47             :     rosee_msg::HandInfo::Response handInfoResponse;
      48             : private:
      49             :     
      50             :     MapActionHandler::Ptr _mapActionHandler;
      51             :     std::string _path2saveYamlGeneric;
      52             :     ros::NodeHandle* _nh;
      53             :     ros::ServiceServer _serverPrimitiveAggregated;
      54             :     ros::ServiceServer _server_selectablePairInfo;
      55             :     ros::ServiceServer _serverGraspingActions;
      56             :     ros::ServiceServer _serverNewGraspingAction;
      57             :     
      58             :     ros::ServiceServer _serverHandInfo;
      59             :     
      60             :     
      61             :     unsigned int nFinger;
      62             :     
      63             :     bool selectablePairInfoCallback ( rosee_msg::SelectablePairInfo::Request& request, rosee_msg::SelectablePairInfo::Response& response);
      64             :     
      65             :     bool graspingActionsCallback(rosee_msg::GraspingActionsAvailable::Request& request,   
      66             :                                  rosee_msg::GraspingActionsAvailable::Response& response);
      67             :   
      68             :     rosee_msg::GraspingAction fillGraspingActionMsg(ROSEE::ActionPrimitive::Ptr primitive);
      69             :     rosee_msg::GraspingAction fillGraspingActionMsg(ROSEE::ActionGeneric::Ptr generic);
      70             :     rosee_msg::GraspingAction fillGraspingActionMsg(ROSEE::ActionTimed::Ptr timed);
      71             : 
      72             :     /**
      73             :      * @brief Internal function called by each of the fillGraspingActionMsg, it fills the GraspingAction message
      74             :      * with the info that are always present in any kind of action (like name and type). 
      75             :      * Each specific \ref fillGraspingActionMsg will insert fill the field specific for the action type 
      76             :      * (like time margins for timed actions)
      77             :      *
      78             :      * @param action the action that must be sent as response
      79             :      * @param msg the ROS message that must be filled with action info
      80             :      */
      81             :     void fillCommonInfoGraspingActionMsg(ROSEE::Action::Ptr action, rosee_msg::GraspingAction* msg);
      82             : 
      83             :     
      84             :     bool primitiveAggregatedCallback(
      85             :         rosee_msg::GraspingPrimitiveAggregatedAvailable::Request& request,
      86             :         rosee_msg::GraspingPrimitiveAggregatedAvailable::Response& response);
      87             : 
      88             :     rosee_msg::GraspingPrimitiveAggregated fillPrimitiveAggregatedMsg(
      89             :                         ROSEE::MapActionHandler::ActionPrimitiveMap primitiveMap);
      90             :     rosee_msg::GraspingPrimitiveAggregated fillPrimitiveAggregatedMsg(
      91             :                         ROSEE::ActionPrimitive::Ptr primitive);
      92             :     
      93             :     bool handInfoCallback(
      94             :         rosee_msg::HandInfo::Request& request,
      95             :         rosee_msg::HandInfo::Response& response);
      96             : 
      97             :     bool newGraspingActionCallback(
      98             :         rosee_msg::NewGenericGraspingActionSrv::Request& request,
      99             :         rosee_msg::NewGenericGraspingActionSrv::Response& response);
     100             : };
     101             : 
     102             : } //end namespace
     103             : 
     104             : #endif // ROSSERVICEHANDLER_H

Generated by: LCOV version 1.13