SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CParserOsimForOldFiles.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 CParserOsimForOldFiles.hpp
24  *
25  * Created on: Jan, 2011
26  *
27  * Copyright (C) 2011
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef CPARSEROSIMFOROLDFILES_HPP_
33 #define CPARSEROSIMFOROLDFILES_HPP_
34 
35 #include <scl/DataTypes.hpp>
36 #include <scl/parser/CParserBase.hpp>
37 
38 //The tinyxml parser implementation for sai xml files
39 #include <scl_tinyxml/scl_tinyxml.h>
40 
41 
42 namespace scl
43 {
44 
50  {
51  public:
76  virtual bool readOsimBiomechFromFile(
77  const std::string& arg_file,
78  scl::SRobotParsed& arg_biomech,
80 
81  /* Since the Osim format only has one robot in a file, the "arg_msys_name"
82  * argument is not used.
83  *
84  * Model
85  * - Actuator Set
86  * - Objects
87  * -Thelen2003Muscle (reads contents of this)
88  * -Schutte1993Muscle (reads contents of this) */
89  virtual bool readMuscleSysFromFile(
90  const std::string& arg_file,
91  const std::string& arg_msys_name,
93 
94  /* Since the Osim format only has one robot in a file, the "arg_robot_name"
95  * argument is not used. */
96  virtual bool readRobotFromFile(
97  const std::string& arg_file,
98  const std::string& arg_robot_name,
99  scl::SRobotParsed& arg_robot);
100 
101  virtual bool listRobotsInFile(const std::string& arg_file,
102  std::vector<std::string>& arg_robot_names)
103  { return false; }
104 
105  CParserOsimForOldFiles() : root_link_name_("ground") {}
106  virtual ~CParserOsimForOldFiles() {}
107 
108  private:
112  bool readBody(
113  const scl_tinyxml::TiXmlHandle& arg_tiHndl_link,
114  scl::SRobotParsed& arg_robot,
115  const std::string& arg_joint_type);
116 
117 #ifdef _WINDOWS
118  public:
119 #endif
120 
121  struct SOsimJoint{
123  scl::sFloat default_pos_,min_,max_;
124  std::string coord_name_;
125  };
127  std::string name_, coord_name_;
128  scl::sBool is_rot_;
129  Eigen::Vector3d axis_;
130  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
131  };
134  std::string name_, parent_name_;
135  Eigen::Vector3d pos_in_parent_;
136  Eigen::Quaternion<scl::sFloat> ori_in_parent_;
137  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
138  };
139 #ifdef _WINDOWS
140  private:
141 #endif
142 
144  bool readJoint(
145  const scl_tinyxml::TiXmlHandle& arg_tiHndl_jnt,
146  SOsimJoint& arg_joint);
147 
148  const std::string root_link_name_;
149  };
150 
151 }
152 
153 #endif /*CPARSEROSIMFOROLDFILES_HPP_*/
Definition: CParserOsimForOldFiles.hpp:126
bool readJoint(const scl_tinyxml::TiXmlHandle &arg_tiHndl_jnt, SOsimJoint &arg_joint)
Definition: CParserOsimForOldFiles.cpp:794
Definition: CParserOsimForOldFiles.hpp:122
bool readBody(const scl_tinyxml::TiXmlHandle &arg_tiHndl_link, scl::SRobotParsed &arg_robot, const std::string &arg_joint_type)
Definition: CParserOsimForOldFiles.cpp:496
Definition: SRobotParsed.hpp:51
Definition: CParserBase.hpp:56
Definition: CMappedList.hpp:85
Definition: SActuatorSetMuscleParsed.hpp:124
bool sBool
Definition: DataTypes.hpp:54
Definition: CParserOsimForOldFiles.hpp:121
Definition: CParserOsimForOldFiles.hpp:49
virtual bool readMuscleSysFromFile(const std::string &arg_file, const std::string &arg_msys_name, scl::SActuatorSetMuscleParsed &arg_msys)
Definition: CParserOsimForOldFiles.cpp:71
double sFloat
Definition: DataTypes.hpp:72
virtual bool listRobotsInFile(const std::string &arg_file, std::vector< std::string > &arg_robot_names)
Definition: CParserOsimForOldFiles.hpp:101
virtual bool readOsimBiomechFromFile(const std::string &arg_file, scl::SRobotParsed &arg_biomech, scl::SActuatorSetMuscleParsed &arg_msys)
Definition: CParserOsimForOldFiles.cpp:49
virtual bool readRobotFromFile(const std::string &arg_file, const std::string &arg_robot_name, scl::SRobotParsed &arg_robot)
Definition: CParserOsimForOldFiles.cpp:257