NavMap
Toggle main menu visibility
Loading...
Searching...
No Matches
navmap_rviz_plugin
include
navmap_rviz_plugin
navmap_pose_tool.hpp
Go to the documentation of this file.
1
// Copyright 2025 Intelligent Robotics Lab
2
//
3
// This file is part of the project Easy Navigation (EasyNav in short)
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
16
17
#ifndef NAVMAP_RVIZ_PLUGIN__NAVMAP_POSE_TOOL_HPP_
18
#define NAVMAP_RVIZ_PLUGIN__NAVMAP_POSE_TOOL_HPP_
19
20
#include <memory>
21
#include <string>
22
#include <utility>
23
24
#include <OgreVector.h>
25
26
#include <QCursor>
// NOLINT cpplint cannot handle include order here
27
28
#include "geometry_msgs/msg/point.hpp"
29
#include "geometry_msgs/msg/quaternion.hpp"
30
31
#include "rviz_common/tool.hpp"
32
#include "rviz_rendering/viewport_projection_finder.hpp"
33
#include "rviz_default_plugins/visibility_control.hpp"
34
35
namespace
rviz_rendering
36
{
37
class
Arrow;
38
}
// namespace rviz_rendering
39
40
namespace
navmap_rviz_plugin
41
{
42
43
class
RVIZ_DEFAULT_PLUGINS_PUBLIC
NavMapPoseTool
:
public
rviz_common::Tool
44
{
45
public
:
46
NavMapPoseTool
();
47
48
~NavMapPoseTool
()
override
;
49
50
void
onInitialize
()
override
;
51
52
void
activate
()
override
;
53
54
void
deactivate
()
override
;
55
56
int
processMouseEvent
(rviz_common::ViewportMouseEvent & event)
override
;
57
58
protected
:
59
virtual
void
onPoseSet
(
double
x,
double
y,
double
z,
double
theta) = 0;
60
61
geometry_msgs::msg::Quaternion
orientationAroundZAxis
(
double
angle);
62
63
void
logPose
(
64
std::string designation,
65
geometry_msgs::msg::Point position,
66
geometry_msgs::msg::Quaternion orientation,
67
double
angle,
68
std::string frame);
69
70
std::shared_ptr<rviz_rendering::Arrow>
arrow_
;
71
72
enum
State
73
{
74
Position
,
75
Orientation
76
};
77
State
state_
;
78
double
angle_
;
79
80
Ogre::Vector3
arrow_position_
;
81
std::shared_ptr<rviz_rendering::ViewportProjectionFinder>
projection_finder_
;
82
83
private
:
84
int
processMouseLeftButtonPressed(std::pair<bool, Ogre::Vector3> xy_plane_intersection);
85
int
processMouseMoved(std::pair<bool, Ogre::Vector3> xy_plane_intersection);
86
int
processMouseLeftButtonReleased();
87
void
makeArrowVisibleAndSetOrientation(
double
angle);
88
double
calculateAngle(Ogre::Vector3 start_point, Ogre::Vector3 end_point);
89
};
90
91
}
// namespace navmap_rviz_plugin
92
93
#endif
// NAVMAP_RVIZ_PLUGIN__NAVMAP_POSE_TOOL_HPP_
navmap_rviz_plugin::NavMapPoseTool::arrow_position_
Ogre::Vector3 arrow_position_
Definition
navmap_pose_tool.hpp:80
navmap_rviz_plugin::NavMapPoseTool::NavMapPoseTool
NavMapPoseTool()
Definition
navmap_pose_tool.cpp:48
navmap_rviz_plugin::NavMapPoseTool::onInitialize
void onInitialize() override
Definition
navmap_pose_tool.cpp:56
navmap_rviz_plugin::NavMapPoseTool::arrow_
std::shared_ptr< rviz_rendering::Arrow > arrow_
Definition
navmap_pose_tool.hpp:70
navmap_rviz_plugin::NavMapPoseTool::state_
State state_
Definition
navmap_pose_tool.hpp:77
navmap_rviz_plugin::NavMapPoseTool::deactivate
void deactivate() override
Definition
navmap_pose_tool.cpp:70
navmap_rviz_plugin::NavMapPoseTool::onPoseSet
virtual void onPoseSet(double x, double y, double z, double theta)=0
navmap_rviz_plugin::NavMapPoseTool::processMouseEvent
int processMouseEvent(rviz_common::ViewportMouseEvent &event) override
Definition
navmap_pose_tool.cpp:115
navmap_rviz_plugin::NavMapPoseTool::projection_finder_
std::shared_ptr< rviz_rendering::ViewportProjectionFinder > projection_finder_
Definition
navmap_pose_tool.hpp:81
navmap_rviz_plugin::NavMapPoseTool::State
State
Definition
navmap_pose_tool.hpp:73
navmap_rviz_plugin::NavMapPoseTool::Position
@ Position
Definition
navmap_pose_tool.hpp:74
navmap_rviz_plugin::NavMapPoseTool::Orientation
@ Orientation
Definition
navmap_pose_tool.hpp:75
navmap_rviz_plugin::NavMapPoseTool::orientationAroundZAxis
geometry_msgs::msg::Quaternion orientationAroundZAxis(double angle)
Definition
navmap_pose_tool.cpp:199
navmap_rviz_plugin::NavMapPoseTool::activate
void activate() override
Definition
navmap_pose_tool.cpp:64
navmap_rviz_plugin::NavMapPoseTool::logPose
void logPose(std::string designation, geometry_msgs::msg::Point position, geometry_msgs::msg::Quaternion orientation, double angle, std::string frame)
Definition
navmap_pose_tool.cpp:209
navmap_rviz_plugin::NavMapPoseTool::angle_
double angle_
Definition
navmap_pose_tool.hpp:78
navmap_rviz_plugin::NavMapPoseTool::~NavMapPoseTool
~NavMapPoseTool() override
navmap_rviz_plugin
Definition
navmap_goal_tool.hpp:39
rviz_rendering
Definition
navmap_pose_tool.hpp:36
Generated by
1.17.0