All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModelState.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /* Desc: A model state
18  * Author: Nate Koenig
19  */
20 
21 #ifndef _MODEL_STATE_HH_
22 #define _MODEL_STATE_HH_
23 
24 #include <vector>
25 #include <string>
26 
27 #include "physics/State.hh"
28 #include "physics/LinkState.hh"
29 #include "physics/JointState.hh"
30 #include "math/Pose.hh"
31 
32 namespace gazebo
33 {
34  namespace physics
35  {
38 
47  class ModelState : public State
48  {
50  public: ModelState();
51 
57  public: explicit ModelState(ModelPtr _model);
58 
60  public: virtual ~ModelState();
61 
66  public: virtual void Load(sdf::ElementPtr _elem);
67 
70  public: math::Pose GetPose() const;
71 
76  public: unsigned int GetLinkStateCount() const;
77 
84  public: LinkState GetLinkState(unsigned int _index) const;
85 
92  public: LinkState GetLinkState(const std::string &_linkName) const;
93 
98  public: unsigned int GetJointStateCount() const;
99 
106  public: JointState GetJointState(unsigned int _index) const;
107 
114  public: JointState GetJointState(const std::string &_jointName) const;
115 
120  public: void FillStateSDF(sdf::ElementPtr _elem);
121 
127  public: void UpdateModelSDF(sdf::ElementPtr _elem);
128 
130  private: math::Pose pose;
131 
133  private: std::vector<LinkState> linkStates;
134 
136  private: std::vector<JointState> jointStates;
137  };
139  }
140 }
141 #endif