SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CParserOsim.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 CParserOsim.hpp
24  *
25  * Created on: May, 2010
26  *
27  * Copyright (C) 2010
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef CPARSEROSIM_HPP_
33 #define CPARSEROSIM_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 
47  class CParserOsim: public CParserBase
48  {
49  public:
74  virtual bool readOsimBiomechFromFile(
75  const std::string& arg_file,
76  scl::SRobotParsed& arg_biomech,
78 
79  /* Since the Osim format only has one robot in a file, the "arg_msys_name"
80  * argument is not used.
81  *
82  * Model
83  * - Actuator Set
84  * - Objects
85  * -Thelen2003Muscle (reads contents of this)
86  * -Schutte1993Muscle (reads contents of this) */
87  virtual bool readMuscleSysFromFile(
88  const std::string& arg_file,
89  const std::string& arg_msys_name,
91 
92  /* Since the Osim format only has one robot in a file, the "arg_robot_name"
93  * argument is not used. */
94  virtual bool readRobotFromFile(
95  const std::string& arg_file,
96  const std::string& arg_robot_name,
97  scl::SRobotParsed& arg_robot);
98 
99  virtual bool listRobotsInFile(const std::string& arg_file,
100  std::vector<std::string>& arg_robot_names)
101  { return false; }
102 
103  CParserOsim() : root_link_name_("ground") {}
104  virtual ~CParserOsim() {}
105 
106  private:
110  bool readBody(
111  const scl_tinyxml::TiXmlHandle& arg_tiHndl_link,
112  scl::SRobotParsed& arg_robot,
113  const std::string& arg_joint_type);
114 
115 #ifdef _WINDOWS
116  public:
117 #endif
118 
119  struct SOsimJoint{
121  scl::sFloat default_pos_,min_,max_;
122  std::string coord_name_;
123  scl::sBool is_rot_;
124  };
126  std::string name_, coord_name_;
127  Eigen::Vector3d axis_;
128  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
129  };
132  std::string name_, parent_name_;
133  Eigen::Vector3d pos_in_parent_;
134  Eigen::Quaternion<scl::sFloat> ori_in_parent_;
135  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
136  };
137 #ifdef _WINDOWS
138  private:
139 #endif
140 
143  bool readJoint(
144  const scl_tinyxml::TiXmlHandle& arg_tiHndl_jnt,
145  SOsimJoint& arg_joint);
146 
147  const std::string root_link_name_;
148  };
149 
150 }
151 
152 #endif /*CPARSEROSIM_HPP_*/
virtual bool readRobotFromFile(const std::string &arg_file, const std::string &arg_robot_name, scl::SRobotParsed &arg_robot)
Definition: CParserOsim.cpp:342
Definition: CParserOsim.hpp:120
virtual bool listRobotsInFile(const std::string &arg_file, std::vector< std::string > &arg_robot_names)
Definition: CParserOsim.hpp:99
Definition: SRobotParsed.hpp:51
Definition: CParserBase.hpp:56
Definition: CMappedList.hpp:85
virtual bool readMuscleSysFromFile(const std::string &arg_file, const std::string &arg_msys_name, scl::SActuatorSetMuscleParsed &arg_msys)
Definition: CParserOsim.cpp:71
Definition: SActuatorSetMuscleParsed.hpp:124
Definition: CParserOsim.hpp:47
bool sBool
Definition: DataTypes.hpp:54
Definition: CParserOsim.hpp:119
bool readBody(const scl_tinyxml::TiXmlHandle &arg_tiHndl_link, scl::SRobotParsed &arg_robot, const std::string &arg_joint_type)
Definition: CParserOsim.cpp:571
double sFloat
Definition: DataTypes.hpp:72
bool readJoint(const scl_tinyxml::TiXmlHandle &arg_tiHndl_jnt, SOsimJoint &arg_joint)
Definition: CParserOsim.cpp:897
virtual bool readOsimBiomechFromFile(const std::string &arg_file, scl::SRobotParsed &arg_biomech, scl::SActuatorSetMuscleParsed &arg_msys)
Definition: CParserOsim.cpp:49