Libbarrett  1.2.4
include/barrett/products/puck_group.h
Go to the documentation of this file.
00001 
00032 #ifndef BARRETT_PRODUCTS_PUCK_GROUP_H_
00033 #define BARRETT_PRODUCTS_PUCK_GROUP_H_
00034 
00035 
00036 #include <vector>
00037 
00038 #include <barrett/bus/abstract/communications_bus.h>
00039 #include <barrett/products/puck.h>
00040 
00041 
00042 namespace barrett {
00043 
00044 
00045 class PuckGroup {
00046 public:
00047         PuckGroup(int id, const std::vector<Puck*>& pucks);
00048         ~PuckGroup();
00049 
00050         int getId() const { return id; }
00051         size_t numPucks() const { return pucks.size(); }
00052         int getPuckId(size_t i) const { return pucks.at(i)->getId(); }
00053         const std::vector<Puck*>& getPucks() const { return pucks; }
00054 
00055         bool verifyProperty(enum Puck::Property prop) const;
00056 
00057         void getProperty(enum Puck::Property prop, int results[], bool realtime = false) const;
00058         template<typename Parser> void getProperty(enum Puck::Property prop,
00059                         typename Parser::result_type results[], bool realtime = false) const;
00060 
00061         void setProperty(enum Puck::Property prop, int value) const;
00062 
00063         int getPropertyId(enum Puck::Property prop) const {
00064                 return pucks[0]->getPropertyId(prop);
00065         }
00066         int getPropertyIdNoThrow(enum Puck::Property prop) const {
00067                 return pucks[0]->getPropertyIdNoThrow(prop);
00068         }
00069 
00070 
00071         void sendGetPropertyRequest(int propId) const;
00072         template<typename Parser> void receiveGetPropertyReply(
00073                         int propId, typename Parser::result_type results[], bool realtime = false) const;
00074 
00075 
00076         enum BroadcastGroup {
00077                 BGRP_WHOLE_BUS = Puck::GROUP_MASK | 0,  // Everything but the Safety Puck
00078 
00079                 BGRP_WAM = Puck::GROUP_MASK | 4,  // The whole WAM (Pucks 1-7)
00080                 BGRP_LOWER_WAM = Puck::GROUP_MASK | 1,  // A packed-torque group (Pucks 1-4)
00081                 BGRP_UPPER_WAM = Puck::GROUP_MASK | 2,  // A packed-torque group (Pucks 5-7)
00082 
00083                 BGRP_HAND = Puck::GROUP_MASK | 5,  // The whole hand (Pucks 11-14)
00084         };
00085 
00086         enum FeedbackGroup {
00087                 // When responding to requests for a normal property, Pucks send to Group 6.
00088                 FGRP_OTHER = Puck::GROUP_MASK | 6,
00089 
00090                 // When responding to requests for motor encoder position, Pucks send to Group 3.
00091                 FGRP_MOTOR_POSITION = Puck::GROUP_MASK | 3,
00092                 // When responding to requests for a secondary encoder position (e.g.
00093                 // joint encoder or break-away encoder), Pucks send to Group 7.
00094                 FGRP_SECONDARY_POSITION = Puck::GROUP_MASK | 7,
00095 
00096                 // On BHands with tactile sensors, TOP10 formated TACT data is sent to Group 8.
00097                 FGRP_TACT_TOP10 = Puck::GROUP_MASK | 8,
00098                 // On BHands with tactile sensors, FULL formated TACT data is sent to Group 9.
00099                 FGRP_TACT_FULL = Puck::GROUP_MASK | 9,
00100 
00101                 // Force data from the F/T Sensor is sent to group 10.
00102                 FGRP_FT_FORCE = Puck::GROUP_MASK | 10,
00103                 // Torque data from the F/T Sensor is sent to group 11.
00104                 FGRP_FT_TORQUE = Puck::GROUP_MASK | 11,
00105                 // Accelerometer data from the F/T Sensor is sent to group 12.
00106                 FGRP_FT_ACCEL = Puck::GROUP_MASK | 12,
00107         };
00108 
00109 protected:
00110         int id;
00111         std::vector<Puck*> pucks;
00112         const bus::CommunicationsBus& bus;
00113 };
00114 
00115 
00116 }
00117 
00118 
00119 // include template definitions
00120 #include <barrett/products/detail/puck_group-inl.h>
00121 
00122 
00123 #endif /* BARRETT_PRODUCTS_PUCK_GROUP_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines