Gazebo Physics

API Reference

2.6.2
gz/physics/ForwardStep.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
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 
18 #ifndef GZ_PHYSICS_FORWARDSTEP_HH_
19 #define GZ_PHYSICS_FORWARDSTEP_HH_
20 
21 #include <string>
22 #include <vector>
23 
24 #include <gz/math.hh>
25 
28 
29 namespace ignition
30 {
31  namespace physics
32  {
33  // ---------------- Output Data Structures -----------------
34  // In the long-term, these data structures should be defined in some kind of
35  // meta-file, and our build system should generate these definitions during
36  // compilation. These are being defined here in this header until we know
37  // more about how the ECS will work.
38 
39  struct WorldPose
40  {
42 
44  };
45 
46  struct WorldPoses
47  {
50  };
51 
52  struct Point
53  {
55 
58  };
59 
60  struct FreeVector
61  {
63 
65  };
66 
68  {
72  };
73 
74  struct Contacts
75  {
78  };
79 
80  // ---------------- Input Data Structures -----------------
81  // Same note as for Output Data Structures. Eventually, these should be
82  // defined in some kind of meta files.
83 
84  struct TimeStep
85  {
86  double dt;
87  };
88 
89  struct ForceTorque
90  {
93 
96 
98  };
99 
101  {
105  };
106 
107  struct PIDValues
108  {
109  double P;
110  double I;
111  double D;
112  };
113 
115  {
118  };
119 
121  {
124  };
125 
127  {
130  };
131 
133  {
136 
138  };
139 
143  class ForwardStep : public virtual Feature
144  {
145  public: using Input = ExpectData<
150 
151  public: using Output = SpecifyData<
152  RequireData<WorldPoses>,
153  ExpectData<Contacts, JointPositions> >;
154 
155  public: using State = CompositeData;
156 
157  public: template <typename PolicyT, typename FeaturesT>
158  class World : public virtual Feature::World<PolicyT, FeaturesT>
159  {
160  public: void Step(Output &_h, State &_x, const Input &_u)
161  {
162  this->template Interface<ForwardStep>()->
163  WorldForwardStep(this->identity, _h, _x, _u);
164  }
165  };
166 
167  public: template <typename PolicyT>
169  {
170  public: virtual void WorldForwardStep(
171  const Identity &_worldID,
172  Output &_h,
173  State &_x,
174  const Input &_u) = 0;
175  };
176  };
177 
178  // ---------------- SetState Interface -----------------
179  // class SetState
180  // {
181  // public: using State = CompositeData;
182 
183  // public: virtual void SetStateTo(const State &x) = 0;
184 
185  // public: virtual ~SetState() = default;
186  // };
187  }
188 }
189 
190 #endif
double D
Definition: gz/physics/ForwardStep.hh:111
Definition: gz/physics/ForwardStep.hh:84
FreeVector torque
Definition: gz/physics/ForwardStep.hh:95
std::vector< GeneralizedParameters > commands
Definition: gz/physics/ForwardStep.hh:134
std::vector< std::size_t > dofs
Definition: gz/physics/ForwardStep.hh:102
STL class.
std::size_t relativeTo
Definition: gz/physics/ForwardStep.hh:56
std::size_t inCoordinatesOf
Definition: gz/physics/ForwardStep.hh:64
STL class.
std::vector< Point > entries
Definition: gz/physics/ForwardStep.hh:76
Definition: gz/physics/ForwardStep.hh:120
The SpecifyData class allows you to form combinations of data specifications. In other words,...
Definition: gz/physics/SpecifyData.hh:265
Point location
Definition: gz/physics/ForwardStep.hh:92
std::string annotation
Definition: gz/physics/ForwardStep.hh:49
ignition::math::Vector3d vec
Definition: gz/physics/ForwardStep.hh:62
std::vector< double > positions
Definition: gz/physics/ForwardStep.hh:70
std::vector< GeneralizedParameters > forces
Definition: gz/physics/ForwardStep.hh:122
std::size_t inCoordinatesOf
Definition: gz/physics/ForwardStep.hh:57
Definition: gz/physics/ForwardStep.hh:39
void Step(Output &_h, State &_x, const Input &_u)
Definition: gz/physics/ForwardStep.hh:160
std::string annotation
Definition: gz/physics/ForwardStep.hh:104
ignition::math::Vector3d point
Definition: gz/physics/ForwardStep.hh:54
Definition: gz/physics/ForwardStep.hh:89
std::string annotation
Definition: gz/physics/ForwardStep.hh:71
Definition: gz/physics/ForwardStep.hh:74
Definition: gz/physics/ForwardStep.hh:60
Definition: gz/physics/ForwardStep.hh:100
ignition::math::Pose3d pose
Definition: gz/physics/ForwardStep.hh:41
double P
Definition: gz/physics/ForwardStep.hh:109
ForwardStep is a feature that allows a simulation of a world to take one step forward in time.
Definition: gz/physics/ForwardStep.hh:143
std::vector< GeneralizedParameters > commands
Definition: gz/physics/ForwardStep.hh:128
std::string annotation
Definition: gz/physics/ForwardStep.hh:97
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: gz/physics/Feature.hh:35
Definition: gz/physics/ForwardStep.hh:158
Identity identity
This field contains information to identify the entity.
Definition: gz/physics/Entity.hh:292
double I
Definition: gz/physics/ForwardStep.hh:110
std::vector< ForceTorque > entries
Definition: gz/physics/ForwardStep.hh:116
ExpectData< ApplyExternalForceTorques, ApplyGeneralizedForces, VelocityControlCommands, ServoControlCommands > Input
Definition: gz/physics/ForwardStep.hh:149
std::string annotation
Definition: gz/physics/ForwardStep.hh:117
The CompositeData class allows arbitrary data structures to be composed together, copied,...
Definition: gz/physics/CompositeData.hh:43
Definition: gz/physics/ForwardStep.hh:168
std::vector< std::size_t > dofs
Definition: gz/physics/ForwardStep.hh:69
double dt
Definition: gz/physics/ForwardStep.hh:86
std::size_t body
Definition: gz/physics/ForwardStep.hh:91
Definition: gz/physics/ForwardStep.hh:126
Definition: gz/physics/ForwardStep.hh:114
Placeholder class in case a Feature does not define its own World API.
Definition: gz/physics/Feature.hh:49
std::string annotation
Definition: gz/physics/ForwardStep.hh:137
Definition: gz/physics/ForwardStep.hh:107
std::vector< WorldPose > entries
Definition: gz/physics/ForwardStep.hh:48
std::string annotation
Definition: gz/physics/ForwardStep.hh:77
Definition: gz/physics/ForwardStep.hh:46
std::string annotation
Definition: gz/physics/ForwardStep.hh:123
std::string annotation
Definition: gz/physics/ForwardStep.hh:129
Definition: gz/physics/ForwardStep.hh:132
Definition: gz/physics/ForwardStep.hh:67
std::vector< double > forces
Definition: gz/physics/ForwardStep.hh:103
Definition: gz/physics/ForwardStep.hh:52
FreeVector force
Definition: gz/physics/ForwardStep.hh:94
std::size_t body
Definition: gz/physics/ForwardStep.hh:43
std::vector< PIDValues > gains
Definition: gz/physics/ForwardStep.hh:135