force_control_collection
Contact.hpp
Go to the documentation of this file.
1 namespace ForceColl
2 {
3 template<template<class...> class MapType, class KeyType, class... RestTypes>
4 MapType<KeyType, sva::ForceVecd> calcWrenchList(
5  const MapType<KeyType, std::shared_ptr<Contact>, RestTypes...> & contactList,
6  const Eigen::VectorXd & wrenchRatio,
7  const Eigen::Vector3d & momentOrigin)
8 {
9  MapType<KeyType, sva::ForceVecd> wrenchList;
10  int wrenchRatioIdx = 0;
11  for(const auto & contactKV : contactList)
12  {
13  wrenchList.emplace(
14  contactKV.first,
15  contactKV.second->calcWrench(wrenchRatio.segment(wrenchRatioIdx, contactKV.second->ridgeNum()), momentOrigin));
16  wrenchRatioIdx += contactKV.second->ridgeNum();
17  }
18  return wrenchList;
19 }
20 
21 template<template<class...> class MapType, class KeyType, class... RestTypes>
22 std::vector<std::shared_ptr<Contact>> getContactVecFromMap(
23  const MapType<KeyType, std::shared_ptr<Contact>, RestTypes...> & contactList)
24 {
25  std::vector<std::shared_ptr<Contact>> contactVec;
26  for(const auto & contactKV : contactList)
27  {
28  contactVec.push_back(contactKV.second);
29  }
30  return contactVec;
31 }
32 } // namespace ForceColl
ForceColl::getContactVecFromMap
std::vector< std::shared_ptr< Contact > > getContactVecFromMap(const MapType< KeyType, std::shared_ptr< Contact >, RestTypes... > &contactList)
Convert vector of contact constraint to map.
Definition: Contact.hpp:22
ForceColl::calcWrenchList
std::vector< sva::ForceVecd > calcWrenchList(const std::vector< std::shared_ptr< Contact >> &contactList, const Eigen::VectorXd &wrenchRatio, const Eigen::Vector3d &momentOrigin=Eigen::Vector3d::Zero())
Calculate contact wrench list.
ForceColl
Definition: Constants.h:3