SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
SForce.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 SForce.hpp
24  *
25  * Created on: Mar 23, 2011
26  *
27  * Copyright (C) 2011
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef SFORCE_HPP_
33 #define SFORCE_HPP_
34 
35 #include <scl/DataTypes.hpp>
36 #include <scl/data_structs/SObject.hpp>
37 #include <scl/data_structs/SRobotParsed.hpp>
38 #include <scl/data_structs/SRigidBodyDyn.hpp>
39 
40 #include <Eigen/Dense>
41 #include <string>
42 
43 namespace scl
44 {
52  struct SForce : public SObject
53  {
54  // Eigen requires redefining the new operator for classes that contain fixed size Eigen member-data.
55  // See http://eigen.tuxfamily.org/dox/StructHavingEigenMembers.html
56  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
57 
60 
62  std::string link_name_;
63 
66 
68  Eigen::Vector6d force_;
69 
71  Eigen::Vector3d pos_;
72 
74  Eigen::Vector3d direction_;
75 
82  Eigen::MatrixXd J_;
83 
85  SForce(): SObject("SForce"), robot_(NULL),link_name_(""),
86  rbd_(NULL){}
87 
89  virtual ~SForce(){}
90 
91  protected:
93  SForce(std::string arg_subclass_type): SObject(arg_subclass_type),
94  robot_(NULL),link_name_(""), rbd_(NULL){}
95  };
96 
114  struct SForceContact : public SForce
115  {
116  // Eigen requires redefining the new operator for classes that contain fixed size Eigen member-data.
117  // See http://eigen.tuxfamily.org/dox/StructHavingEigenMembers.html
118  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
119 
122 
124  std::string other_link_name_;
125 
128 
135  Eigen::MatrixXd other_J_;
136 
140  Eigen::Vector6d p_pre_, other_p_pre_;
141 
144  Eigen::Vector6d p_curr_, other_p_curr_;
145 
151 
155 
158 
160  SForceContact(): SForce("SForceContact"), other_robot_(NULL), other_link_name_(""),
162  energy_collision_(std::numeric_limits<sFloat>::quiet_NaN()){}
163 
165  virtual ~SForceContact(){}
166 
167  protected:
169  SForceContact(std::string arg_subclass_type): SForce(arg_subclass_type),
170  other_robot_(NULL), other_link_name_(""),
172  energy_collision_(std::numeric_limits<sFloat>::quiet_NaN()) {}
173  };
174 }
175 
176 #endif /* SFORCE_HPP_ */
EIGEN_MAKE_ALIGNED_OPERATOR_NEW const SRobotParsed * other_robot_
Definition: SForce.hpp:121
SForce(std::string arg_subclass_type)
Definition: SForce.hpp:93
std::string link_name_
Definition: SForce.hpp:62
virtual ~SForce()
Definition: SForce.hpp:89
Definition: SRobotParsed.hpp:51
Definition: SForce.hpp:114
Eigen::MatrixXd other_J_
Definition: SForce.hpp:135
EIGEN_MAKE_ALIGNED_OPERATOR_NEW const SRobotParsed * robot_
Definition: SForce.hpp:59
Eigen::Vector6d p_curr_
Definition: SForce.hpp:144
sFloat time_impulse_
Definition: SForce.hpp:154
virtual ~SForceContact()
Definition: SForce.hpp:165
SForceContact()
Definition: SForce.hpp:160
SForce()
Definition: SForce.hpp:85
sFloat energy_collision_
Definition: SForce.hpp:157
SForceContact(std::string arg_subclass_type)
Definition: SForce.hpp:169
Eigen::Vector3d pos_
Definition: SForce.hpp:71
const SRigidBodyDyn * other_rbd_
Definition: SForce.hpp:127
Definition: SForce.hpp:52
Eigen::Vector6d force_
Definition: SForce.hpp:68
const SRigidBodyDyn * rbd_
Definition: SForce.hpp:65
Eigen::MatrixXd J_
Definition: SForce.hpp:82
double sFloat
Definition: DataTypes.hpp:72
std::string other_link_name_
Definition: SForce.hpp:124
sFloat coeff_restitution_
Definition: SForce.hpp:150
Definition: SObject.hpp:43
Definition: SRigidBodyDyn.hpp:56
Eigen::Vector3d direction_
Definition: SForce.hpp:74
Eigen::Vector6d p_pre_
Definition: SForce.hpp:140