-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathor_navigation.h
More file actions
50 lines (39 loc) · 1.61 KB
/
Copy pathor_navigation.h
File metadata and controls
50 lines (39 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <smacc/smacc_orthogonal.h>
#include <move_base_z_client_plugin/move_base_z_client_plugin.h>
#include <move_base_z_client_plugin/components/odom_tracker/odom_tracker.h>
#include <move_base_z_client_plugin/components/waypoints_navigator/waypoints_navigator.h>
#include <move_base_z_client_plugin/components/pose/cp_pose.h>
namespace sm_dance_bot
{
using namespace cl_move_base_z;
class OrNavigation : public smacc::Orthogonal<OrNavigation>
{
public:
virtual void onInitialize() override
{
auto movebaseClient = this->createClient<ClMoveBaseZ>();
movebaseClient->initialize();
// create planner switcher
movebaseClient->createComponent<PlannerSwitcher>();
movebaseClient->createComponent<cl_move_base_z::Pose>();
// create odom tracker
movebaseClient->createComponent<cl_move_base_z::odom_tracker::OdomTracker>();
// create waypoints navigator component
auto waypointsNavigator = movebaseClient->createComponent<WaypointNavigator>();
loadWaypointsFromYaml(waypointsNavigator);
// change this to skip some points of the yaml file, default = 0
waypointsNavigator->currentWaypoint_ = 1;
}
void loadWaypointsFromYaml(WaypointNavigator *waypointsNavigator)
{
// if it is the first time and the waypoints navigator is not configured
std::string planfilepath;
ros::NodeHandle nh("~");
if (nh.getParam("/sm_dance_bot/waypoints_plan", planfilepath))
{
waypointsNavigator->loadWayPointsFromFile(planfilepath);
}
}
};
} // namespace sm_dance_bot