Skip to content
Snippets Groups Projects
Commit 298f3dca authored by Alejandro Lopez Gestoso's avatar Alejandro Lopez Gestoso
Browse files

Removed base_bt_functions

parent e7a11ad4
No related branches found
No related tags found
No related merge requests found
......@@ -95,8 +95,7 @@ include_directories(${catkin_INCLUDE_DIRS})
# add_library(iri_behaviortree
# src/${PROJECT_NAME}/iri_behaviortree.cpp
# )
add_library(${PROJECT_NAME} src/iri_async_action.cpp src/iri_bt_factory.cpp
src/iri_bt_basic_nodes.cpp)
add_library(${PROJECT_NAME} src/iri_async_action.cpp src/iri_bt_factory.cpp)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
## Declare a cpp executable
......
......@@ -12,13 +12,6 @@ This library is intendend to expand the [behaviortree](https://github.com/Behavi
This is acomplished with the definition of the new class **IriBehaviorTreeFactory**. This class just implements the *registerIriAsyncAction* function to register any *IriAsyncActionNode* in the same way a *SimpleActionNode* would be registered using *registerSimpleAction*.
* It also provides a set of basic BehaviorTree nodes (BT nodes) and the function to register them.
This is acomplished with the definition of a new class **IriBehaviorTreeBasicNodes** that implements this basic BT nodes and provides a function called *init* to register these BT nodes.
The basic nodes provided are:
* **NOP:** Action that always return running.
On the following image a general overview of the inheritance is shown:
<img src="doc/images/general_overview.png" alt="Image: General overview">
......
#ifndef IRI_BT_BASIC_NODES_H
#define IRI_BT_BASIC_NODES_H
#include "iri_bt_factory.h"
class IriBehaviorTreeBasicNodes
{
public:
IriBehaviorTreeBasicNodes()
{
}
/**
* \brief Register all basic conditions and actions
*
* This function registers all basic conditions and actions needed for
* any generic application.
*
* \param factory (IriBehaviorTreeFactory)
*
*/
void init(IriBehaviorTreeFactory &factory);
protected:
/**
* \brief Does nothing
*
* This function does nothing and it is useful for synchronous functions
* in order to wait for the action to finish (checking is_finished())
*
* \return a BT:NodeStatus::RUNNING always
*
*/
BT::NodeStatus NOP();
};
#endif
#include "iri_bt_basic_nodes.h"
void IriBehaviorTreeBasicNodes::init(IriBehaviorTreeFactory &factory)
{
factory.registerIriAsyncAction("NOP", std::bind(&IriBehaviorTreeBasicNodes::NOP, this));
}
BT::NodeStatus IriBehaviorTreeBasicNodes::NOP()
{
return BT::NodeStatus::RUNNING;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment