Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab58236

Browse files
committed
Fix issue introduced in the last commit
1 parent 38412d4 commit ab58236

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

gtest/navigation_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void TryDynamicCastPtr(Original* ptr, Casted*& destination)
151151

152152
/****************TESTS START HERE***************************/
153153

154-
TEST(Navigationtest, MoveBaseReocvery)
154+
TEST(Navigationtest, MoveBaseRecovery)
155155
{
156156
BehaviorTreeFactory factory;
157157

include/behaviortree_cpp/bt_factory.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,23 @@ class BehaviorTreeFactory
180180
}
181181

182182
template <typename T>
183-
NodeBuilder getBuilderImpl(typename std::enable_if< has_params_constructor<T>::value >::type* = nullptr)
183+
NodeBuilder getBuilderImpl(typename std::enable_if<has_default_constructor<T>::value && has_params_constructor<T>::value >::type* = nullptr)
184184
{
185-
return [](const std::string& name, const NodeParameters& params)
185+
return [this](const std::string& name, const NodeParameters& params)
186+
{
187+
// Special case. Use default constructor if parameters are empty
188+
if( params.empty() && has_default_constructor<T>::value && getRequiredParamsImpl<T>().size()>0)
189+
{
190+
return std::unique_ptr<TreeNode>(new T(name));
191+
}
192+
return std::unique_ptr<TreeNode>(new T(name, params));
193+
};
194+
}
195+
196+
template <typename T>
197+
NodeBuilder getBuilderImpl(typename std::enable_if<!has_default_constructor<T>::value && has_params_constructor<T>::value >::type* = nullptr)
198+
{
199+
return [this](const std::string& name, const NodeParameters& params)
186200
{
187201
return std::unique_ptr<TreeNode>(new T(name, params));
188202
};

include/behaviortree_cpp/controls/sequence_star_node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SequenceStarNode : public ControlNode
3737
public:
3838
SequenceStarNode(const std::string& name, bool reset_on_failure = true);
3939

40-
// Reset policy passed by parameter [reset_policy]
40+
// Reset policy passed by parameter [reset_on_failure]
4141
SequenceStarNode(const std::string& name, const NodeParameters& params);
4242

4343
virtual ~SequenceStarNode() override = default;

0 commit comments

Comments
 (0)