ShadowHandUtilityLibrary
shadow_hand.hpp
Go to the documentation of this file.
1 //
2 // Created by behzad on 6/5/19.
3 //
4 
6 
12 namespace shadow_hand {
18 class Hand {
19 public:
25  std::vector<std::shared_ptr<shadow_finger::Finger>> _fingerVec;
26 
32  Hand(std::initializer_list<std::shared_ptr<shadow_finger::Finger>>
33  fingers_list) {
34  // Minimum 2 fingers are required in Hand
35  assert(fingers_list.size() >= 2);
36  // Populate Hand with Fingers
37  for (auto finger : fingers_list) {
38  _fingerVec.push_back(finger);
39  }
40  ROS_INFO_STREAM("Initialized Hand with: " << _fingerVec.size()
41  << " fingers.");
42  }
43 
48  void addFinger(const std::shared_ptr<shadow_finger::Finger> &finger) {
49  _fingerVec.push_back(finger);
50  }
51 
56  int numFingers() { return _fingerVec.size(); }
57 
62  std::vector<std::shared_ptr<shadow_finger::Finger>> getFingers() {
63  return _fingerVec;
64  }
65 };
66 } // namespace shadow_hand
Utility functions for managing groups of fingers of Shadow Hand. Constructs "Hand" class of shared po...
Definition: shadow_hand.hpp:18
Utility functions for managing groups of fingers of Shadow Hand. Constructs "Hand" class of shared po...
Hand(std::initializer_list< std::shared_ptr< shadow_finger::Finger >> fingers_list)
Constructor for Hand class, takes in arbitrary number of shared pointers to Fingers.
Definition: shadow_hand.hpp:32
std::vector< std::shared_ptr< shadow_finger::Finger > > getFingers()
Return all instances of Fingers in Hand as vector.
Definition: shadow_hand.hpp:62
std::vector< std::shared_ptr< shadow_finger::Finger > > _fingerVec
Vector of the shared pointers to the fingers that we want to control Shared pointers because you cann...
Definition: shadow_hand.hpp:25
void addFinger(const std::shared_ptr< shadow_finger::Finger > &finger)
Add Finger to Hand.
Definition: shadow_hand.hpp:48
int numFingers()
Get number of Fingers in hand.
Definition: shadow_hand.hpp:56