RobotVisualization.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarXGuiPlugins::RobotTrajectoryDesigner::Visualization
17 * @author Timo Birr
18 * @date 2018
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22#ifndef ROBOTVISUALIZATION_H
23#define ROBOTVISUALIZATION_H
24
25#include <QWidget>
26
27#include <VirtualRobot/RobotNodeSet.h>
28
29#include <RobotAPI/interface/core/PoseBase.h>
30
33
34namespace armarx
35{
36
37
39 {
40
41 public:
42 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
43 /// METHODS FOR VISUALIZATION SETUP
44 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
45 /**
46 * @brief addRobotVisualization adds a robot to the robotviewer
47 * @param robot the robot to be visualized
48 * @param selectedChain the standard kinematic chain of the robot to use
49 */
50 virtual void addRobotVisualization(VirtualRobot::RobotPtr robot, QString selectedChain) = 0;
51
52 /**
53 * @brief addSceneVisualization visualizes the whole scene where the robot is placed in
54 * @param scene
55 */
56 virtual void addSceneVisualization(VirtualRobot::ScenePtr scene) = 0;
57
58 /**
59 * @brief setCamera sets the camera at a certain position
60 * @param position the 3D Position of the camera
61 * @param pointAtA the highest point the camera points at
62 * @param pointAtB the lowest point the camera looks at
63 */
64 virtual void setCamera(const Eigen::VectorXf position,
65 const Eigen::VectorXf pointAtA,
66 const Eigen::VectorXf pointAtB) = 0;
67
68 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
69 /// METHODS FOR TRANSITIONS
70 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
71 /**
72 * @brief addTransitionVisualization visualizes a transition that means an array of points in 3d space
73 * @param transition the transition to be visualized
74 */
75 virtual void addTransitionVisualization(int index, std::vector<PoseBasePtr> transition) = 0;
76
77 /**
78 * @brief highlightTransitionVisualization highlights the transition with index i by changing the color of all points belonging to that transition
79 * @param index the index of the transition to be highlighted starting with 0
80 * @param transition the transition to be highlighted
81 */
83 std::vector<PoseBasePtr> transition) = 0;
84
85 /**
86 * @brief removeTransitionVisualization removes visualization of a certain transition
87 * @param index the index of the transition to be removed starting with 0
88 */
89 virtual void removeTransitionVisualization(int index) = 0;
90
91 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
92 /// METHODS FOR WAYPOINTS
93 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
94 /**
95 * @brief addWaypointVisualization visualizes a certain waypoint by putting a visual representaiton of a toolcenterpoint at a predefined pose
96 * @param index the index of the waypoint to be added
97 * @param waypoint Pose that should be realized by the WaypointVisualization
98 * @param tcp the Endeffector that should be visualized
99 */
101 PoseBasePtr waypoint,
102 VirtualRobot::EndEffectorPtr tcp) = 0;
103
104 /**
105 * @brief removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
106 * @param index the index of the waypoint to be removed starting with 0
107 */
108 virtual void removeWaypointVisualization(int index) = 0;
109
110 /**
111 * @brief removeAllWaypointVisualizations removes all waypoints that are currently visualized
112 */
114
115 /**
116 * @brief removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
117 * @param index the index of the waypoint to be removed starting with 0
118 */
119 virtual void setSelectedWaypoint(int index) = 0;
120
121
122 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
123 /// SETTING MANIPULATOR
124 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
125 /**
126 * @brief setManipulator sets a new endeffector at a predefined pose that is calculated by using forward kinematic on the joint angles
127 * @param kc the kinematic chain to use the endeffector of as the manipulator
128 * @param jointAngles the joint angles of the robot to reach the manipulator
129 */
130 virtual void setManipulator(VirtualRobot::RobotNodeSetPtr kc,
131 std::vector<float> jointAngles) = 0;
132
133 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
134 /// UPDATING OF VISUALIZATION
135 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
136 /**
137 * @brief updateRobotVisualization refreshes the viewer so it visualizes the new robot state
138 */
139 virtual void updateRobotVisualization() = 0;
140 /**
141 * @brief enableVisualization shows the viewer
142 */
143 virtual void enableVisualization() = 0;
144 /**
145 * @brief disableVisualization hides the viewer
146 */
147 virtual void disableVisualization() = 0;
148 /**
149 * @brief clearTrajectory removes all visualization of waypoints and transitions but keeps the robot and the maipulator visualized
150 */
151 virtual void clearTrajectory() = 0;
152 /**
153 * @brief reproduce creates a new view with thesame visualization nodes but an independent camera
154 * @param parent the widget to attach the newly created viewer to
155 * @return the reproduced viewer
156 */
157 virtual std::shared_ptr<RobotVisualization> reproduce(QWidget* parent) = 0;
158
159 protected:
160 VirtualRobot::ScenePtr scene;
163 };
164
165 using RobotVisualizationPtr = std::shared_ptr<RobotVisualization>;
166} // namespace armarx
167
168
169#endif
uint8_t index
virtual void setManipulator(VirtualRobot::RobotNodeSetPtr kc, std::vector< float > jointAngles)=0
SETTING MANIPULATOR.
VirtualRobot::RobotPtr robot
virtual std::shared_ptr< RobotVisualization > reproduce(QWidget *parent)=0
reproduce creates a new view with thesame visualization nodes but an independent camera
virtual void addTransitionVisualization(int index, std::vector< PoseBasePtr > transition)=0
METHODS FOR TRANSITIONS.
virtual void addRobotVisualization(VirtualRobot::RobotPtr robot, QString selectedChain)=0
METHODS FOR VISUALIZATION SETUP.
virtual void removeWaypointVisualization(int index)=0
removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
virtual void addSceneVisualization(VirtualRobot::ScenePtr scene)=0
addSceneVisualization visualizes the whole scene where the robot is placed in
virtual void clearTrajectory()=0
clearTrajectory removes all visualization of waypoints and transitions but keeps the robot and the ma...
virtual void removeAllWaypointVisualizations()=0
removeAllWaypointVisualizations removes all waypoints that are currently visualized
virtual AdvancedVisualizationFactoryPtr createAdvancedVisualizationFactory()=0
virtual void updateRobotVisualization()=0
UPDATING OF VISUALIZATION.
virtual void addWaypointVisualization(int index, PoseBasePtr waypoint, VirtualRobot::EndEffectorPtr tcp)=0
METHODS FOR WAYPOINTS.
VirtualRobot::ScenePtr scene
virtual void setSelectedWaypoint(int index)=0
removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
virtual void disableVisualization()=0
disableVisualization hides the viewer
virtual void enableVisualization()=0
enableVisualization shows the viewer
virtual void highlightTransitionVisualization(int index, std::vector< PoseBasePtr > transition)=0
highlightTransitionVisualization highlights the transition with index i by changing the color of all ...
virtual void setCamera(const Eigen::VectorXf position, const Eigen::VectorXf pointAtA, const Eigen::VectorXf pointAtB)=0
setCamera sets the camera at a certain position
virtual void removeTransitionVisualization(int index)=0
removeTransitionVisualization removes visualization of a certain transition
The AdvancedVisualizationFactory class is the abstract decorator of the Decorator-Pattern and decorat...
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< AdvancedVisualizationFactory > AdvancedVisualizationFactoryPtr
std::shared_ptr< RobotVisualization > RobotVisualizationPtr