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

Skip to content

Commit bfb8681

Browse files
fixed ncurses dependencies ( BehaviorTree#179 )
1 parent aeb0d64 commit bfb8681

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ if(CURSES_FOUND)
185185
list(APPEND BT_SOURCE
186186
src/controls/manual_node.cpp
187187
)
188+
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${CURSES_LIBRARIES})
189+
add_definitions(-DNCURSES_FOUND)
188190
endif()
189-
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${CURSES_LIBRARIES})
190191

191192

192193
######################################################

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<depend condition="$ROS_VERSION == 2">rclcpp</depend>
2121

2222
<depend>libzmq3-dev</depend>
23+
<depend>libncurses-dev</depend>
2324

2425
<export>
2526
<build_type condition="$ROS_VERSION == 1">catkin</build_type>

src/bt_factory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ BehaviorTreeFactory::BehaviorTreeFactory()
5555
registerNodeType<SwitchNode<5>>("Switch5");
5656
registerNodeType<SwitchNode<6>>("Switch6");
5757

58+
#ifdef NCURSES_FOUND
5859
registerNodeType<ManualSelectorNode>("ManualSelector");
59-
60+
#endif
6061
for( const auto& it: builders_)
6162
{
6263
builtin_IDs_.insert( it.first );

src/controls/manual_node.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ NodeStatus ManualSelectorNode::selectStatus() const
117117
uint8_t ManualSelectorNode::selectChild() const
118118
{
119119
const size_t children_count = children_nodes_.size();
120+
120121
std::vector<std::string> list;
121122
list.reserve(children_count);
122123
for(const auto& child: children_nodes_)
@@ -165,7 +166,7 @@ uint8_t ManualSelectorNode::selectChild() const
165166
}
166167
else if( ch == KEY_UP )
167168
{
168-
row = ( row == 0) ? : row-1;
169+
row = ( row == 0) ? (children_count-1) : row-1;
169170
}
170171
else if( ch == KEY_ENTER || ch == 10 )
171172
{

0 commit comments

Comments
 (0)