Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/behaviortree_cpp/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ std::pair<std::string, PortInfo> CreatePort(PortDirection direction, StringView
auto sname = static_cast<std::string>(name);
if (!IsAllowedPortName(sname))
{
throw RuntimeError("The name of a port must start with an alphabetic character. "
throw RuntimeError("The name of a port must not be `name` or `ID` "
"and must start with an alphabetic character. "
"Underscore is reserved.");
}

Expand Down
5 changes: 3 additions & 2 deletions include/behaviortree_cpp/tree_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma once

#include <condition_variable>
#include <exception>
#include <mutex>
#include <map>

Expand Down Expand Up @@ -343,9 +344,9 @@ inline Result TreeNode::getInput(const std::string& key, T& destination) const

std::unique_lock<std::mutex> entry_lock(config_.blackboard->entryMutex());
const Any* val = config_.blackboard->getAny(static_cast<std::string>(remapped_key));
if (val && val->empty() == false)
if (val && !val->empty())
{
if (std::is_same<T, std::string>::value == false &&
if (!std::is_same_v<T, std::string> &&
val->type() == typeid(std::string))
{
destination = convertFromString<T>(val->cast<std::string>());
Expand Down
7 changes: 5 additions & 2 deletions src/basic_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ PortDirection convertFromString<PortDirection>(StringView str)
return PortDirection::INPUT;
if (str == "Output" || str == "OUTPUT")
return PortDirection::OUTPUT;
return PortDirection::INOUT;
if (str == "InOut" || str == "INOUT")
return PortDirection::INOUT;
throw RuntimeError(std::string("Cannot convert this to PortDirection: ") +
static_cast<std::string>(str));
}

std::ostream& operator<<(std::ostream& os, const NodeType& type)
Expand Down Expand Up @@ -287,7 +290,7 @@ std::vector<StringView> splitString(const StringView& strToSplit, char delimeter
{
new_pos = strToSplit.size();
}
StringView sv = {&strToSplit.data()[pos], new_pos - pos};
const auto sv = StringView{&strToSplit.data()[pos], new_pos - pos};
splitted_strings.push_back(sv);
pos = new_pos + 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/controls/fallback_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

#include "behaviortree_cpp/controls/fallback_node.h"
#include "behaviortree_cpp/action_node.h"

namespace BT
{
FallbackNode::FallbackNode(const std::string& name) :
Expand Down
1 change: 0 additions & 1 deletion src/decorators/repeat_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace BT
{
constexpr const char* RepeatNode::NUM_CYCLES;

RepeatNode::RepeatNode(const std::string& name, int NTries) :
DecoratorNode(name, {}),
Expand Down