dynamic_model.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 Copyright (c) 2018, Alexander W. Winkler. All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 
00010 * Redistributions in binary form must reproduce the above copyright notice,
00011   this list of conditions and the following disclaimer in the documentation
00012   and/or other materials provided with the distribution.
00013 
00014 * Neither the name of the copyright holder nor the names of its
00015   contributors may be used to endorse or promote products derived from
00016   this software without specific prior written permission.
00017 
00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00022 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00023 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00024 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00025 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00026 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00027 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 ******************************************************************************/
00029 
00030 #ifndef TOWR_MODELS_DYNAMIC_MODEL_H_
00031 #define TOWR_MODELS_DYNAMIC_MODEL_H_
00032 
00033 #include <memory>
00034 #include <vector>
00035 
00036 #include <Eigen/Dense>
00037 #include <Eigen/Sparse>
00038 
00039 #include <towr/variables/euler_converter.h>
00040 
00041 namespace towr {
00042 
00058 class DynamicModel {
00059 public:
00060   using Ptr      = std::shared_ptr<DynamicModel>;
00061   using Vector3d = Eigen::Vector3d;
00062   using Matrix3d = Eigen::Matrix3d;
00063   using ComPos   = Eigen::Vector3d;
00064   using AngVel   = Eigen::Vector3d;
00065   using BaseAcc  = Eigen::Matrix<double,6,1>;
00066   using Jac      = Eigen::SparseMatrix<double, Eigen::RowMajor>;
00067   using EEPos    = std::vector<Eigen::Vector3d>;
00068   using EELoad   = EEPos;
00069   using EE       = uint;
00070 
00081   void SetCurrent(const ComPos& com_W, const Vector3d com_acc_W,
00082                   const Matrix3d& w_R_b, const AngVel& omega_W, const Vector3d& omega_dot_W,
00083                   const EELoad& force_W, const EEPos& pos_W);
00084 
00089   virtual BaseAcc GetDynamicViolation() const = 0;
00090 
00099   virtual Jac GetJacobianWrtBaseLin(const Jac& jac_base_lin_pos,
00100                                     const Jac& jac_base_lin_acc) const = 0;
00101 
00110   virtual Jac GetJacobianWrtBaseAng(const EulerConverter& base_angular,
00111                                     double t) const = 0;
00112 
00121   virtual Jac GetJacobianWrtForce(const Jac& ee_force, EE ee) const = 0;
00122 
00131   virtual Jac GetJacobianWrtEEPos(const Jac& ee_pos, EE ee) const = 0;
00132 
00136   double g() const { return g_; };
00137 
00141   double m() const { return m_; };
00142 
00146   int GetEECount() const { return ee_pos_.size(); };
00147 
00148 protected:
00149   ComPos com_pos_;   
00150   Vector3d com_acc_; 
00151 
00152   Matrix3d w_R_b_;     
00153   AngVel omega_;       
00154   Vector3d omega_dot_; 
00155 
00156   EEPos  ee_pos_;   
00157   EELoad ee_force_; 
00158 
00163   DynamicModel(double mass, int ee_count);
00164   virtual ~DynamicModel () = default;
00165 
00166 private:
00167   double g_; 
00168   double m_; 
00169 };
00170 
00171 } /* namespace towr */
00172 
00173 #endif /* TOWR_MODELS_DYNAMIC_MODEL_H_ */


towr_core
Author(s): Alexander W. Winkler
autogenerated on Mon Apr 9 2018 03:12:44