Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
dynamics_sim.hGo 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 //! @brief RCS/CVS version. 00040 static const char header_dynamics_sim_rcsid[] = "$Id: dynamics_sim.h,v 1.3 2004/07/23 21:33:46 ejt Exp $"; 00041 00042 #include "control_select.h" 00043 #include "quaternion.h" 00044 #include "robot.h" 00045 #include "trajectory.h" 00046 00047 #ifdef use_namespace 00048 namespace ROBOOP { 00049 using namespace NEWMAT; 00050 #endif 00051 00052 00053 /*! 00054 @class Dynamics 00055 @brief Dynamics simulation handling class. 00056 */ 00057 class Dynamics 00058 { 00059 public: 00060 Dynamics(Robot_basic *robot_); 00061 virtual ~Dynamics() {} 00062 static Dynamics *Instance(); 00063 00064 void set_dof(Robot_basic *robot_); 00065 short set_controller(const Control_Select & x); 00066 short set_trajectory(const Trajectory_Select & x); 00067 ReturnMatrix set_robot_on_first_point_of_splines(); 00068 void set_time_frame(const int nsteps); 00069 void set_final_time(const double tf); 00070 void reset_time(); 00071 void Runge_Kutta4_Real_time(); 00072 void Runge_Kutta4(); 00073 00074 virtual void plot(){} //!< Virtual plot functions. 00075 00076 // private: 00077 ReturnMatrix xdot(const Matrix & xin); 00078 00079 bool first_pass_Kutta; //!< First time in all Runge_Kutta4 functions. 00080 int ndof, //!< Degree of freedom. 00081 dof_fix, //!< Degree of freedom + virtual link. 00082 nsteps; //!< Numbers of iterations between. 00083 double h, //!< Runge Kutta temporary variable. 00084 h2, //!< Runge Kutta temporary variable. 00085 time, //!< Time during simulation. 00086 to, //!< Initial simulation time. 00087 tf, //!< Final time used in Runge_Kutta4_Real_time. 00088 tf_cont, //!< Final time used in Runge_Kutta4. 00089 dt; //!< Time frame. 00090 Matrix k1, //!< Runge Kutta temporary variable. 00091 k2, //!< Runge Kutta temporary variable. 00092 k3, //!< Runge Kutta temporary variable. 00093 k4, //!< Runge Kutta temporary variable. 00094 x, //!< Stated vector obtain in Runge Kutta functions. 00095 xd; //!< Statd vector derivative obtaint in xdot function. 00096 ColumnVector q, //!< Joints positions. 00097 qp, //!< Joints velocities. 00098 qpp, //!< Joints accelerations. 00099 qd, //!< Desired joints positions. 00100 qpd, //!< Desired joints velocities. 00101 tau, //!< Controller output torque. 00102 pd, //!< Desired end effector cartesian position. 00103 ppd, //!< Desired end effector cartesian velocity. 00104 pppd, //!< Desired end effector cartesian acceleration. 00105 wd, //!< Desired end effector cartesian angular velocity. 00106 wpd; //!< Desired end effector cartesian angular acceleration. 00107 Quaternion quatd; //!< Desired orientation express by a quaternion. 00108 Control_Select control; //!< Instance of Control_Select class. 00109 Trajectory_Select path_select; //!< Instance of Trajectory_Select class. 00110 Robot_basic *robot; //!< Pointer on Robot_basic class. 00111 00112 static Dynamics *instance; //!< Static pointer on Dynamics class. 00113 }; 00114 00115 #ifdef use_namespace 00116 } 00117 #endif 00118 00119 #endif 00120 |
ROBOOP v1.21a |
Generated Tue Jan 4 15:42:24 2005 by Doxygen 1.4.0 |