@@ -39,24 +39,60 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
3939#include < tesseract_collision/core/discrete_contact_manager.h>
4040#include < tesseract_collision/core/continuous_contact_manager.h>
4141
42+ #include < tesseract_common/property_tree.h>
43+
4244namespace tesseract_collision ::tesseract_collision_bullet
4345{
46+ tesseract_common::PropertyTree getConfigSchema ()
47+ {
48+ using namespace tesseract_common ;
49+ PropertyTree schema;
50+ {
51+ auto & prop = schema[" share_pool_allocators" ];
52+ prop.setAttribute (property_attribute::TYPE, property_type::BOOL);
53+ prop.setAttribute (property_attribute::DOC, " Indicate if shared pool allocators should be leverage." );
54+ prop.setAttribute (property_attribute::REQUIRED, false );
55+ prop.setAttribute (property_attribute::DEFAULT, false );
56+ }
57+
58+ {
59+ auto & prop = schema[" max_persistent_manifold_pool_size" ];
60+ prop.setAttribute (property_attribute::TYPE, property_type::INT);
61+ prop.setAttribute (property_attribute::DOC, " The max size for the persistent manifold pool size." );
62+ prop.setAttribute (property_attribute::MINIMUM, 0 );
63+ }
64+
65+ {
66+ auto & prop = schema[" max_collision_algorithm_pool_size" ];
67+ prop.setAttribute (property_attribute::TYPE, property_type::INT);
68+ prop.setAttribute (property_attribute::DOC, " The max size for the persistent algorithm pool size." );
69+ prop.setAttribute (property_attribute::MINIMUM, 0 );
70+ }
71+
72+ return schema;
73+ }
74+
4475TesseractCollisionConfigurationInfo getConfigInfo (const YAML::Node& config)
4576{
4677 if (config.IsNull ())
4778 return {};
4879
80+ // Validate config
81+ tesseract_common::PropertyTree schema = getConfigSchema ();
82+ schema.mergeConfig (config);
83+ schema.validate ();
84+
4985 bool share_pool_allocators{ false };
50- if (YAML::Node n = config[ " share_pool_allocators" ] )
51- share_pool_allocators = n .as <bool >();
86+ if (const tesseract_common::PropertyTree& prop = schema. at ( " share_pool_allocators" ) )
87+ share_pool_allocators = prop .as <bool >();
5288
5389 TesseractCollisionConfigurationInfo config_info (false , share_pool_allocators);
5490
55- if (YAML::Node n = config[ " max_persistent_manifold_pool_size" ] )
56- config_info.m_defaultMaxPersistentManifoldPoolSize = n .as <int >();
91+ if (const tesseract_common::PropertyTree& prop = schema. at ( " max_persistent_manifold_pool_size" ) )
92+ config_info.m_defaultMaxPersistentManifoldPoolSize = prop .as <int >();
5793
58- if (YAML::Node n = config[ " max_collision_algorithm_pool_size" ] )
59- config_info.m_defaultMaxCollisionAlgorithmPoolSize = n .as <int >();
94+ if (const tesseract_common::PropertyTree& prop = schema. at ( " max_collision_algorithm_pool_size" ) )
95+ config_info.m_defaultMaxCollisionAlgorithmPoolSize = prop .as <int >();
6096
6197 config_info.createPoolAllocators ();
6298 return config_info;
@@ -68,24 +104,32 @@ BulletDiscreteBVHManagerFactory::create(const std::string& name, const YAML::Nod
68104 return std::make_unique<BulletDiscreteBVHManager>(name, getConfigInfo (config));
69105}
70106
107+ tesseract_common::PropertyTree BulletDiscreteBVHManagerFactory::schema () const { return getConfigSchema (); }
108+
71109std::unique_ptr<DiscreteContactManager> BulletDiscreteSimpleManagerFactory::create (const std::string& name,
72110 const YAML::Node& config) const
73111{
74112 return std::make_unique<BulletDiscreteSimpleManager>(name, getConfigInfo (config));
75113}
76114
115+ tesseract_common::PropertyTree BulletDiscreteSimpleManagerFactory::schema () const { return getConfigSchema (); }
116+
77117std::unique_ptr<ContinuousContactManager> BulletCastBVHManagerFactory::create (const std::string& name,
78118 const YAML::Node& config) const
79119{
80120 return std::make_unique<BulletCastBVHManager>(name, getConfigInfo (config));
81121}
82122
123+ tesseract_common::PropertyTree BulletCastBVHManagerFactory::schema () const { return getConfigSchema (); }
124+
83125std::unique_ptr<ContinuousContactManager> BulletCastSimpleManagerFactory::create (const std::string& name,
84126 const YAML::Node& config) const
85127{
86128 return std::make_unique<BulletCastSimpleManager>(name, getConfigInfo (config));
87129}
88130
131+ tesseract_common::PropertyTree BulletCastSimpleManagerFactory::schema () const { return getConfigSchema (); }
132+
89133PLUGIN_ANCHOR_IMPL (BulletFactoriesAnchor)
90134
91135} // namespace tesseract_collision::tesseract_collision_bullet
0 commit comments