SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CDynamics3d.hpp
1 /* This file is part of scl, a control and simulation library
2 for robots and biomechanical models.
3 
4 scl is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8 
9 Alternatively, you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of
12 the License, or (at your option) any later version.
13 
14 scl is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License and a copy of the GNU General Public License along with
21 scl. If not, see <http://www.gnu.org/licenses/>.
22  */
23 /* \file CDynamics3d.hpp
24  *
25  * Created on: Mar 21, 2014
26  *
27  * Copyright (C) 2014
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef CDYNAMICS3D_HPP_
33 #define CDYNAMICS3D_HPP_
34 
35 #include <scl/DataTypes.hpp>
36 #include <scl/dynamics/CDynamicsBase.hpp>
37 
38 #include <Eigen/Dense>
39 
40 #include <string>
41 
42 namespace scl
43 {
44  class SGcModel;
45  struct SRobotSensors;
46 }
47 
48 //Dynamics3d forward declaration
49 class cDynamicBase;
50 class cDynamicWorld;
51 
52 namespace scl_ext
53 {
60  {
61  public:
62  /* *******************************************************************
63  * Integrator functions.
64  * ******************************************************************* */
65 
80  { return false; }
81 
94  virtual scl::sBool integrate(
98  scl::SRobotIO& arg_inputs,
102  const scl::sFloat arg_time_interval);
103 
104  /* *******************************************************************
105  * Dynamics State functions.
106  * ******************************************************************* */
112  const Eigen::VectorXd& arg_q,
114  const Eigen::VectorXd& arg_dq);
115 
121  const Eigen::VectorXd& arg_q);
122 
123  /* given the name of an object, computes the forces and torques around that object
124  * does not work with friction.
125  */
126  Eigen::Vector3d computeForce(std::string name);
127  Eigen::Vector3d computeTorque(std::string name, Eigen::Vector3d pos);
128  scl::sBool hasContacted(std::string name);
129  scl::sInt getNumContacts(std::string name);
130 
131  /* *******************************************************************
132  * Computational functions.
133  * ******************************************************************* */
135  virtual bool computeGCModel(
136  scl::SRobotSensors const * arg_sensor_data,
137  scl::SGcModel * arg_gc_model)
138  { return false; }
139 
150  virtual const void * getIdForLink(std::string arg_link_name);
151 
152 
153 
154  /* *******************************************************************
155  * Initialization functions.
156  * ******************************************************************* */
158  CDynamics3d();
159 
161  virtual ~CDynamics3d();
162 
173  virtual bool init(const scl::SRobotParsed& arg_robot_data);
174  /* Dynamics3d's base node */
175  cDynamicBase *c_base;
176 
177  private:
179  std::string robot_name_;
180 
182  size_t ndof_;
183 
185  Eigen::Vector3d gravity_;
186 
187  };
188 
189 }
190 
191 #endif /* CDYNAMICS3D_HPP_ */
Definition: SRobotIO.hpp:107
Definition: SRobotParsed.hpp:51
size_t ndof_
Definition: CDynamics3d.hpp:182
Definition: SGcModel.hpp:53
virtual const void * getIdForLink(std::string arg_link_name)
Definition: CDynamics3d.cpp:184
virtual scl::sFloat computeEnergyPotential(sutil::CMappedTree< std::string, scl::SRigidBodyDyn > &arg_tree, const Eigen::VectorXd &arg_q)
Definition: CDynamics3d.cpp:273
virtual bool init(const scl::SRobotParsed &arg_robot_data)
Definition: CDynamics3d.cpp:105
virtual bool computeGCModel(scl::SRobotSensors const *arg_sensor_data, scl::SGcModel *arg_gc_model)
Definition: CDynamics3d.hpp:135
Definition: CDynamicsBase.hpp:55
virtual scl::sBool computeExternalContacts(sutil::CMappedList< std::string, scl::SForce > &arg_contacts)
Definition: CDynamics3d.hpp:75
Eigen::Vector3d gravity_
Definition: CDynamics3d.hpp:185
bool sBool
Definition: DataTypes.hpp:54
virtual scl::sBool integrate(scl::SRobotIO &arg_inputs, const scl::sFloat arg_time_interval)
Definition: CDynamics3d.cpp:194
virtual scl::sFloat computeEnergyKinetic(sutil::CMappedTree< std::string, scl::SRigidBodyDyn > &arg_tree, const Eigen::VectorXd &arg_q, const Eigen::VectorXd &arg_dq)
Definition: CDynamics3d.cpp:264
virtual ~CDynamics3d()
Definition: CDynamics3d.cpp:62
Definition: CDynamics3d.hpp:59
CDynamics3d()
Definition: CDynamics3d.cpp:55
std::string robot_name_
Definition: CDynamics3d.hpp:179
double sFloat
Definition: DataTypes.hpp:72
int sInt
Definition: DataTypes.hpp:64
Definition: SRobotIO.hpp:49