Tesseract
Motion Planning Environment
|
This structure hold contact results for link pairs. More...
#include <types.h>
Public Types | |
using | KeyType = std::pair< std::string, std::string > |
using | MappedType = ContactResultVector |
using | ContainerType = tesseract_common::AlignedMap< KeyType, MappedType > |
using | ConstReferenceType = typename tesseract_common::AlignedMap< KeyType, MappedType >::const_reference |
using | ConstIteratorType = typename tesseract_common::AlignedMap< KeyType, MappedType >::const_iterator |
using | PairType = typename std::pair< const KeyType, MappedType > |
using | FilterFn = std::function< void(PairType &)> |
Public Member Functions | |
ContactResult & | addContactResult (const KeyType &key, ContactResult result) |
Add contact results for the provided key. More... | |
ContactResult & | addContactResult (const KeyType &key, const MappedType &results) |
Add contact results for the provided key. More... | |
ContactResult & | setContactResult (const KeyType &key, ContactResult result) |
Set contact results for the provided key. More... | |
ContactResult & | setContactResult (const KeyType &key, const MappedType &results) |
Set contact results for the provided key. More... | |
void | addInterpolatedCollisionResults (ContactResultMap &sub_segment_results, int sub_segment_index, int sub_segment_last_index, const std::vector< std::string > &active_link_names, double segment_dt, bool discrete, const ContactResultMap::FilterFn &filter=nullptr) |
This processes interpolated contact results by updating the cc_time and cc_type and then adds the result. More... | |
void | flattenMoveResults (ContactResultVector &v) |
void | flattenCopyResults (ContactResultVector &v) const |
void | flattenWrapperResults (std::vector< std::reference_wrapper< ContactResult > > &v) |
void | flattenWrapperResults (std::vector< std::reference_wrapper< const ContactResult > > &v) const |
void | filter (const FilterFn &filter) |
Filter out results using the provided function. More... | |
long | count () const |
Get the total number of contact results storted. More... | |
std::size_t | size () const |
Get the size of the map. More... | |
bool | empty () const |
Check if results are present. More... | |
void | clear () |
This is a consurvative clear. More... | |
void | release () |
Fully clear all internal data. More... | |
const ContainerType & | getContainer () const |
Get the underlying container. More... | |
ConstIteratorType | begin () const |
returns an iterator to the beginning More... | |
ConstIteratorType | end () const |
returns an iterator to the end More... | |
ConstIteratorType | cbegin () const |
returns an iterator to the beginning More... | |
ConstIteratorType | cend () const |
returns an iterator to the end More... | |
const ContactResultVector & | at (const KeyType &key) const |
access specified element with bounds checking More... | |
ConstIteratorType | find (const KeyType &key) const |
Private Attributes | |
ContainerType | data_ |
long | count_ { 0 } |
This structure hold contact results for link pairs.
A custom class was implemented to avoid a large number of heap allocations during motion which avoids full clearing the map. This class provides methods const container methods for access the internal unordered_map and has two distinct different when it comes to the clear, size and release methods.
The clear method does not call clear on the unordered_map but instead it loops over all entries and calls clear on the vector being stored. This allows the memory to remain with the map and not get release for each of the vectors stored in the map.
The size method loops over the map and counts those that have vectors which are not empty.
The release method actually calls clear on the internal unordered_map relasing all memory.
ContactResultVector
where in the set and add methods it would check it the pair exists and if not it would pull from the object pool. using tesseract_collision::ContactResultMap::ConstIteratorType = typename tesseract_common::AlignedMap<KeyType, MappedType>::const_iterator |
using tesseract_collision::ContactResultMap::ConstReferenceType = typename tesseract_common::AlignedMap<KeyType, MappedType>::const_reference |
using tesseract_collision::ContactResultMap::ContainerType = tesseract_common::AlignedMap<KeyType, MappedType> |
using tesseract_collision::ContactResultMap::FilterFn = std::function<void(PairType&)> |
using tesseract_collision::ContactResultMap::KeyType = std::pair<std::string, std::string> |
using tesseract_collision::ContactResultMap::PairType = typename std::pair<const KeyType, MappedType> |
ContactResult & tesseract_collision::ContactResultMap::addContactResult | ( | const KeyType & | key, |
const MappedType & | results | ||
) |
Add contact results for the provided key.
key | The key to append the results to |
result | The results to add |
ContactResult & tesseract_collision::ContactResultMap::addContactResult | ( | const KeyType & | key, |
ContactResult | result | ||
) |
Add contact results for the provided key.
key | The key to append the results to |
result | The results to add |
void tesseract_collision::ContactResultMap::addInterpolatedCollisionResults | ( | ContactResultMap & | sub_segment_results, |
int | sub_segment_index, | ||
int | sub_segment_last_index, | ||
const std::vector< std::string > & | active_link_names, | ||
double | segment_dt, | ||
bool | discrete, | ||
const ContactResultMap::FilterFn & | filter = nullptr |
||
) |
This processes interpolated contact results by updating the cc_time and cc_type and then adds the result.
This is copied from the trajopt utility processInterpolatedCollisionResults
sub_segment_results | The interpolated results to process |
sub_segment_index | The current sub segment index |
sub_segment_last_index | The last sub segment index |
active_link_names | The active link names |
segment_dt | The segment dt |
discrete | If discrete contact checker was used |
filter | An option filter to exclude results |
const ContactResultVector & tesseract_collision::ContactResultMap::at | ( | const KeyType & | key | ) | const |
access specified element with bounds checking
ContactResultMap::ConstIteratorType tesseract_collision::ContactResultMap::begin | ( | ) | const |
returns an iterator to the beginning
ContactResultMap::ConstIteratorType tesseract_collision::ContactResultMap::cbegin | ( | ) | const |
returns an iterator to the beginning
ContactResultMap::ConstIteratorType tesseract_collision::ContactResultMap::cend | ( | ) | const |
returns an iterator to the end
void tesseract_collision::ContactResultMap::clear | ( | ) |
This is a consurvative clear.
This does not call clear on the internal map but instead loops over each link pair entry and calls clear on the underlying vector. This way the vector capacity remains the same to avoid uneccessary heap allocation for subsequent contact requests.
long tesseract_collision::ContactResultMap::count | ( | ) | const |
Get the total number of contact results storted.
bool tesseract_collision::ContactResultMap::empty | ( | ) | const |
Check if results are present.
ContactResultMap::ConstIteratorType tesseract_collision::ContactResultMap::end | ( | ) | const |
returns an iterator to the end
void tesseract_collision::ContactResultMap::filter | ( | const FilterFn & | filter | ) |
Filter out results using the provided function.
fn | The filter function |
ContactResultMap::ConstIteratorType tesseract_collision::ContactResultMap::find | ( | const KeyType & | key | ) | const |
void tesseract_collision::ContactResultMap::flattenCopyResults | ( | ContactResultVector & | v | ) | const |
void tesseract_collision::ContactResultMap::flattenMoveResults | ( | ContactResultVector & | v | ) |
void tesseract_collision::ContactResultMap::flattenWrapperResults | ( | std::vector< std::reference_wrapper< const ContactResult > > & | v | ) | const |
void tesseract_collision::ContactResultMap::flattenWrapperResults | ( | std::vector< std::reference_wrapper< ContactResult > > & | v | ) |
const ContactResultMap::ContainerType & tesseract_collision::ContactResultMap::getContainer | ( | ) | const |
Get the underlying container.
void tesseract_collision::ContactResultMap::release | ( | ) |
Fully clear all internal data.
ContactResult & tesseract_collision::ContactResultMap::setContactResult | ( | const KeyType & | key, |
const MappedType & | results | ||
) |
Set contact results for the provided key.
key | The key to assign the provided results to |
result | The results to assign |
ContactResult & tesseract_collision::ContactResultMap::setContactResult | ( | const KeyType & | key, |
ContactResult | result | ||
) |
Set contact results for the provided key.
key | The key to assign the provided results to |
result | The results to assign |
std::size_t tesseract_collision::ContactResultMap::size | ( | ) | const |
Get the size of the map.
This loops over the internal map and counts entries with contacts
|
private |
|
private |