28#ifndef TESSERACT_COMMON_COLLISION_MARGIN_DATA_H
29#define TESSERACT_COMMON_COLLISION_MARGIN_DATA_H
33#include <boost/serialization/access.hpp>
36#include <unordered_map>
70 std::unordered_map<tesseract_common::LinkNamesPair, double, tesseract_common::PairHash>;
76 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
78 using Ptr = std::shared_ptr<CollisionMarginData>;
79 using ConstPtr = std::shared_ptr<const CollisionMarginData>;
188 pair.second *=
scale;
198 switch (override_type)
202 *
this = collision_margin_data;
266 template <
class Archive>
267 void serialize(Archive& ar,
const unsigned int version);
270#include <boost/serialization/export.hpp>
271#include <boost/serialization/tracking.hpp>
Stores information about how the margins allowed between collision objects.
Definition: collision_margin_data.h:74
void setPairCollisionMargin(const std::string &obj1, const std::string &obj2, double collision_margin)
Set the margin for a given contact pair.
Definition: collision_margin_data.h:124
void updateMaxCollisionMargin()
Update the max collision margin.
Definition: collision_margin_data.h:256
void apply(const CollisionMarginData &collision_margin_data, CollisionMarginOverrideType override_type)
Apply the contents of the provide CollisionMarginData based on the override type.
Definition: collision_margin_data.h:196
void serialize(Archive &ar, const unsigned int version)
Definition: collision_margin_data.cpp:70
double getDefaultCollisionMargin() const
Get the default collision margin.
Definition: collision_margin_data.h:112
double max_collision_margin_
Stores the largest collision margin.
Definition: collision_margin_data.h:250
bool operator!=(const CollisionMarginData &rhs) const
Definition: collision_margin_data.cpp:67
double getMaxCollisionMargin() const
Get the largest collision margin.
Definition: collision_margin_data.h:165
bool operator==(const CollisionMarginData &rhs) const
Definition: collision_margin_data.cpp:43
CollisionMarginData(double default_collision_margin=0)
Definition: collision_margin_data.h:81
std::shared_ptr< CollisionMarginData > Ptr
Definition: collision_margin_data.h:78
const PairsCollisionMarginData & getPairCollisionMargins() const
Get Collision Margin Data for stored pairs.
Definition: collision_margin_data.h:156
void scaleMargins(const double &scale)
Scale all margins by input value.
Definition: collision_margin_data.h:183
CollisionMarginData(double default_collision_margin, PairsCollisionMarginData pair_collision_margins)
Definition: collision_margin_data.h:86
PairsCollisionMarginData lookup_table_
A map of link pair names to contact distance.
Definition: collision_margin_data.h:253
void incrementMargins(const double &increment)
Increment all margins by input amount. Useful for inflating or reducing margins.
Definition: collision_margin_data.h:171
double getPairCollisionMargin(const std::string &obj1, const std::string &obj2) const
Get the pairs collision margin data.
Definition: collision_margin_data.h:140
friend class boost::serialization::access
Definition: collision_margin_data.h:265
void setDefaultCollisionMargin(double default_collision_margin)
Set the default collision margin.
Definition: collision_margin_data.h:102
CollisionMarginData(PairsCollisionMarginData pair_collision_margins)
Definition: collision_margin_data.h:92
std::shared_ptr< const CollisionMarginData > ConstPtr
Definition: collision_margin_data.h:79
double default_collision_margin_
Stores the collision margin used if no pair-specific one is set.
Definition: collision_margin_data.h:247
auto it
Definition: collision_core_unit.cpp:208
double scale
Definition: collision_margin_data_unit.cpp:133
double increment
Definition: collision_margin_data_unit.cpp:107
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: allowed_collision_matrix.h:16
LinkNamesPair makeOrderedLinkPair(const std::string &link_name1, const std::string &link_name2)
Create a pair of strings, where the pair.first is always <= pair.second.
Definition: types.cpp:56
std::pair< std::string, std::string > LinkNamesPair
Definition: types.h:71
std::unordered_map< tesseract_common::LinkNamesPair, double, tesseract_common::PairHash > PairsCollisionMarginData
Definition: collision_margin_data.h:70
CollisionMarginOverrideType
Identifies how the provided contact margin data should be applied.
Definition: collision_margin_data.h:46
@ REPLACE
Replace the contact manager's CollisionMarginData.
@ OVERRIDE_DEFAULT_MARGIN
Override the contact managers default margin only.
@ MODIFY_PAIR_MARGIN
Modify the contact managers pair margin only.
@ NONE
Do not apply contact margin data.
@ MODIFY
Modify the contact managers default margin and pair margins.
@ OVERRIDE_PAIR_MARGIN
Override the contact managers pair margin only. This does not preserve any existing pair margin data.
Common Tesseract Utility Functions.