MBSim

Project Page
rigid_body_observer.h
00001 /* Copyright (C) 2004-2011 MBSim Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact: martin.o.foerg@gmail.com
00018  */
00019 
00020 #ifndef _RIGID_BODY_OBSERVER_H__
00021 #define _RIGID_BODY_OBSERVER_H__
00022 #include "mbsim/observer.h"
00023 
00024 #ifdef HAVE_OPENMBVCPPINTERFACE
00025 #include <mbsim/utils/openmbv_utils.h>
00026 namespace OpenMBV {
00027   class Frame;
00028 }
00029 #endif
00030 
00031 namespace MBSim {
00032   class RigidBody;
00033   class Frame;
00034 
00035   class RigidBodyObserver: public Observer {
00036     private:
00037       RigidBody* body;
00038 #ifdef HAVE_OPENMBVCPPINTERFACE
00039       OpenMBV::Group* openMBVGrp;
00040       OpenMBV::Arrow *openMBVAxisOfRotation;
00041 #endif
00042 
00043     public:
00044       RigidBodyObserver(const std::string &name);
00045       void setRigidBody(RigidBody *body_) { body = body_; } 
00046 
00047       void init(InitStage stage);
00048       virtual void plot(double t, double dt);
00049 
00050 #ifdef HAVE_OPENMBVCPPINTERFACE
00051 //      BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVAxisOfRotation, tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(scaleLength,(double),1)(scaleSize,(double),1))) { openMBVAxisOfRotation=enableOpenMBVArrow(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize); }
00052 #endif
00053 
00054   };
00055 
00056 }  
00057 
00058 #endif
00059