AGX Dynamics  2.35.0.1
KinematicPathListener.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXSDK_KINEMATICPATHLISTENER_H
18 #define AGXSDK_KINEMATICPATHLISTENER_H
19 
20 #include <agxSDK/agxSDK.h>
22 #include <agx/RigidBody.h>
23 #include <string>
24 
25 
26 
27 namespace agxSDK
28 {
34  {
35  public:
36 
40  CYCLE
41  };
42 
45  {
46  PathConfiguration( agx::Real setTime, const agx::Vec3& setPosition, const agx::Quat& setRotation)
47  : position(setPosition), time(setTime), rotation(setRotation) {}
52  };
53 
55 
65  KinematicPathListener( const std::string& fileName,
66  agx::RigidBody* rigidBody, PathEndBehavior pathEndBehavior = STAND_STILL );
67 
68 
77  agx::RigidBody* rigidBody, PathEndBehavior pathEndBehavior = STAND_STILL );
78 
81 
84 
86  virtual void preCollide(const agx::TimeStamp& /*time*/);
87 
90 
93 
94  private:
95  void validateBody();
96  void validatePath();
97  void validatePathEndBehavior();
98 
99  protected:
101 
102  protected:
104  bool m_valid;
110  };
111 
112 
114 
115 
116 
117 
118 }
119 
120 #endif /* AGXSDK_KINEMATICPATHLISTENER_H */
#define AGXPHYSICS_EXPORT
Class that will update a rigid body's transformation and velocities based on a given path of transfor...
virtual void preCollide(const agx::TimeStamp &)
Inherited from StepEventListener. Manages the velocity updates here.
KinematicPathListener(const std::string &fileName, agx::RigidBody *rigidBody, PathEndBehavior pathEndBehavior=STAND_STILL)
Constructs a KinematicPathListener from a file defining the path.
agx::observer_ptr< agx::RigidBody > m_body
KinematicPathListener(const agx::Vector< PathConfiguration > &configurations, agx::RigidBody *rigidBody, PathEndBehavior pathEndBehavior=STAND_STILL)
Constructs a KinematicPathListener from a file defining the path.
PathConfigurationVector m_configurations
void setTimeOffset(agx::Real)
Sets a time offset to the path.
const PathConfigurationVector & getPathConfigurations() const
Returns the path configurations.
agx::Vector< PathConfiguration > PathConfigurationVector
agx::UInt32 getCurrentIndex() const
Returns the index of the current path configuration (0 at beginning).
agx::Real getTimeOffset() const
Sets a time offset to the path.
Derive from this class to implement a listener for simulation step events.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
agx::ref_ptr< KinematicPathListener > KinematicPathListenerRef
uint32_t UInt32
Definition: Integer.h:40
double Real
Definition: Real.h:42
agx::Real TimeStamp
Definition: TimeStamp.h:26
Help struct for storing transformation data per time step.
PathConfiguration(agx::Real setTime, const agx::Vec3 &setPosition, const agx::Quat &setRotation)