Homepage Demos Overview Downloads Tutorials Reference
Credits

dynamics_sim.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2002-2004  Etienne Lachance
00003 
00004 This library is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU Lesser General Public License as
00006 published by the Free Software Foundation; either version 2.1 of the
00007 License, or (at your option) any later version.
00008 
00009 This library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU Lesser General Public License for more details.
00013 
00014 You should have received a copy of the GNU Lesser General Public
00015 License along with this library; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 Report problems and direct all questions to:
00020 
00021 email: etienne.lachance@polymtl.ca or richard.gourdeau@polymtl.ca
00022 -------------------------------------------------------------------------------
00023 Revision_history:
00024 
00025 2004/07/23: Ethan Tira-Thompson
00026     -Made destructor virtual (recommended for any classes with virtual functions
00027 -------------------------------------------------------------------------------
00028 */
00029 
00030 
00031 #ifndef DYNAMICS_SIM_H
00032 #define DYNAMICS_SIM_H
00033 
00034 /*!
00035   @file dynamics_sim.h
00036   @brief Header file for Dynamics definitions.
00037 */
00038 
00039 #include "control_select.h"
00040 #include "quaternion.h"
00041 #include "robot.h"
00042 #include "trajectory.h"
00043 
00044 #ifdef use_namespace
00045 namespace ROBOOP {
00046   using namespace NEWMAT;
00047 #endif
00048   //! @brief RCS/CVS version.
00049   static const char header_dynamics_sim_rcsid[] __UNUSED__ = "$Id: dynamics_sim.h,v 1.4 2005/07/26 03:22:09 ejt Exp $";
00050 
00051 
00052 /*!
00053   @class Dynamics
00054   @brief Dynamics simulation handling class.
00055 */
00056 class Dynamics
00057 {
00058 public:
00059     Dynamics(Robot_basic *robot_);
00060     virtual ~Dynamics() {}
00061     static Dynamics *Instance();
00062 
00063     void set_dof(Robot_basic *robot_);
00064     short set_controller(const Control_Select & x);
00065     short set_trajectory(const Trajectory_Select & x);
00066     ReturnMatrix set_robot_on_first_point_of_splines();
00067     void set_time_frame(const int nsteps);
00068     void set_final_time(const double tf);
00069     void reset_time();
00070     void Runge_Kutta4_Real_time();
00071     void Runge_Kutta4();
00072 
00073     virtual void plot(){} //!< Virtual plot functions.
00074 
00075 // private:
00076     ReturnMatrix xdot(const Matrix & xin);
00077 
00078     bool first_pass_Kutta; //!< First time in all Runge_Kutta4 functions.
00079     int ndof,              //!< Degree of freedom.
00080         dof_fix,           //!< Degree of freedom + virtual link.
00081         nsteps;            //!< Numbers of iterations between.
00082     double h,              //!< Runge Kutta temporary variable.
00083            h2,             //!< Runge Kutta temporary variable.
00084            time,           //!< Time during simulation.
00085            to,             //!< Initial simulation time.
00086            tf,             //!< Final time used in Runge_Kutta4_Real_time.
00087            tf_cont,        //!< Final time used in Runge_Kutta4.
00088            dt;             //!< Time frame.
00089     Matrix k1,             //!< Runge Kutta temporary variable.
00090            k2,             //!< Runge Kutta temporary variable.
00091            k3,             //!< Runge Kutta temporary variable.
00092            k4,             //!< Runge Kutta temporary variable.
00093            x,              //!< Stated vector obtain in Runge Kutta functions.
00094            xd;             //!< Statd vector derivative obtaint in xdot function.
00095     ColumnVector q,        //!< Joints positions.
00096                  qp,       //!< Joints velocities.
00097                  qpp,      //!< Joints accelerations.
00098                  qd,       //!< Desired joints positions.
00099                  qpd,      //!< Desired joints velocities.
00100                  tau,      //!< Controller output torque.
00101                  pd,       //!< Desired end effector cartesian position.
00102                  ppd,      //!< Desired end effector cartesian velocity.
00103                  pppd,     //!< Desired end effector cartesian acceleration.
00104                  wd,       //!< Desired end effector cartesian angular velocity.
00105                  wpd;      //!< Desired end effector cartesian angular acceleration.
00106     Quaternion quatd;      //!< Desired orientation express by a quaternion.
00107     Control_Select control;        //!< Instance of Control_Select class.
00108     Trajectory_Select path_select; //!< Instance of Trajectory_Select class.
00109     Robot_basic *robot;            //!< Pointer on Robot_basic class.
00110 
00111     static Dynamics *instance;     //!< Static pointer on Dynamics class.
00112 };
00113 
00114 #ifdef use_namespace
00115 }
00116 #endif
00117 
00118 #endif
00119 

ROBOOP v1.21a
Generated Tue Aug 16 16:32:14 2005 by Doxygen 1.4.4