Gazebo Physics

API Reference

5.4.0
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 
56  {
59  };
60 
61  struct Point
62  {
64 
67  };
68 
69  struct FreeVector
70  {
72 
74  };
75 
77  {
81  };
82 
83  struct Contacts
84  {
87  };
88 
89  // ---------------- Input Data Structures -----------------
90  // Same note as for Output Data Structures. Eventually, these should be
91  // defined in some kind of meta files.
92 
93  struct TimeStep
94  {
95  double dt;
96  };
97 
98  struct ForceTorque
99  {
102 
105 
107  };
108 
110  {
114  };
115 
116  struct PIDValues
117  {
118  double P;
119  double I;
120  double D;
121  };
122 
124  {
127  };
128 
130  {
133  };
134 
136  {
139  };
140 
142  {
145 
147  };
148 
152  class ForwardStep : public virtual Feature
153  {
154  public: using Input = ExpectData<
159 
160  public: using Output = SpecifyData<
161  RequireData<WorldPoses>,
162  ExpectData<ChangedWorldPoses, Contacts, JointPositions> >;
163 
164  public: using State = CompositeData;
165 
166  public: template <typename PolicyT, typename FeaturesT>
167  class World : public virtual Feature::World<PolicyT, FeaturesT>
168  {
169  public: void Step(Output &_h, State &_x, const Input &_u)
170  {
171  this->template Interface<ForwardStep>()->
172  WorldForwardStep(this->identity, _h, _x, _u);
173  }
174  };
175 
176  public: template <typename PolicyT>
178  {
179  public: virtual void WorldForwardStep(
180  const Identity &_worldID,
181  Output &_h,
182  State &_x,
183  const Input &_u) = 0;
184  };
185  };
186 
187  // ---------------- SetState Interface -----------------
188  // class SetState
189  // {
190  // public: using State = CompositeData;
191 
192  // public: virtual void SetStateTo(const State &x) = 0;
193 
194  // public: virtual ~SetState() = default;
195  // };
196  }
197 }
198 
199 #endif
The CompositeData class allows arbitrary data structures to be composed together, copied,...
Definition: gz/physics/CompositeData.hh:44
Identity identity
This field contains information to identify the entity.
Definition: gz/physics/Entity.hh:292
Placeholder class in case a Feature does not define its own World API.
Definition: gz/physics/Feature.hh:50
This class defines the concept of a Feature. It should be inherited by classes that define some plugi...
Definition: gz/physics/Feature.hh:36
Definition: gz/physics/ForwardStep.hh:178
virtual void WorldForwardStep(const Identity &_worldID, Output &_h, State &_x, const Input &_u)=0
Definition: gz/physics/ForwardStep.hh:168
void Step(Output &_h, State &_x, const Input &_u)
Definition: gz/physics/ForwardStep.hh:169
ForwardStep is a feature that allows a simulation of a world to take one step forward in time.
Definition: gz/physics/ForwardStep.hh:153
ExpectData< ApplyExternalForceTorques, ApplyGeneralizedForces, VelocityControlCommands, ServoControlCommands > Input
Definition: gz/physics/ForwardStep.hh:158
The SpecifyData class allows you to form combinations of data specifications. In other words,...
Definition: gz/physics/SpecifyData.hh:265
Definition: gz/physics/ForwardStep.hh:124
std::vector< ForceTorque > entries
Definition: gz/physics/ForwardStep.hh:125
std::string annotation
Definition: gz/physics/ForwardStep.hh:126
Definition: gz/physics/ForwardStep.hh:130
std::vector< GeneralizedParameters > forces
Definition: gz/physics/ForwardStep.hh:131
std::string annotation
Definition: gz/physics/ForwardStep.hh:132
ChangedWorldPoses has the same definition as WorldPoses. This type provides a way to keep track of wh...
Definition: gz/physics/ForwardStep.hh:56
std::string annotation
Definition: gz/physics/ForwardStep.hh:58
std::vector< WorldPose > entries
Definition: gz/physics/ForwardStep.hh:57
Definition: gz/physics/ForwardStep.hh:84
std::vector< Point > entries
Definition: gz/physics/ForwardStep.hh:85
std::string annotation
Definition: gz/physics/ForwardStep.hh:86
Definition: gz/physics/ForwardStep.hh:99
FreeVector torque
Definition: gz/physics/ForwardStep.hh:104
std::size_t body
Definition: gz/physics/ForwardStep.hh:100
FreeVector force
Definition: gz/physics/ForwardStep.hh:103
Point location
Definition: gz/physics/ForwardStep.hh:101
std::string annotation
Definition: gz/physics/ForwardStep.hh:106
Definition: gz/physics/ForwardStep.hh:70
ignition::math::Vector3d vec
Definition: gz/physics/ForwardStep.hh:71
std::size_t inCoordinatesOf
Definition: gz/physics/ForwardStep.hh:73
Definition: gz/physics/ForwardStep.hh:110
std::string annotation
Definition: gz/physics/ForwardStep.hh:113
std::vector< std::size_t > dofs
Definition: gz/physics/ForwardStep.hh:111
std::vector< double > forces
Definition: gz/physics/ForwardStep.hh:112
Definition: gz/physics/ForwardStep.hh:77
std::vector< double > positions
Definition: gz/physics/ForwardStep.hh:79
std::string annotation
Definition: gz/physics/ForwardStep.hh:80
std::vector< std::size_t > dofs
Definition: gz/physics/ForwardStep.hh:78
Definition: gz/physics/ForwardStep.hh:117
double I
Definition: gz/physics/ForwardStep.hh:119
double P
Definition: gz/physics/ForwardStep.hh:118
double D
Definition: gz/physics/ForwardStep.hh:120
Definition: gz/physics/ForwardStep.hh:62
std::size_t inCoordinatesOf
Definition: gz/physics/ForwardStep.hh:66
std::size_t relativeTo
Definition: gz/physics/ForwardStep.hh:65
ignition::math::Vector3d point
Definition: gz/physics/ForwardStep.hh:63
Definition: gz/physics/ForwardStep.hh:142
std::string annotation
Definition: gz/physics/ForwardStep.hh:146
std::vector< PIDValues > gains
Definition: gz/physics/ForwardStep.hh:144
std::vector< GeneralizedParameters > commands
Definition: gz/physics/ForwardStep.hh:143
Definition: gz/physics/ForwardStep.hh:94
double dt
Definition: gz/physics/ForwardStep.hh:95
Definition: gz/physics/ForwardStep.hh:136
std::string annotation
Definition: gz/physics/ForwardStep.hh:138
std::vector< GeneralizedParameters > commands
Definition: gz/physics/ForwardStep.hh:137
Definition: gz/physics/ForwardStep.hh:40
ignition::math::Pose3d pose
Definition: gz/physics/ForwardStep.hh:41
std::size_t body
Definition: gz/physics/ForwardStep.hh:43
Definition: gz/physics/ForwardStep.hh:47
std::string annotation
Definition: gz/physics/ForwardStep.hh:49
std::vector< WorldPose > entries
Definition: gz/physics/ForwardStep.hh:48