ManipulatorVisualization.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #ifndef ManipulatorVisualization_H
25 #define ManipulatorVisualization_H
26 
27 //Coin includes
28 #include <Inventor/nodes/SoSeparator.h>
29 #include <Inventor/manips/SoTransformerManip.h>
30 #include <Inventor/nodes/SoMaterial.h>
31 
32 //VirtualRobot
33 #include <VirtualRobot/Robot.h>
34 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualization.h>
35 
36 //Boost includes
37 #include <boost/smart_ptr/intrusive_ptr.hpp>
38 
39 
40 //Let boost use referencing of Inventor to manage objects memory
41 //and not its own shared pointer referencing
42 using SoTransformerManipPtr = boost::intrusive_ptr<SoTransformerManip>;
43 inline void intrusive_ptr_add_ref(SoTransformerManip* obj)
44 {
45  obj->ref();
46 }
47 inline void intrusive_ptr_release(SoTransformerManip* obj)
48 {
49  obj->unref();
50 }
51 
53 
54 class ManipulatorVisualization : SoSeparator
55 {
56 public:
59 
60  void setVisualization(VirtualRobot::RobotPtr robot, VirtualRobot::RobotNodeSetPtr nodeSet);
61  void removeVisualization();
62 
63  void setColor(float r, float g, float b);
64 
65  void addManipFinishCallback(SoDraggerCB* func, void* data);
66  void addManipMovedCallback(SoDraggerCB* func, void* data);
67 
69  std::string getUserDesiredPoseString();
70 
72  {
73  return isVisualizing;
74  }
75 
76 private:
78  SoMaterial* material;
79  bool isVisualizing;
80  bool hasEndEffectorVisualizer;
81  Eigen::Matrix4f localTransformation;
82 };
83 
84 #endif
ManipulatorVisualization::addManipMovedCallback
void addManipMovedCallback(SoDraggerCB *func, void *data)
Definition: ManipulatorVisualization.cpp:168
ManipulatorVisualization::getUserDesiredPose
Eigen::Matrix4f getUserDesiredPose()
Definition: ManipulatorVisualization.cpp:176
ManipulatorVisualization::removeVisualization
void removeVisualization()
Definition: ManipulatorVisualization.cpp:140
boost::shared_ptr< VirtualRobot::CoinVisualization >
ManipulatorVisualization::getIsVisualizing
bool getIsVisualizing()
Definition: ManipulatorVisualization.h:71
ManipulatorVisualization::ManipulatorVisualization
ManipulatorVisualization()
Definition: ManipulatorVisualization.cpp:40
SoTransformerManipPtr
boost::intrusive_ptr< SoTransformerManip > SoTransformerManipPtr
Definition: ManipulatorVisualization.h:41
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
ManipulatorVisualization::setColor
void setColor(float r, float g, float b)
Definition: ManipulatorVisualization.cpp:152
ManipulatorVisualization::addManipFinishCallback
void addManipFinishCallback(SoDraggerCB *func, void *data)
Definition: ManipulatorVisualization.cpp:160
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
ManipulatorVisualization
Definition: ManipulatorVisualization.h:51
intrusive_ptr_release
void intrusive_ptr_release(SoTransformerManip *obj)
Definition: ManipulatorVisualization.h:46
intrusive_ptr_add_ref
void intrusive_ptr_add_ref(SoTransformerManip *obj)
Definition: ManipulatorVisualization.h:42
ManipulatorVisualization::~ManipulatorVisualization
~ManipulatorVisualization() override
Definition: ManipulatorVisualization.cpp:46
ManipulatorVisualization::setVisualization
void setVisualization(VirtualRobot::RobotPtr robot, VirtualRobot::RobotNodeSetPtr nodeSet)
Definition: ManipulatorVisualization.cpp:52
ManipulatorVisualization::getUserDesiredPoseString
std::string getUserDesiredPoseString()
Definition: ManipulatorVisualization.cpp:226
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18