Nav2 Navigation Stack - rolling
main
ROS 2 Navigation Stack
nav2_rviz_plugins
src
goal_tool.cpp
1
// Copyright (c) 2019 Intel Corporation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "nav2_rviz_plugins/goal_tool.hpp"
16
17
#include <memory>
18
#include <string>
19
20
#include "nav2_rviz_plugins/goal_common.hpp"
21
#include "rviz_common/display_context.hpp"
22
#include "rviz_common/load_resource.hpp"
23
24
namespace
nav2_rviz_plugins
25
{
26
27
GoalTool::GoalTool()
28
: rviz_default_plugins::tools::PoseTool()
29
{
30
shortcut_key_ =
'g'
;
31
}
32
33
GoalTool::~GoalTool()
34
{
35
}
36
37
void
GoalTool::onInitialize()
38
{
39
PoseTool::onInitialize();
40
setName(
"Nav2 Goal"
);
41
setIcon(rviz_common::loadPixmap(
"package://rviz_default_plugins/icons/classes/SetGoal.png"
));
42
}
43
44
void
45
GoalTool::onPoseSet(
double
x,
double
y,
double
theta)
46
{
47
// Set goal pose on global object GoalUpdater to update nav2 Panel
48
GoalUpdater.setGoal(x, y, theta, context_->getFixedFrame());
49
}
50
51
}
// namespace nav2_rviz_plugins
52
53
#include <pluginlib/class_list_macros.hpp>
// NOLINT
54
PLUGINLIB_EXPORT_CLASS(
nav2_rviz_plugins::GoalTool
, rviz_common::Tool)
nav2_rviz_plugins::GoalTool
Definition:
goal_tool.hpp:39
Generated by
1.9.1