Privacy
An open-source, flexible 3D physical simulation framework
jointStruct.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011, 2012, DFKI GmbH Robotics Innovation Center
3  *
4  * This file is part of the MARS simulation framework.
5  *
6  * MARS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3
9  * of the License, or (at your option) any later version.
10  *
11  * MARS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with MARS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef MARS_INTERFACES_JOINT_STRUCT_H
22 #define MARS_INTERFACES_JOINT_STRUCT_H
23 
24 #include "MARSDefs.h"
25 #include <mars/utils/Vector.h>
26 
27 #include <string>
28 
29 namespace mars {
30  namespace interfaces {
31 
35  struct jointStruct {
36 
40  explicit jointStruct( const std::string& name = "", JointType type = JOINT_TYPE_UNDEFINED, unsigned long node_id1 = 0, unsigned long node_id2 = 0 )
41  {
42  init( name, type, node_id1, node_id2 );
43  }
44 
50  void init( const std::string& name = "", JointType type = JOINT_TYPE_UNDEFINED, unsigned long node_id1 = 0, unsigned long node_id2 = 0 )
51  {
52  this->name = name;
53  index = 0;
54  this->type = type;
55  nodeIndex1 = node_id1;
56  nodeIndex2 = node_id2;
57  anchorPos = 0;
58  spring_constant = 0;
59  damping_constant = 0;
60  lowStopAxis1 = 0;
61  highStopAxis1 = 0;
64  lowStopAxis2 = 0;
65  highStopAxis2 = 0;
68  angle1_offset = 0;
69  angle2_offset = 0;
70  anchor.setZero();
71  axis1.setZero();
72  axis1.setZero();
73  axis2.setZero();
74  }
75 
76  std::string name; // the joints name
77  unsigned long index; // index umber of the joint
78  JointType type; // type of the joint in the physic
79  unsigned long nodeIndex1; // index of the first node the joint is connected to
80  unsigned long nodeIndex2; // index of the second node the joint is connected to
81  utils::Vector anchor; // the anchor positino of the joint
82  int anchorPos; // the anchor configuration as node1,node2,center or custom
83  utils::Vector axis1; // the first axis rotation, defined through a (0,0,0) point and
84  // and the given position
85  // 1,0,0 --> the x axis and so on
86  utils::Vector axis2; // the second axis rotation
87  // the spring and damping constants
100 
101  }; // end of struct jointStruct
102 
103 
105  a.init();
106  }
107 
108 
109 #define NEW_JOINT_STRUCT(a) \
110  jointStruct a;
111 
112  } // end of namespace interfaces
113 } // end of namespace mars
114 
115 #endif /* MARS_INTERFACES_JOINT_STRUCT_H */
void ZERO_JOINT_STRUCT(jointStruct &a)
Definition: jointStruct.h:104
u_int8_t a
Definition: CameraSensor.h:44
double sReal
Definition: MARSDefs.h:49
jointStruct is a struct to exchange joint information between the GUI and the simulation ...
Definition: jointStruct.h:35
Copyright 2012, DFKI GmbH Robotics Innovation Center.
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vector
Definition: Vector.h:43
jointStruct(const std::string &name="", JointType type=JOINT_TYPE_UNDEFINED, unsigned long node_id1=0, unsigned long node_id2=0)
default constructor will leave the joint struct initialized with 0 values
Definition: jointStruct.h:40
void init(const std::string &name="", JointType type=JOINT_TYPE_UNDEFINED, unsigned long node_id1=0, unsigned long node_id2=0)
initialize joint struct with zero values.
Definition: jointStruct.h:50