Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PostureNode.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_PostureNode_h_
00003 #define INCLUDED_PostureNode_h_
00004 
00005 #include "MCNode.h"
00006 #include "Events/EventRouter.h"
00007 #include "Motion/PostureMC.h"
00008 #include "Shared/MarkScope.h"
00009 
00010 //!default name for PostureNode's (have to instantiate a variable in order to use as a template argument)
00011 /*! instantiation will be placed in MCNode.cc to avoid file bloat */
00012 extern const char defPostureNodeName[];
00013 //!default description for PostureNode's (have to instantiate a variable in order to use as a template argument)
00014 /*! instantiation will be placed in MCNode.cc to avoid file bloat */
00015 extern const char defPostureNodeDesc[];
00016 
00017 //! A simple StateNode that executes a PostureMC motion command
00018 /*! Caches the posture file in a private PostureEngine because the
00019  *  motion command might be shared with other functions that are
00020  *  using it for other purposes */
00021 class PostureNode : public MCNode<PostureMC,defPostureNodeName,defPostureNodeDesc,true> {
00022 public:
00023   
00024   //! Constructor: takes optional instance name and filename.
00025   /*! Caches the posture file in a private PostureEngine because the
00026     motion command might be shared with other functions that are
00027     using it for other purposes */
00028   PostureNode(const std::string &nodename=defPostureNodeName, const std::string &filename=std::string());
00029   
00030   virtual void preStart();
00031 
00032   //! loads the specified file into #posture, note this @em doesn't affect the current PostureMC, just the cached one which will be loaded into it on next activation.  See getPosture(), getMC_ID()
00033   virtual void loadFile(const std::string &filename);
00034   
00035   //! accessor for #posture, note this @em doesn't affect the current PostureMC, just the cached one which will be loaded into it on next activation.  See getMC_ID()
00036   virtual PostureEngine& getPosture() { return posture; }
00037   //! accessor for #posture, note this @em doesn't return the current PostureMC, just the cached one which will be loaded into it on next activation.  See getMC_ID()
00038   virtual const PostureEngine& getPosture() const { return posture; }
00039   
00040 protected:
00041   //! The internal cache of joint positions, copied to the motion command when activated.
00042   /*! This allows the motion command to be shared by other nodes/behaviors, which might modify
00043    *  the posture on an ongoing basis. */
00044   PostureEngine posture;
00045 };
00046 
00047 /*! @file
00048  * @brief Defines PostureNode, a simple StateNode that runs a PostureMC motion command
00049  * @author dst
00050  */
00051 
00052 #endif

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