LCOV - code coverage report
Current view: top level - include/ros_end_effector/GraspingActions - ActionGeneric.h (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 1 1 100.0 %
Date: 2021-10-05 16:55:17 Functions: 3 4 75.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 ROSEE_ACTIONGENERIC_H
      18             : #define ROSEE_ACTIONGENERIC_H
      19             : 
      20             : #include <ros_end_effector/GraspingActions/Action.h>
      21             : #include <yaml-cpp/yaml.h>
      22             : #include <ros_end_effector/Utils.h>
      23             : 
      24             : 
      25             : namespace ROSEE {
      26             : 
      27             : /**
      28             :  * @brief Class to handle a generic, simple action. Differently from other class, this is easily creable manually,
      29             :  * for ex giving a name and a \ref JointPos map to the costructor. It contains essential infos about the action,
      30             :  * and override the necessary pure virtual functions of base class \ref Action
      31             :  */
      32         359 : class ActionGeneric :  public Action {
      33             :     
      34             : public:
      35             :     typedef std::shared_ptr<ActionGeneric> Ptr;
      36             :     typedef std::shared_ptr<const ActionGeneric> ConstPtr;
      37             :     
      38             :     /**
      39             :      * @brief default costructor. It is used when parsing a file with YamlWorker,
      40             :      * @warning If you use this costructor, then you must fill internal structures with \ref fillFromYaml 
      41             :      *      (or using \ref YamlWorker support class), it is the only way to set the internal infos (e.g. there is not a
      42             :      *      setName( name ) function ). If you have not a Yaml file to parse, use other costructors.
      43             :      */
      44             :     ActionGeneric() ;
      45             :     /**
      46             :      * @brief Simpliest costructor, need only essential infos
      47             :      * @note This costructor create \ref jointsInvolvedCount map. To do this, it considers a "not set" joint (count == 0) 
      48             :      *      a joint which pos is 0. If you do not want this, pass also your \ref JointsInvolvedCount map to the costructor
      49             :      */
      50             :     ActionGeneric (std::string actionName, ROSEE::JointPos jointPos); 
      51             :     
      52             :     /**
      53             :      * @brief Another costructor
      54             :      * @param actionName the name of this action
      55             :      * @param jointPos map containing position of ALL joints of your robot
      56             :      * @param jic map of counters of times of joints involved (e.g. joint not used --> 0 ; joint used for the action --> 1) 
      57             :      * 
      58             :      * @throw Be sure that keys of jointPos and jic are the same, otherwise exception is throw
      59             :      */
      60             :     ActionGeneric (std::string actionName, ROSEE::JointPos jointPos, JointsInvolvedCount jic); 
      61             :     ActionGeneric (std::string actionName, ROSEE::JointPos jointPos, JointsInvolvedCount jic, std::set <std::string> fingersInvolved); 
      62             :     
      63             :     /**
      64             :      * @brief Get the joint position related to this action, overriden from \ref Action
      65             :      * @return JointsPos the map indicating the position of the joints
      66             :      */
      67             :     JointPos getJointPos () const override;
      68             :     
      69             :     /**
      70             :      * @brief Get the joint position related to this action, overriden from \ref Action
      71             :      * Necessary to not make this class abstact, even if for a composed action we store only a single JointPos, so this
      72             :      * function return a single element vector
      73             :      * @return JointsPos the map indicating the position of the joints
      74             :      */
      75             :     std::vector < ROSEE::JointPos > getAllJointPos () const override;
      76             :     
      77             :     /**
      78             : 
      79             :      */
      80             :     virtual void emitYaml ( YAML::Emitter& out ) const override;
      81             :     
      82             :     /**
      83             : 
      84             :      */
      85             :     virtual bool fillFromYaml ( YAML::const_iterator yamlIt ) override;
      86             :     
      87             : protected:
      88             :     
      89             :     /**
      90             :      * @brief this costructor is only for derived class
      91             :      */
      92             :     ActionGeneric(std::string actionName) ;
      93             :     
      94             :     JointPos jointPos;
      95             : 
      96             :     
      97             : };
      98             : 
      99             : }
     100             : 
     101             : #endif // ROSEE_ACTIONGENERIC_H

Generated by: LCOV version 1.13