MBSim

Project Page
cartesian_coordinates_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 _CARTESIAN_COORDINATES_OBSERVER_H__
00021 #define _CARTESIAN_COORDINATES_OBSERVER_H__
00022 #include "mbsim/observer.h"
00023 #ifdef HAVE_OPENMBVCPPINTERFACE
00024 #include <openmbvcppinterface/arrow.h>
00025 
00026 namespace OpenMBV {
00027   class Frame;
00028 }
00029 #endif
00030 
00031 namespace MBSim {
00032   class Frame;
00033 
00034   class CartesianCoordinatesObserver : public Observer {
00035     private:
00036       Frame* frame;
00037       fmatvec::Vec3 ex, ey, ez;
00038       fmatvec::SqrMat3 A;
00039 #ifdef HAVE_OPENMBVCPPINTERFACE
00040       OpenMBV::Arrow *openMBVPosition,*openMBVXPosition, *openMBVYPosition, *openMBVZPosition, *openMBVVelocity, *openMBVXVelocity, *openMBVYVelocity, *openMBVZVelocity, *openMBVAcceleration, *openMBVXAcceleration, *openMBVYAcceleration, *openMBVZAcceleration; 
00041       OpenMBV::Frame* openMBVFrame;
00042 #endif
00043 
00044     public:
00045       CartesianCoordinatesObserver(const std::string &name);
00046       void setFrame(Frame *frame_) { frame = frame_; } 
00047       void setOrientation(const fmatvec::SqrMat3 &A_) { A = A_; } 
00048 
00049       void init(InitStage stage);
00050       virtual void plot(double t, double dt);
00051 
00052 #ifdef HAVE_OPENMBVCPPINTERFACE
00053       virtual void enableOpenMBVPosition(double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
00054       virtual void enableOpenMBVVelocity(double scale=1, OpenMBV::Arrow::ReferencePoint refPoint=OpenMBV::Arrow::fromPoint, double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
00055       virtual void enableOpenMBVAcceleration(double scale=1, OpenMBV::Arrow::ReferencePoint refPoint=OpenMBV::Arrow::fromPoint, double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
00056       virtual void enableOpenMBVFrame(double size=1, double offset=1);
00057 #endif
00058 
00059   };
00060 
00061 }  
00062 
00063 #endif
00064