Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Functions | Variables
contact_managers_factory_unit.cpp File Reference

Tesseract collision contact managers factory test. More...

#include <tesseract_common/macros.h>
#include <gtest/gtest.h>
#include <fstream>
#include <tesseract_collision/core/contact_managers_plugin_factory.h>
Include dependency graph for contact_managers_factory_unit.cpp:

Functions

void runContactManagersFactoryTest (const tesseract_common::fs::path &config_path)
 
 runContactManagersFactoryTest (config_path)
 
 runContactManagersFactoryTest (export_config_path)
 
 EXPECT_EQ (sp.size(), 2)
 
 for (auto it=search_paths.begin();it !=search_paths.end();++it)
 
 EXPECT_EQ (sl.size(), 2)
 
 EXPECT_EQ (discrete_plugins.size(), 3)
 
 EXPECT_EQ (continuous_plugins.size(), 2)
 
 EXPECT_FALSE (factory.getSearchPaths().empty())
 
 EXPECT_EQ (factory.getSearchPaths().size(), 1)
 
 EXPECT_EQ (factory.getSearchLibraries().size(), 2)
 
 EXPECT_EQ (factory.getDiscreteContactManagerPlugins().size(), 0)
 
 EXPECT_ANY_THROW (factory.getDefaultDiscreteContactManagerPlugin())
 
 EXPECT_FALSE (factory.hasDiscreteContactManagerPlugins())
 
factory addSearchPath ("/usr/local/lib")
 
factory addSearchLibrary ("tesseract_collision")
 
 EXPECT_EQ (factory.getSearchLibraries().size(), 3)
 
 EXPECT_TRUE (map.find("NotFound")==map.end())
 
factory addDiscreteContactManagerPlugin ("TestDiscreteManager", pi)
 
 EXPECT_TRUE (factory.hasDiscreteContactManagerPlugins())
 
 EXPECT_TRUE (map.find("TestDiscreteManager") !=map.end())
 
 EXPECT_EQ (factory.getDefaultDiscreteContactManagerPlugin(), "TestDiscreteManager")
 
factory addDiscreteContactManagerPlugin ("Test2DiscreteManager", pi2)
 
 EXPECT_TRUE (map.find("Test2DiscreteManager") !=map.end())
 
 EXPECT_EQ (factory.getDefaultDiscreteContactManagerPlugin(), "Test2DiscreteManager")
 
factory setDefaultDiscreteContactManagerPlugin ("TestDiscreteManager")
 
factory removeDiscreteContactManagerPlugin ("TestDiscreteManager")
 
 EXPECT_ANY_THROW (factory.removeDiscreteContactManagerPlugin("DoesNotExist"))
 
factory addContinuousContactManagerPlugin ("TestContinuousManager", pi)
 
 EXPECT_TRUE (map.find("TestContinuousManager") !=map.end())
 
 EXPECT_EQ (factory.getDefaultContinuousContactManagerPlugin(), "TestContinuousManager")
 
factory addContinuousContactManagerPlugin ("Test2ContinuousManager", pi2)
 
 EXPECT_TRUE (map.find("Test2ContinuousManager") !=map.end())
 
 EXPECT_EQ (factory.getDefaultContinuousContactManagerPlugin(), "Test2ContinuousManager")
 
factory setDefaultContinuousContactManagerPlugin ("TestContinuousManager")
 
factory removeContinuousContactManagerPlugin ("TestContinuousManager")
 
int main (int argc, char **argv)
 

Variables

tesseract_common::fs::path config_path = file_path.parent_path() / "contact_manager_plugins.yaml"
 
tesseract_common::fs::path export_config_path
 
ContactManagersPluginFactory factory (config)
 
YAML::Node plugin_config = YAML::Load(config)
 
const YAML::Node & plugin_info = plugin_config["contact_manager_plugins"]
 
const YAML::Node & search_paths = plugin_info["search_paths"]
 
const YAML::Node & search_libraries = plugin_info["search_libraries"]
 
const YAML::Node & discrete_plugins = plugin_info["discrete_plugins"]["plugins"]
 
const YAML::Node & continuous_plugins = plugin_info["continuous_plugins"]["plugins"]
 
tesseract_common::PluginInfo pi
 
pi class_name = "TestDiscreteManagerFactory"
 
 map = factory.getDiscreteContactManagerPlugins()
 
tesseract_common::PluginInfo pi2
 

Detailed Description

Tesseract collision contact managers factory test.

Author
Levi Armstrong
Date
October 25, 2021
Version
TODO
Bug:
No known bugs
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author
Levi Armstrong
Date
October 25, 2021
Version
TODO
Bug:
No known bugs
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ addContinuousContactManagerPlugin() [1/2]

factory addContinuousContactManagerPlugin ( "Test2ContinuousManager"  ,
pi2   
)

◆ addContinuousContactManagerPlugin() [2/2]

factory addContinuousContactManagerPlugin ( "TestContinuousManager"  ,
pi   
)

◆ addDiscreteContactManagerPlugin() [1/2]

factory addDiscreteContactManagerPlugin ( "Test2DiscreteManager"  ,
pi2   
)

◆ addDiscreteContactManagerPlugin() [2/2]

factory addDiscreteContactManagerPlugin ( "TestDiscreteManager"  ,
pi   
)

◆ addSearchLibrary()

factory addSearchLibrary ( "tesseract_collision"  )

◆ addSearchPath()

factory addSearchPath ( "/usr/local/lib"  )

◆ EXPECT_ANY_THROW() [1/2]

EXPECT_ANY_THROW ( factory.  getDefaultDiscreteContactManagerPlugin())

◆ EXPECT_ANY_THROW() [2/2]

EXPECT_ANY_THROW ( factory.  removeDiscreteContactManagerPlugin"DoesNotExist")

◆ EXPECT_EQ() [1/12]

EXPECT_EQ ( continuous_plugins.  size(),
 
)

◆ EXPECT_EQ() [2/12]

EXPECT_EQ ( discrete_plugins.  size(),
 
)

◆ EXPECT_EQ() [3/12]

EXPECT_EQ ( factory.  getDefaultContinuousContactManagerPlugin(),
"Test2ContinuousManager"   
)

◆ EXPECT_EQ() [4/12]

EXPECT_EQ ( factory.  getDefaultContinuousContactManagerPlugin(),
"TestContinuousManager"   
)

◆ EXPECT_EQ() [5/12]

EXPECT_EQ ( factory.  getDefaultDiscreteContactManagerPlugin(),
"Test2DiscreteManager"   
)

◆ EXPECT_EQ() [6/12]

EXPECT_EQ ( factory.  getDefaultDiscreteContactManagerPlugin(),
"TestDiscreteManager"   
)

◆ EXPECT_EQ() [7/12]

EXPECT_EQ ( factory.  getDiscreteContactManagerPlugins).size(,
 
)

◆ EXPECT_EQ() [8/12]

EXPECT_EQ ( factory.  getSearchLibraries).size(,
 
)

◆ EXPECT_EQ() [9/12]

EXPECT_EQ ( factory.  getSearchLibraries).size(,
 
)

◆ EXPECT_EQ() [10/12]

EXPECT_EQ ( factory.  getSearchPaths).size(,
 
)

◆ EXPECT_EQ() [11/12]

EXPECT_EQ ( sl.  size(),
 
)
Initial value:
{
std::set<std::string> sl = factory.getSearchLibraries()
std::set< std::string > getSearchLibraries() const
Get the plugin search libraries.
Definition: contact_managers_plugin_factory.cpp:96
ContactManagersPluginFactory factory(config)

◆ EXPECT_EQ() [12/12]

EXPECT_EQ ( sp.  size(),
 
)
Initial value:
{
std::set<std::string> sp = factory.getSearchPaths()
std::set< std::string > getSearchPaths() const
Get the plugin search paths.
Definition: contact_managers_plugin_factory.cpp:87

◆ EXPECT_FALSE() [1/2]

EXPECT_FALSE ( factory.  getSearchPaths).empty()

◆ EXPECT_FALSE() [2/2]

EXPECT_FALSE ( factory.  hasDiscreteContactManagerPlugins())

◆ EXPECT_TRUE() [1/6]

EXPECT_TRUE ( factory.  hasDiscreteContactManagerPlugins())

◆ EXPECT_TRUE() [2/6]

EXPECT_TRUE ( map.  find"NotFound" = =map.end())
Initial value:
{
tesseract_common::PluginInfoMap getContinuousContactManagerPlugins() const
Get the map of continuous contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:165
map
Definition: contact_managers_factory_unit.cpp:233
std::map< std::string, PluginInfo > PluginInfoMap
A map of PluginInfo to user defined name.
Definition: types.h:130

◆ EXPECT_TRUE() [3/6]

EXPECT_TRUE ( map.find("Test2ContinuousManager") !  = map.end())

◆ EXPECT_TRUE() [4/6]

EXPECT_TRUE ( map.find("Test2DiscreteManager") !  = map.end())

◆ EXPECT_TRUE() [5/6]

EXPECT_TRUE ( map.find("TestContinuousManager") !  = map.end())

◆ EXPECT_TRUE() [6/6]

EXPECT_TRUE ( map.find("TestDiscreteManager") !  = map.end())

◆ for()

for ( auto  it = search_paths.begin(); it != search_paths.end(); ++it)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ removeContinuousContactManagerPlugin()

factory removeContinuousContactManagerPlugin ( "TestContinuousManager"  )

◆ removeDiscreteContactManagerPlugin()

factory removeDiscreteContactManagerPlugin ( "TestDiscreteManager"  )

◆ runContactManagersFactoryTest() [1/3]

runContactManagersFactoryTest ( config_path  )

◆ runContactManagersFactoryTest() [2/3]

void runContactManagersFactoryTest ( const tesseract_common::fs::path &  config_path)

◆ runContactManagersFactoryTest() [3/3]

runContactManagersFactoryTest ( export_config_path  )

◆ setDefaultContinuousContactManagerPlugin()

factory setDefaultContinuousContactManagerPlugin ( "TestContinuousManager"  )

◆ setDefaultDiscreteContactManagerPlugin()

factory setDefaultDiscreteContactManagerPlugin ( "TestDiscreteManager"  )

Variable Documentation

◆ class_name

pi2 class_name = "TestDiscreteManagerFactory"

◆ config_path

tesseract_common::fs::path config_path = file_path.parent_path() / "contact_manager_plugins.yaml"

◆ continuous_plugins

const YAML::Node & continuous_plugins = plugin_info["continuous_plugins"]["plugins"]

◆ discrete_plugins

const YAML::Node & discrete_plugins = plugin_info["discrete_plugins"]["plugins"]

◆ export_config_path

tesseract_common::fs::path export_config_path
Initial value:
= tesseract_common::fs::path(tesseract_common::getTempPath()) / "contac"
"t_"
"manage"
"r_"
"plugin"
"s_"
"export"
".yaml"
std::string getTempPath()
Get the host temp directory path.
Definition: utils.cpp:209

◆ factory

Initial value:
{
std::string config = R"(contact_manager_plugins:
search_paths:
- /usr/local/lib
search_libraries:
- tesseract_collision_bullet_factories
- tesseract_collision_fcl_factories
discrete_plugins:
default: BulletDiscreteBVHManager
plugins:
BulletDiscreteBVHManager:
class: BulletDiscreteBVHManagerFactory
BulletDiscreteSimpleManager:
class: BulletDiscreteSimpleManagerFactory
FCLDiscreteBVHManager:
class: FCLDiscreteBVHManagerFactory
continuous_plugins:
default: BulletCastBVHManager
plugins:
BulletCastBVHManager:
class: BulletCastBVHManagerFactory
BulletCastSimpleManager:
class: BulletCastSimpleManagerFactory)"
tesseract_collision::CollisionCheckConfig config(5, request, tesseract_collision::CollisionEvaluatorType::LVS_DISCRETE, 0.5)
Definition: tesseract_common_serialization_unit.cpp:154

◆ map

map = factory.getDiscreteContactManagerPlugins()

◆ pi

◆ pi2

◆ plugin_config

YAML::Node plugin_config = YAML::Load(config)

◆ plugin_info

const YAML::Node & plugin_info = plugin_config["contact_manager_plugins"]

◆ search_libraries

const YAML::Node & search_libraries = plugin_info["search_libraries"]

◆ search_paths

const YAML::Node & search_paths = plugin_info["search_paths"]