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 #pragma once
25 
26 //Coin includes
27 #include <Inventor/nodes/SoSeparator.h>
28 #include <Inventor/manips/SoTransformerManip.h>
29 #include <Inventor/nodes/SoMaterial.h>
30 
31 //VirtualRobot
32 #include <VirtualRobot/Robot.h>
33 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualization.h>
34 
35 //Boost includes
36 #include <boost/smart_ptr/intrusive_ptr.hpp>
37 
38 
39 //Let boost use referencing of Inventor to manage objects memory
40 //and not its own shared pointer referencing
41 using SoTransformerManipPtr = boost::intrusive_ptr<SoTransformerManip>;
42 inline void intrusive_ptr_add_ref(SoTransformerManip* obj)
43 {
44  obj->ref();
45 }
46 inline void intrusive_ptr_release(SoTransformerManip* obj)
47 {
48  obj->unref();
49 }
50 
51 class ManipulatorVisualization : SoSeparator
52 {
53 public:
55  ~ManipulatorVisualization() override;
56 
57  void setVisualization(VirtualRobot::RobotPtr robot, VirtualRobot::RobotNodeSetPtr nodeSet);
58  void removeVisualization();
59 
60  void setColor(float r, float g, float b);
61 
62  void addManipFinishCallback(SoDraggerCB* func, void* data);
63  void addManipMovedCallback(SoDraggerCB* func, void* data);
64 
66  std::string getUserDesiredPoseString();
67  void setUserDesiredPose(Eigen::Matrix4f globalPose);
68 
69  bool getIsVisualizing() const
70  {
71  return isVisualizing;
72  }
73 
74 private:
76  SoMaterial* material;
77  bool isVisualizing;
78  bool hasEndEffectorVisualizer;
79  Eigen::Matrix4f localTransformation;
80 };
81 
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
ManipulatorVisualization::getIsVisualizing
bool getIsVisualizing() const
Definition: ManipulatorVisualization.h:69
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::setUserDesiredPose
void setUserDesiredPose(Eigen::Matrix4f globalPose)
Definition: ManipulatorVisualization.cpp:236
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