RobWorkProject
24.12.4-
|
A common interface for the most important data for a contact. More...
#include <Contact.hpp>
Inherits Serializable.
Public Member Functions | |
Contact () | |
Create new non-initialized contact. | |
virtual | ~Contact () |
Destruct contact. | |
rw::core::Ptr< ContactModel > | getModelA () const |
Get the contact model for the first object. More... | |
rw::core::Ptr< ContactModel > | getModelB () const |
Get the contact model for the second object. More... | |
const rw::kinematics::Frame * | getFrameA () const |
Get the frame for the first object. More... | |
const rw::kinematics::Frame * | getFrameB () const |
Get the frame for the second object. More... | |
const std::string & | getNameA () const |
Get the name of the first object. More... | |
const std::string & | getNameB () const |
Get the name of the second object. More... | |
rw::math::Transform3D | aTb () const |
The relative transform between the two contact models. More... | |
rw::math::Vector3D | getPointA () const |
The contact point on the first object. More... | |
rw::math::Vector3D | getPointB () const |
The contact point on the second object. More... | |
rw::math::Vector3D | getNormal () const |
The contact normal from the first object towards the second object. More... | |
double | getDepth () const |
The penetration depth between the two objects. More... | |
void | setModelA (rw::core::Ptr< ContactModel > modelA) |
Set the contact model for the first object. More... | |
void | setModelB (rw::core::Ptr< ContactModel > modelB) |
Set the contact model for the second object. More... | |
void | setFrameA (rw::core::Ptr< const rw::kinematics::Frame > frame) |
Set the frame for the first object. More... | |
void | setFrameB (rw::core::Ptr< const rw::kinematics::Frame > frame) |
Set the frame for the second object. More... | |
void | setNameA (const std::string &name) |
Set the name of the first object. More... | |
void | setNameB (const std::string &name) |
Set the name of the second object. More... | |
bool | setFrames (const rw::models::WorkCell &wc) |
Try to set the frame pointers by looking up names in workcell. More... | |
void | setTransform (rw::math::Transform3D<> aTb) |
Set the relative transform from the first object to the second object. More... | |
void | setPointA (rw::math::Vector3D<> pointA) |
Set the contact point on the first object. More... | |
void | setPointB (rw::math::Vector3D<> pointB) |
Set the contact point on the second object. More... | |
void | setPoints (rw::math::Vector3D<> pointA, rw::math::Vector3D<> pointB) |
Set the contact points on both objects at the same time. More... | |
void | setNormal (rw::math::Vector3D<> normal) |
Set the normal from the first object to the second. More... | |
void | setDepth () |
Calculate penetration depth automatically. More... | |
void | setDepth (double depth) |
Set the penetation depth. More... | |
bool | operator== (const Contact &b) const |
Check if the contact is exactly the same as other contact. More... | |
bool | operator!= (const Contact &b) const |
Check if the contact is different from other contact. More... | |
virtual void | read (class rw::common::InputArchive &iarchive, const std::string &id) |
virtual void | write (class rw::common::OutputArchive &oarchive, const std::string &id) const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
destructor | |
A common interface for the most important data for a contact.
A contact is given by the two points in contact, a normal, and a depth. Furthermore the contact is generated by a contact strategy, which will use two internal contact models for the geometries in contact. The relative transformation between these contact models is also used to define the contact.
rw::math::Transform3D aTb | ( | ) | const |
The relative transform between the two contact models.
double getDepth | ( | ) | const |
The penetration depth between the two objects.
const rw::kinematics::Frame* getFrameA | ( | ) | const |
Get the frame for the first object.
const rw::kinematics::Frame* getFrameB | ( | ) | const |
Get the frame for the second object.
rw::core::Ptr<ContactModel> getModelA | ( | ) | const |
Get the contact model for the first object.
rw::core::Ptr<ContactModel> getModelB | ( | ) | const |
Get the contact model for the second object.
const std::string& getNameA | ( | ) | const |
Get the name of the first object.
const std::string& getNameB | ( | ) | const |
Get the name of the second object.
rw::math::Vector3D getNormal | ( | ) | const |
The contact normal from the first object towards the second object.
rw::math::Vector3D getPointA | ( | ) | const |
The contact point on the first object.
rw::math::Vector3D getPointB | ( | ) | const |
The contact point on the second object.
bool operator!= | ( | const Contact & | b | ) | const |
Check if the contact is different from other contact.
b | [in] the contact to compare with. |
bool operator== | ( | const Contact & | b | ) | const |
Check if the contact is exactly the same as other contact.
b | [in] the contact to compare with. |
|
virtual |
Enable read-serialization of inherited class by implementing this method. Data is read from iarchive and filled into this object.
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
Implements Serializable.
void setDepth | ( | ) |
Calculate penetration depth automatically.
Will calculate the penetration depth from the contact points and the normal.
|
inline |
Set the penetation depth.
depth | [in] penetration depth. Positive if penetrating, negative if separated. |
void setFrameA | ( | rw::core::Ptr< const rw::kinematics::Frame > | frame | ) |
Set the frame for the first object.
frame | [in] a pointer to the frame. |
void setFrameB | ( | rw::core::Ptr< const rw::kinematics::Frame > | frame | ) |
Set the frame for the second object.
frame | [in] a pointer to the frame. |
bool setFrames | ( | const rw::models::WorkCell & | wc | ) |
Try to set the frame pointers by looking up names in workcell.
Note that frame pointers will only be set if both frames can be found. The function returns false if no change has been done.
wc | [in] the workcell. |
|
inline |
Set the contact model for the first object.
modelA | [in] contact model specific for the contact strategy that generates the contact. |
|
inline |
Set the contact model for the second object.
modelB | [in] contact model specific for the contact strategy that generates the contact. |
void setNameA | ( | const std::string & | name | ) |
Set the name of the first object.
name | [in] the name. |
void setNameB | ( | const std::string & | name | ) |
Set the name of the second object.
name | [in] the name. |
|
inline |
Set the normal from the first object to the second.
normal | [in] contact normal. |
|
inline |
Set the contact point on the first object.
pointA | [in] contact point. |
|
inline |
Set the contact point on the second object.
pointB | [in] contact point. |
void setPoints | ( | rw::math::Vector3D<> | pointA, |
rw::math::Vector3D<> | pointB | ||
) |
Set the contact points on both objects at the same time.
pointA | [in] contact point on A. |
pointB | [in] contact point on B. |
|
inline |
Set the relative transform from the first object to the second object.
aTb | [in] the relative transform. |
|
virtual |
Enable write-serialization of inherited class by implementing this method. Data is written to oarchive from this object.
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |
Implements Serializable.