SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
tao_util.hpp
Go to the documentation of this file.
1 /*
2  * Stanford Whole-Body Control Framework http://stanford-scl.sourceforge.net/
3  *
4  * Copyright (c) 1997-2009 Stanford University. All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program. If not, see
18  * <http://www.gnu.org/licenses/>
19  */
20 
27 #ifndef JSPACE_TAO_UTIL_H
28 #define JSPACE_TAO_UTIL_H
29 
30 #include <stdexcept>
31 #include <string>
32 #include <vector>
33 #include <map>
34 
35 
36 class taoNodeRoot;
37 class taoDNode;
38 class taoJoint;
39 
40 
41 namespace jspace
42 {
43  // =================================================================
44  // Tao data structure wrappers
45  // =================================================================
46 
52  struct STaoNodeInfo {
53  STaoNodeInfo();
54  STaoNodeInfo(taoDNode * node, std::string const & link_name,
55  std::string joint_name, double limit_lower, double limit_upper);
56  STaoNodeInfo(STaoNodeInfo const & orig);
57 
58  int id;
59  taoDNode * node;
60  taoJoint * joint;
61  std::string link_name;
62  std::string joint_name;
63  double limit_lower;
64  double limit_upper;
65  };
66 
67 
68  struct STaoTreeInfo {
69  STaoTreeInfo();
70 
72  virtual ~STaoTreeInfo();
73 
82  bool sort();
83 
84  taoNodeRoot * root;
85  std::vector<STaoNodeInfo> info;
86  };
87 
88  // =================================================================
89  // Tao helper functions
90  // =================================================================
91 
95  STaoTreeInfo * create_bare_tao_tree_info(taoNodeRoot * root);
96 
97 
106  int tao_consistency_check(
107  taoNodeRoot * root,
110  std::ostream * msg);
111 
116  void mapNodesToIDs(std::map<int, taoDNode*> & idToNodeMap,
117  taoDNode * node)
118  throw(std::runtime_error);
119 
120 
127  int countNumberOfLinks(taoDNode * root);
128 
129 
132  int countNumberOfJoints(taoDNode * node);
133 
134 
137  int countDegreesOfFreedom(taoDNode * node);
138 
139 
141  double computeTotalMass(taoDNode * node);
142 
143 }
144 
145 #endif // JSPACE_TAO_UTIL_H
Definition: tao_util.hpp:68
abstract node class for articulated bodyA dynamics node = {Articulated Body Link + Set of associated ...
Definition: taoDNode.h:46
root node class for articulated body dynamicsThis implements taoDNode for root node of a articulated ...
Definition: taoNode.h:147
bool sort()
Definition: tao_util.cpp:176
Definition: tao_util.hpp:52
virtual ~STaoTreeInfo()
Definition: tao_util.cpp:169
Base joint class for articulated bodyThis provides a joint for articulated body dynamics.
Definition: taoJoint.h:45