Package org.robwork.sdurw_proximity
Class ProximityCalculatorCollision
- java.lang.Object
- 
- org.robwork.sdurw_proximity.ProximityCalculatorCollision
 
- 
- Direct Known Subclasses:
- CollisionDetector
 
 public class ProximityCalculatorCollision extends java.lang.ObjectThe Proximity calculator implements an efficient and standardized way of using the
 following proximity strategies:
 
 CollisionStrategy
 DistanceStrategy
 MultiDistanceStrategy
 
 The Calculate function is designed to fit the chosen strategy individually implementing a
 fitting aproach for calculating the respective proximity.
 
 The CollisionDetector
 It relies on a BroadPhaseDetector to do initial filtering which removes obviously not
 colliding frame pairs.
 
 After the filtering the remaining frame pairs are tested for collision using an
 CollisionStrategy which is a narrow phase collision detector.
 
 The Proximity calculator does not dictate a specific detection
 strategy or algorithm, instead it relies on the CollisionStrategy interface for
 the actual collision checking between two frames.
 
 Distance and MultiDistance Calculator
 A list of frame pairs is contained within the Proximity calculator,
 that specifies which frames are to be checked against each other.
 The method of used for distance calculation relies on the DistanceStrategy
 chosen.
- 
- 
Constructor SummaryConstructors Constructor Description ProximityCalculatorCollision(long cPtr, boolean cMemoryOwn)ProximityCalculatorCollision(FramePtr root, WorkCellPtr workcell, CollisionStrategyPtr strategy, State initial_state)Proximity calculations for a given tree, collision setup and
 primitive Proximity calculator.ProximityCalculatorCollision(WorkCellPtr workcell, CollisionStrategyPtr strategy)Construct proximity calculator for a WorkCell with an associated
 proximity strategy.
 
 The ProximityCalculator extracts information about the tree and the
 CollisionSetup from workcell.
 
 The ProximityCalculator is initialized with the strategy .
 Notice that the ProximityCalculator will create and store models inside the strategy .
 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.voiddelete()doublegetComputationTime()Get the computation time used in the inCollision functions.static longgetCPtr(ProximityCalculatorCollision obj)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.voidremoveGeometry(FramePtr frame, java.lang.String geometryId)Removes geometry from ProximityCalculator
 
 The geometryId is used to match the proximity model to the geometry.
 voidremoveGeometry(FramePtr frame, GeometryPtr geometry)Removes geometry from ProximityCalculator
 
 The id of the geometry is used to match the proximity 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- 
ProximityCalculatorCollisionpublic ProximityCalculatorCollision(long cPtr, boolean cMemoryOwn)
 - 
ProximityCalculatorCollisionpublic ProximityCalculatorCollision(FramePtr root, WorkCellPtr workcell, CollisionStrategyPtr strategy, State initial_state) Proximity calculations for a given tree, collision setup and
 primitive Proximity calculator. Uses proximity strategy given by the workcell.- Parameters:
- root- [in] - the root of the Frame tree. must be non-NULL. No ownership of the
 pointer is taken
- workcell- [in] - the workcell to do the proximity calculations in.
- strategy- [in] - the primitive strategy of proximity calculations. must be
 non-NULL.
- initial_state- [in] - the work cell state to use for the
 initial traversal of the tree.
 
 - 
ProximityCalculatorCollisionpublic ProximityCalculatorCollision(WorkCellPtr workcell, CollisionStrategyPtr strategy) Construct proximity calculator for a WorkCell with an associated
 proximity strategy.
 
 The ProximityCalculator extracts information about the tree and the
 CollisionSetup from workcell.
 
 The ProximityCalculator is initialized with the strategy .
 Notice that the ProximityCalculator will create and store models inside the strategy .
 - Parameters:
- workcell- [in] the workcell to check
- strategy- [in] the ProximityStrategy to use
 
 
- 
 - 
Method Detail- 
getCPtrpublic static long getCPtr(ProximityCalculatorCollision obj) 
 - 
deletepublic void delete() 
 - 
calculatepublic 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
 
 - 
calculatepublic 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
 
 - 
calculatepublic 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
 
 - 
getProximityFilterStrategypublic ProximityFilterStrategyPtr getProximityFilterStrategy() The Proximity Filter strategy of the ProximityCalculator.
 - 
setProximityFilterStrategypublic 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
 
 - 
setStrategypublic 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
 
 - 
getStrategypublic CollisionStrategyPtr getStrategy() Get the ProximityStrategy.- Returns:
- the strategy if set, otherwise NULL.
 
 - 
addGeometrypublic 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 to
- geometry- [in] Geometry to add
- Returns:
- true if succesful, otherwise false
 
 - 
removeGeometrypublic void removeGeometry(FramePtr frame, GeometryPtr geometry) Removes geometry from ProximityCalculator
 
 The id of the geometry is used to match the proximity model to the geometry.
 - Parameters:
- frame- [in] The frame which has the geometry associated
- geometry- [in] Geometry with the id to be removed
 
 - 
removeGeometrypublic void removeGeometry(FramePtr frame, java.lang.String geometryId) Removes geometry from ProximityCalculator
 
 The geometryId is used to match the proximity model to the geometry.
 - Parameters:
- frame- [in] The frame which has the geometry associated
- geometryId- [in] Id of geometry to be removed
 
 - 
addRulepublic void addRule(ProximitySetupRule rule) Adds rule specifying inclusion/exclusion of frame pairs in Proximity calculation
 - 
removeRulepublic void removeRule(ProximitySetupRule rule) Removes rule specifying inclusion/exclusion of frame pairs in Proximity calculation
 - 
getComputationTimepublic double getComputationTime() Get the computation time used in the inCollision functions.- Returns:
- the total computation time.
 
 - 
getNoOfCallspublic long getNoOfCalls() Get the number of times the inCollision functions have been called.- Returns:
- number of calls to inCollision functions.
 
 - 
resetComputationTimeAndCountpublic void resetComputationTimeAndCount() Reset the counter for inCollision invocations and the computation timer.
 - 
getGeometryIDspublic vector_s getGeometryIDs(FramePtr frame) return the ids of all the geometries of this frames.
 - 
hasGeometrypublic boolean hasGeometry(FramePtr frame, java.lang.String geometryId) Returns whether frame has an associated geometry with geometryId.- Parameters:
- frame- [in] Frame in question
- geometryId- [in] Id of the geometry
 
 - 
getGeometrypublic GeometryPtr getGeometry(FramePtr frame, java.lang.String geometryId) Get the geometry from its ID- Parameters:
- frame- [in] the frame of the geometry
- geometryId- [in] the ID of the geometry
- Returns:
- Pointer to the geometry
 
 
- 
 
-