RavEngine
Loading...
Searching...
No Matches
NpArticulationSensor.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#include "PxArticulationReducedCoordinate.h"
30#include "foundation/PxUserAllocated.h"
31#include "foundation/PxMemory.h"
32#include "ScArticulationSensor.h"
33#include "NpBase.h"
34
35#ifndef NP_ARTICULATION_SENSOR_H
36#define NP_ARTICULATION_SENSOR_H
37
38namespace physx
39{
40
41typedef PxU32 ArticulationSensorHandle;
42
44{
45public:
46
47// PX_SERIALIZATION
49 : PxArticulationSensor(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {}
50 void preExportDataReset() {}
51 virtual void exportExtraData(PxSerializationContext& ) {}
52 void importExtraData(PxDeserializationContext& ) {}
53 void resolveReferences(PxDeserializationContext& );
54 virtual void requiresObjects(PxProcessPxBaseCallback&) {}
55 virtual bool isSubordinate() const { return true; }
56 static NpArticulationSensor* createObject(PxU8*& address, PxDeserializationContext& context);
57 static void getBinaryMetaData(PxOutputStream& stream);
58//~PX_SERIALIZATION
59
60 NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose);
61 virtual ~NpArticulationSensor() {}
62
63 virtual void release();
64 virtual PxSpatialForce getForces() const;
65 virtual PxTransform getRelativePose() const;
66 virtual void setRelativePose(const PxTransform&);
67 virtual PxArticulationLink* getLink() const;
68 virtual PxU32 getIndex() const;
70 virtual PxArticulationSensorFlags getFlags() const;
71 virtual void setFlag(PxArticulationSensorFlag::Enum flag, bool enabled);
72
73 PX_FORCE_INLINE Sc::ArticulationSensorCore& getSensorCore() { return mCore; }
74 PX_FORCE_INLINE const Sc::ArticulationSensorCore& getSensorCore() const { return mCore; }
75 PX_FORCE_INLINE ArticulationSensorHandle getHandle() { return mHandle; }
76 PX_FORCE_INLINE void setHandle(ArticulationSensorHandle handle) { mHandle = handle; }
77
78private:
79 PxArticulationLink* mLink;
81 ArticulationSensorHandle mHandle;
82};
83}
84
85#endif //NP_ARTICULATION_SENSOR_H
Definition base.h:1940
Definition NpArticulationSensor.h:44
virtual PxArticulationLink * getLink() const
Returns the link that this sensor is attached to.
Definition NpArticulationSensor.cpp:119
virtual PxSpatialForce getForces() const
Returns the spatial force in the local frame of the sensor.
Definition NpArticulationSensor.cpp:90
virtual PxArticulationSensorFlags getFlags() const
Returns the sensor's flags.
Definition NpArticulationSensor.cpp:137
virtual void setRelativePose(const PxTransform &)
Sets the relative pose between this sensor and the body frame of the link that the sensor is attached...
Definition NpArticulationSensor.cpp:109
virtual PxTransform getRelativePose() const
Returns the relative pose between this sensor and the body frame of the link that the sensor is attac...
Definition NpArticulationSensor.cpp:104
virtual void setFlag(PxArticulationSensorFlag::Enum flag, bool enabled)
Sets a flag of the sensor.
Definition NpArticulationSensor.cpp:142
virtual PxArticulationReducedCoordinate * getArticulation() const
Returns the articulation that this sensor is part of.
Definition NpArticulationSensor.cpp:132
virtual PxU32 getIndex() const
Returns the index of this sensor inside the articulation.
Definition NpArticulationSensor.cpp:124
virtual void release()
Releases the sensor.
Definition NpArticulationSensor.cpp:67
Definition NpBase.h:167
A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver....
Definition PxArticulationReducedCoordinate.h:448
A force sensor that can be attached to articulation links to measure spatial force.
Definition PxArticulationReducedCoordinate.h:313
Binary deserialization context class.
Definition PxSerialFramework.h:174
Output stream class for I/O.
Definition PxIO.h:114
Callback class used to process PxBase objects.
Definition PxSerialFramework.h:81
Binary serialization context class.
Definition PxSerialFramework.h:99
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
Definition ScArticulationSensor.h:44
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Enum
Definition PxArticulationReducedCoordinate.h:298
Data structure to represent spatial forces.
Definition PxArticulationReducedCoordinate.h:53