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 <RobotAPI/interface/core/PoseBase.h>
26 
27 #include <VirtualRobot/RobotNodeSet.h>
28 
30 
31 #include <QWidget>
32 
33 #include "VisualizationSubject.h"
34 
35 namespace armarx
36 {
37 
38 
40  {
41 
42  public:
43  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44  /// METHODS FOR VISUALIZATION SETUP
45  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46  /**
47  * @brief addRobotVisualization adds a robot to the robotviewer
48  * @param robot the robot to be visualized
49  * @param selectedChain the standard kinematic chain of the robot to use
50  */
51  virtual void addRobotVisualization(VirtualRobot::RobotPtr robot, QString selectedChain) = 0;
52 
53  /**
54  * @brief addSceneVisualization visualizes the whole scene where the robot is placed in
55  * @param scene
56  */
58 
59  /**
60  * @brief setCamera sets the camera at a certain position
61  * @param position the 3D Position of the camera
62  * @param pointAtA the highest point the camera points at
63  * @param pointAtB the lowest point the camera looks at
64  */
65  virtual void setCamera(const Eigen::VectorXf position, const Eigen::VectorXf pointAtA, const Eigen::VectorXf pointAtB) = 0;
66 
67  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
68  /// METHODS FOR TRANSITIONS
69  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
70  /**
71  * @brief addTransitionVisualization visualizes a transition that means an array of points in 3d space
72  * @param transition the transition to be visualized
73  */
74  virtual void addTransitionVisualization(int index, std::vector<PoseBasePtr> transition) = 0;
75 
76  /**
77  * @brief highlightTransitionVisualization highlights the transition with index i by changing the color of all points belonging to that transition
78  * @param index the index of the transition to be highlighted starting with 0
79  * @param transition the transition to be highlighted
80  */
81  virtual void highlightTransitionVisualization(int index, std::vector<PoseBasePtr> transition) = 0;
82 
83  /**
84  * @brief removeTransitionVisualization removes visualization of a certain transition
85  * @param index the index of the transition to be removed starting with 0
86  */
87  virtual void removeTransitionVisualization(int index) = 0;
88 
89  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
90  /// METHODS FOR WAYPOINTS
91  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
92  /**
93  * @brief addWaypointVisualization visualizes a certain waypoint by putting a visual representaiton of a toolcenterpoint at a predefined pose
94  * @param index the index of the waypoint to be added
95  * @param waypoint Pose that should be realized by the WaypointVisualization
96  * @param tcp the Endeffector that should be visualized
97  */
98  virtual void addWaypointVisualization(int index, PoseBasePtr waypoint, VirtualRobot::EndEffectorPtr tcp) = 0;
99 
100  /**
101  * @brief removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
102  * @param index the index of the waypoint to be removed starting with 0
103  */
104  virtual void removeWaypointVisualization(int index) = 0;
105 
106  /**
107  * @brief removeAllWaypointVisualizations removes all waypoints that are currently visualized
108  */
109  virtual void removeAllWaypointVisualizations() = 0;
110 
111  /**
112  * @brief removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
113  * @param index the index of the waypoint to be removed starting with 0
114  */
115  virtual void setSelectedWaypoint(int index) = 0;
116 
117 
118  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
119  /// SETTING MANIPULATOR
120  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
121  /**
122  * @brief setManipulator sets a new endeffector at a predefined pose that is calculated by using forward kinematic on the joint angles
123  * @param kc the kinematic chain to use the endeffector of as the manipulator
124  * @param jointAngles the joint angles of the robot to reach the manipulator
125  */
126  virtual void setManipulator(VirtualRobot::RobotNodeSetPtr kc, std::vector<float>jointAngles) = 0;
127 
128  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
129  /// UPDATING OF VISUALIZATION
130  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
131  /**
132  * @brief updateRobotVisualization refreshes the viewer so it visualizes the new robot state
133  */
134  virtual void updateRobotVisualization() = 0;
135  /**
136  * @brief enableVisualization shows the viewer
137  */
138  virtual void enableVisualization() = 0;
139  /**
140  * @brief disableVisualization hides the viewer
141  */
142  virtual void disableVisualization() = 0;
143  /**
144  * @brief clearTrajectory removes all visualization of waypoints and transitions but keeps the robot and the maipulator visualized
145  */
146  virtual void clearTrajectory() = 0;
147  /**
148  * @brief reproduce creates a new view with thesame visualization nodes but an independent camera
149  * @param parent the widget to attach the newly created viewer to
150  * @return the reproduced viewer
151  */
152  virtual std::shared_ptr<RobotVisualization> reproduce(QWidget* parent) = 0;
153 
154  protected:
158 
159  };
160 
161  using RobotVisualizationPtr = std::shared_ptr<RobotVisualization>;
162 }
163 
164 
165 #endif
armarx::RobotVisualization::createAdvancedVisualizationFactory
virtual AdvancedVisualizationFactoryPtr createAdvancedVisualizationFactory()=0
armarx::RobotVisualization::addWaypointVisualization
virtual void addWaypointVisualization(int index, PoseBasePtr waypoint, VirtualRobot::EndEffectorPtr tcp)=0
METHODS FOR WAYPOINTS.
armarx::RobotVisualization::removeAllWaypointVisualizations
virtual void removeAllWaypointVisualizations()=0
removeAllWaypointVisualizations removes all waypoints that are currently visualized
armarx::RobotVisualization::setCamera
virtual void setCamera(const Eigen::VectorXf position, const Eigen::VectorXf pointAtA, const Eigen::VectorXf pointAtB)=0
setCamera sets the camera at a certain position
armarx::RobotVisualization::removeTransitionVisualization
virtual void removeTransitionVisualization(int index)=0
removeTransitionVisualization removes visualization of a certain transition
AdvancedVisualizationFactory.h
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::RobotVisualization::clearTrajectory
virtual void clearTrajectory()=0
clearTrajectory removes all visualization of waypoints and transitions but keeps the robot and the ma...
armarx::RobotVisualization::setSelectedWaypoint
virtual void setSelectedWaypoint(int index)=0
removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
VisualizationSubject.h
scene3D::ScenePtr
std::shared_ptr< Scene > ScenePtr
Definition: PointerDefinitions.h:36
armarx::RobotVisualization::addSceneVisualization
virtual void addSceneVisualization(VirtualRobot::ScenePtr scene)=0
addSceneVisualization visualizes the whole scene where the robot is placed in
armarx::RobotVisualization::scene
VirtualRobot::ScenePtr scene
Definition: RobotVisualization.h:155
armarx::VisualizationSubject
The AdvancedVisualizationFactory class is the abstract decorator of the Decorator-Pattern and decorat...
Definition: VisualizationSubject.h:37
armarx::RobotVisualization::reproduce
virtual std::shared_ptr< RobotVisualization > reproduce(QWidget *parent)=0
reproduce creates a new view with thesame visualization nodes but an independent camera
armarx::RobotVisualization
Definition: RobotVisualization.h:39
armarx::RobotVisualization::robot
VirtualRobot::RobotPtr robot
Definition: RobotVisualization.h:156
armarx::AdvancedVisualizationFactoryPtr
std::shared_ptr< AdvancedVisualizationFactory > AdvancedVisualizationFactoryPtr
Definition: AdvancedVisualizationFactory.h:191
armarx::RobotVisualization::addTransitionVisualization
virtual void addTransitionVisualization(int index, std::vector< PoseBasePtr > transition)=0
METHODS FOR TRANSITIONS.
armarx::RobotVisualization::enableVisualization
virtual void enableVisualization()=0
enableVisualization shows the viewer
armarx::RobotVisualization::disableVisualization
virtual void disableVisualization()=0
disableVisualization hides the viewer
armarx::RobotVisualization::highlightTransitionVisualization
virtual void highlightTransitionVisualization(int index, std::vector< PoseBasePtr > transition)=0
highlightTransitionVisualization highlights the transition with index i by changing the color of all ...
armarx::channels::KinematicUnitObserver::jointAngles
const KinematicUnitDatafieldCreator jointAngles("jointAngles")
armarx::RobotVisualizationPtr
std::shared_ptr< RobotVisualization > RobotVisualizationPtr
Definition: RobotVisualization.h:161
armarx::RobotVisualization::updateRobotVisualization
virtual void updateRobotVisualization()=0
UPDATING OF VISUALIZATION.
armarx::RobotVisualization::addRobotVisualization
virtual void addRobotVisualization(VirtualRobot::RobotPtr robot, QString selectedChain)=0
METHODS FOR VISUALIZATION SETUP.
armarx::RobotVisualization::setManipulator
virtual void setManipulator(VirtualRobot::RobotNodeSetPtr kc, std::vector< float >jointAngles)=0
SETTING MANIPULATOR.
armarx::RobotVisualization::removeWaypointVisualization
virtual void removeWaypointVisualization(int index)=0
removeWaypointVisualization removes the Waypoint with index so that it is no longer visualized
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18