Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DynamicRobotState.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_DynamicRobotState_h_
00003 #define INCLUDED_DynamicRobotState_h_
00004 
00005 #include "Shared/plist.h"
00006 #include "Shared/plistSpecialty.h"
00007 
00008 //! This class provides a dynamic storage and serialization of robot state, such as output positions, buttons, and sensors
00009 /*! WorldState provides static storage for sensors, combined with PostureEngine for output values.
00010  *  In addition SensorState (from the hardware abstraction layer's DataSource) also serves this role.
00011  *  However all of these are based on the RobotInfo's declaration of offsets and array lengths, whereas
00012  *  this class relies on named entries which may or may not map to the current model */
00013 class DynamicRobotState : public plist::Dictionary {
00014 public:
00015   //! constructor
00016   DynamicRobotState() : outputs(), buttons(), sensors(), torques(), framePositions(), frameOrientations() { init(); }
00017   //! constructor
00018   DynamicRobotState(const DynamicRobotState& drs) : outputs(drs.outputs), buttons(drs.buttons), sensors(drs.sensors), torques(drs.torques), framePositions(drs.framePositions), frameOrientations(drs.framePositions) { init(); }
00019   
00020   plist::DictionaryOf<plist::Primitive<float> > outputs; //!< values for robot effectors, e.g. joint angles
00021   plist::DictionaryOf<plist::Primitive<float> > buttons; //!< values for buttons and generally sensors which should generate an event when a threshold is crossed
00022   plist::DictionaryOf<plist::Primitive<float> > sensors; //!< values for other sensors
00023   plist::DictionaryOf<plist::Primitive<float> > torques; //!< force information corresponding to #outputs
00024 
00025   plist::DictionaryOf<plist::Point> framePositions; //!< reference frame locations
00026   plist::DictionaryOf<plist::Point> frameOrientations; //!< reference frame orientations (as axis component of quaternion, use fmat::Quaternion::fromAxis(x) to "rehydrate")
00027 
00028 protected:
00029   //! adds members as plist entries for serialization
00030   void init() {
00031     addEntry("Outputs",outputs);
00032     addEntry("Buttons",buttons);
00033     addEntry("Sensors",sensors);
00034     addEntry("Torques",torques);
00035     addEntry("FramePositions",framePositions);
00036     addEntry("FrameOrientations",frameOrientations);
00037     setLoadSavePolicy(FIXED,SYNC);
00038   }
00039 };
00040 
00041 /*! @file
00042  * @brief 
00043  * @author Ethan Tira-Thompson (ejt) (Creator)
00044  */
00045 
00046 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:38 2016 by Doxygen 1.6.3