Package org.robwork.sdurw_proximity
Class CollisionDetectorPtr
- java.lang.Object
-
- org.robwork.sdurw_proximity.CollisionDetectorPtr
-
public class CollisionDetectorPtr extends java.lang.ObjectPtr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description CollisionDetectorPtr()Default constructor yielding a NULL-pointer.CollisionDetectorPtr(long cPtr, boolean cMemoryOwn)CollisionDetectorPtr(CollisionDetector ptr)Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CollisionDetector__ref__()Dereferencing operator.booleanaddGeometry(FramePtr frame, GeometryPtr geometry)Add Geometry associated to frame
The current shape of the geometry is copied, hence later changes to geometry has no
effect
voidaddRule(ProximitySetupRule rule)Adds rule specifying inclusion/exclusion of frame pairs in Proximity calculationProximityStrategyDatacalculate(State state)Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings.ProximityStrategyDatacalculate(State state, ProximityStrategyDataPtr settings)Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings.ProximityStrategyDatacalculate(State state, ProximityStrategyDataPtr settings, SWIGTYPE_p_rw__core__PtrT_std__vectorT_rw__proximity__ProximityStrategyData_t_t results)Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings.CollisionDetectorCPtrcptr()voiddelete()CollisionDetectorderef()The pointer stored in the object.booleanequals(CollisionDetector p)CollisionStrategyPtrgetCollisionStrategy()Get the narrow-phase collision strategy.doublegetComputationTime()Get the computation time used in the inCollision functions.static longgetCPtr(CollisionDetectorPtr obj)CollisionDetectorgetDeref()Member access operator.GeometryPtrgetGeometry(FramePtr frame, java.lang.String geometryId)Get the geometry from its IDvector_sgetGeometryIDs(FramePtr frame)return the ids of all the geometries of this frames.longgetNoOfCalls()Get the number of times the inCollision functions have been called.ProximityFilterStrategyPtrgetProximityFilterStrategy()The Proximity Filter strategy of the ProximityCalculator.CollisionStrategyPtrgetStrategy()Get the ProximityStrategy.booleanhasGeometry(FramePtr frame, java.lang.String geometryId)Returns whether frame has an associated geometry with geometryId.booleaninCollision(State state)Check the workcell for collisions.
booleaninCollision(State state, FramePairVector result)Check the workcell for collisions.
booleaninCollision(State state, FramePairVector result, boolean stopAtFirstContact)Check the workcell for collisions.
booleaninCollision(State state, CollisionDetector.CollisionDetectorQueryResult result)Check the workcell for collisions.
booleaninCollision(State state, CollisionDetector.CollisionDetectorQueryResult result, boolean stopAtFirstContact)Check the workcell for collisions.
booleaninCollision(State state, ProximityData data)Check the workcell for collisions.booleanisNull()checks if the pointer is nullbooleanisShared()check if this Ptr has shared ownership or none
ownershipCollisionDetectorPtrmake(WorkCellPtr workcell, CollisionStrategyPtr strategy)voidremoveGeometry(FramePtr frame, java.lang.String geometryId)Removes geometry from CollisionDetector
The geometryId is used to match the collision model to the geometry.
voidremoveGeometry(FramePtr frame, GeometryPtr geometry)Removes geometry from CollisionDetector
The id of the geometry is used to match the collision model to the geometry.
voidremoveRule(ProximitySetupRule rule)Removes rule specifying inclusion/exclusion of frame pairs in Proximity calculationvoidresetComputationTimeAndCount()Reset the counter for inCollision invocations and the computation timer.voidsetProximityFilterStrategy(ProximityFilterStrategyPtr proxStrategy)Set the Proximity Filter strategy of the ProximityCalculator.voidsetStrategy(CollisionStrategyPtr strategy)Set a new strategy.
-
-
-
Constructor Detail
-
CollisionDetectorPtr
public CollisionDetectorPtr(long cPtr, boolean cMemoryOwn)
-
CollisionDetectorPtr
public CollisionDetectorPtr()
Default constructor yielding a NULL-pointer.
-
CollisionDetectorPtr
public CollisionDetectorPtr(CollisionDetector ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(CollisionDetectorPtr obj)
-
delete
public void delete()
-
deref
public CollisionDetector deref()
The pointer stored in the object.
-
__ref__
public CollisionDetector __ref__()
Dereferencing operator.
-
getDeref
public CollisionDetector getDeref()
Member access operator.
-
equals
public boolean equals(CollisionDetector p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
cptr
public CollisionDetectorCPtr cptr()
-
inCollision
public boolean inCollision(State state, CollisionDetector.CollisionDetectorQueryResult result, boolean stopAtFirstContact)
Check the workcell for collisions.
- Parameters:
state- [in] The state for which to check for collisions.result- [out] If non-NULL, the pairs of colliding frames are
inserted in result.stopAtFirstContact- [in] If result is non-NULL and
stopAtFirstContact is true, then only the first colliding pair is
inserted in result. By default all colliding pairs are inserted.
- Returns:
- true if a collision is detected; false otherwise.
-
inCollision
public boolean inCollision(State state, CollisionDetector.CollisionDetectorQueryResult result)
Check the workcell for collisions.
- Parameters:
state- [in] The state for which to check for collisions.result- [out] If non-NULL, the pairs of colliding frames are
inserted in result.
- Returns:
- true if a collision is detected; false otherwise.
-
inCollision
public boolean inCollision(State state)
Check the workcell for collisions.
- Parameters:
state- [in] The state for which to check for collisions.
- Returns:
- true if a collision is detected; false otherwise.
-
inCollision
public boolean inCollision(State state, ProximityData data)
Check the workcell for collisions.- Parameters:
state- [in] The state for which to check for collisions.data- [in/out] Defines parameters for the collision check, the results and also
enables caching inbetween calls to incollision- Returns:
- true if a collision is detected; false otherwise.
-
inCollision
public boolean inCollision(State state, FramePairVector result, boolean stopAtFirstContact)
Check the workcell for collisions.
- Parameters:
state- [in] The state for which to check for collisions.result- [out] Where to store pairs of colliding frames.stopAtFirstContact- [in] If result is non-NULL and
stopAtFirstContact is true, then only the first colliding pair is
inserted in result. By default all colliding pairs are inserted.
- Returns:
- true if a collision is detected; false otherwise.
-
inCollision
public boolean inCollision(State state, FramePairVector result)
Check the workcell for collisions.
- Parameters:
state- [in] The state for which to check for collisions.result- [out] Where to store pairs of colliding frames.
- Returns:
- true if a collision is detected; false otherwise.
-
getCollisionStrategy
public CollisionStrategyPtr getCollisionStrategy()
Get the narrow-phase collision strategy.- Returns:
- the strategy if set, otherwise NULL.
-
addGeometry
public boolean addGeometry(FramePtr frame, GeometryPtr geometry)
Add Geometry associated to frame
The current shape of the geometry is copied, hence later changes to geometry has no
effect
- Parameters:
frame- [in] Frame to associate geometry togeometry- [in] Geometry to add
-
removeGeometry
public void removeGeometry(FramePtr frame, GeometryPtr geometry)
Removes geometry from CollisionDetector
The id of the geometry is used to match the collision model to the geometry.
- Parameters:
frame- [in] The frame which has the geometry associatedgeometry- [in] Geometry with the id to be removed
-
removeGeometry
public void removeGeometry(FramePtr frame, java.lang.String geometryId)
Removes geometry from CollisionDetector
The geometryId is used to match the collision model to the geometry.
- Parameters:
frame- [in] The frame which has the geometry associatedgeometryId- [in] Id of geometry to be removed
-
getGeometryIDs
public vector_s getGeometryIDs(FramePtr frame)
return the ids of all the geometries of this frames.
-
hasGeometry
public boolean hasGeometry(FramePtr frame, java.lang.String geometryId)
Returns whether frame has an associated geometry with geometryId.- Parameters:
frame- [in] Frame in questiongeometryId- [in] Id of the geometry
-
getGeometry
public GeometryPtr getGeometry(FramePtr frame, java.lang.String geometryId)
Get the geometry from its ID- Parameters:
frame- [in] the frame of the geometrygeometryId- [in] the ID of the geometry- Returns:
- Pointer to the geometry
-
make
public CollisionDetectorPtr make(WorkCellPtr workcell, CollisionStrategyPtr strategy)
-
calculate
public ProximityStrategyData calculate(State state, ProximityStrategyDataPtr settings, SWIGTYPE_p_rw__core__PtrT_std__vectorT_rw__proximity__ProximityStrategyData_t_t results)
Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings. If more then the default result is needed (first collision or shortest
distance) result can given to get the extra info.- Parameters:
state- [in] The state the proximity calculation should be done in.settings- [in] The settings used for the calculations. Different settings are used
for different ProximityStrategies:
For CollisionStrategy the Collision Query Type is used. if not given only first collision
is detected
For DistanceStrategy no settings are used and it is expected to be null, otherwise an
exception is thrown.
For DistanceMultiStrategy the tolerance is used which is the maximum distance allowed for
the result to be recorded. if not given the tolerance is set to the largest finite double
results- [in/out] Defines parameters for the ProximityCalculation, stores the
results and also enables caching inbetween calls.- Returns:
- If no result is available an empty ProximityStrategyData is returned. else for
Collisions the first contact is returned and for distance the shortest distance is
returned
-
calculate
public ProximityStrategyData calculate(State state, ProximityStrategyDataPtr settings)
Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings. If more then the default result is needed (first collision or shortest
distance) result can given to get the extra info.- Parameters:
state- [in] The state the proximity calculation should be done in.settings- [in] The settings used for the calculations. Different settings are used
for different ProximityStrategies:
For CollisionStrategy the Collision Query Type is used. if not given only first collision
is detected
For DistanceStrategy no settings are used and it is expected to be null, otherwise an
exception is thrown.
For DistanceMultiStrategy the tolerance is used which is the maximum distance allowed for
the result to be recorded. if not given the tolerance is set to the largest finite double
- Returns:
- If no result is available an empty ProximityStrategyData is returned. else for
Collisions the first contact is returned and for distance the shortest distance is
returned
-
calculate
public ProximityStrategyData calculate(State state)
Performece the Proximity calculation based on the chosen strategy type.
As the varius strategies usese differenct settings all settings will be extracted
from settings. If more then the default result is needed (first collision or shortest
distance) result can given to get the extra info.- Parameters:
state- [in] The state the proximity calculation should be done in.
For CollisionStrategy the Collision Query Type is used. if not given only first collision
is detected
For DistanceStrategy no settings are used and it is expected to be null, otherwise an
exception is thrown.
For DistanceMultiStrategy the tolerance is used which is the maximum distance allowed for
the result to be recorded. if not given the tolerance is set to the largest finite double
- Returns:
- If no result is available an empty ProximityStrategyData is returned. else for
Collisions the first contact is returned and for distance the shortest distance is
returned
-
getProximityFilterStrategy
public ProximityFilterStrategyPtr getProximityFilterStrategy()
The Proximity Filter strategy of the ProximityCalculator.
-
setProximityFilterStrategy
public void setProximityFilterStrategy(ProximityFilterStrategyPtr proxStrategy)
Set the Proximity Filter strategy of the ProximityCalculator.- Parameters:
proxStrategy- [in] the new ProximityFilterStrategy.
The strategy is not copied so changes to the strategy will affect the calculator
-
setStrategy
public void setStrategy(CollisionStrategyPtr strategy)
Set a new strategy. OBS. models are stored in the strategy, so make sure that the
new strategy includes all nessesary models- Parameters:
strategy- [in] the new strategy
-
getStrategy
public CollisionStrategyPtr getStrategy()
Get the ProximityStrategy.- Returns:
- the strategy if set, otherwise NULL.
-
addRule
public void addRule(ProximitySetupRule rule)
Adds rule specifying inclusion/exclusion of frame pairs in Proximity calculation
-
removeRule
public void removeRule(ProximitySetupRule rule)
Removes rule specifying inclusion/exclusion of frame pairs in Proximity calculation
-
getComputationTime
public double getComputationTime()
Get the computation time used in the inCollision functions.- Returns:
- the total computation time.
-
getNoOfCalls
public long getNoOfCalls()
Get the number of times the inCollision functions have been called.- Returns:
- number of calls to inCollision functions.
-
resetComputationTimeAndCount
public void resetComputationTimeAndCount()
Reset the counter for inCollision invocations and the computation timer.
-
-