movebase_node.cpp
Go to the documentation of this file.
1 #include "movebase_node.h"
3 
4 // This function must be implemented in the .cpp file to create
5 // a plugin that can be loaded at run-time
7 {
8  factory.registerNodeType<MoveBaseAction>("MoveBase");
9 }
10 
12 {
13  Pose2D goal;
14  if (getParam<Pose2D>("goal", goal) == false)
15  {
16  auto default_goal_value = requiredNodeParameters().at("goal");
17  // use the convertFromString function
18  goal = BT::convertFromString<Pose2D>(default_goal_value);
19  }
20 
21  printf("[ MoveBase: STARTED ]. goal: x=%.f y=%.1f theta=%.2f\n", goal.x, goal.y, goal.theta);
22 
23  _halt_requested.store(false);
24  int count = 0;
25 
26  // "compute" for 250 milliseconds or until _halt_requested is true
27  while (!_halt_requested && count++ < 25)
28  {
29  SleepMS(10);
30  }
31 
32  std::cout << "[ MoveBase: FINISHED ]" << std::endl;
34 }
35 
37 {
38  _halt_requested.store(true);
39 }
static const BT::NodeParameters & requiredNodeParameters()
Definition: movebase_node.h:62
BT::NodeStatus tick() override
Method to be implemented by the user.
void SleepMS(int ms)
Definition: movebase_node.h:12
double x
Definition: movebase_node.h:9
BT_REGISTER_NODES(factory)
double theta
Definition: movebase_node.h:9
std::atomic_bool _halt_requested
Definition: movebase_node.h:73
static volatile int count
Definition: minitrace.cpp:55
NodeStatus
Definition: basic_types.h:28
double y
Definition: movebase_node.h:9
virtual void halt() override
The method used to interrupt the execution of a RUNNING node.


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sun Feb 3 2019 03:14:32