ManipulatorVisualization.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 <PACKAGE_NAME>::<CATEGORY>::ManipulatorVisualization
17  * @author Stefan Reither ( stef dot reither at web dot de )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 //Coin includes
26 #include <Inventor/nodes/SoSeparator.h>
27 #include <Inventor/manips/SoTransformerManip.h>
28 #include <Inventor/nodes/SoMaterial.h>
29 
30 //VirtualRobot
31 #include <VirtualRobot/Robot.h>
32 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualization.h>
33 
34 //Boost includes
35 #include <boost/smart_ptr/intrusive_ptr.hpp>
36 
37 namespace armarx
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::EndEffectorPtr endEffector);
58  void removeVisualization();
59 
60  void setColor(float r, float g, float b);
61 
63  std::string getUserDesiredPoseString();
64  void setUserDesiredPose(Eigen::Matrix4f globalPose);
65 
66  bool getIsVisualizing() const
67  {
68  return isVisualizing;
69  }
70 
71  private:
73  SoMaterial* material;
74  bool isVisualizing;
75  bool hasEndEffectorVisualizer;
76  Eigen::Matrix4f localTransformation;
77  };
78 }
79 
80 
armarx::ManipulatorVisualization::setColor
void setColor(float r, float g, float b)
Definition: ManipulatorVisualization.cpp:150
armarx::ManipulatorVisualization::getUserDesiredPoseString
std::string getUserDesiredPoseString()
Definition: ManipulatorVisualization.cpp:208
armarx::ManipulatorVisualization::setUserDesiredPose
void setUserDesiredPose(Eigen::Matrix4f globalPose)
Definition: ManipulatorVisualization.cpp:218
armarx::SoTransformerManipPtr
boost::intrusive_ptr< SoTransformerManip > SoTransformerManipPtr
Definition: ManipulatorVisualization.h:41
armarx::ManipulatorVisualization::~ManipulatorVisualization
~ManipulatorVisualization() override
Definition: ManipulatorVisualization.cpp:46
armarx::ManipulatorVisualization::getIsVisualizing
bool getIsVisualizing() const
Definition: ManipulatorVisualization.h:66
armarx::ManipulatorVisualization::ManipulatorVisualization
ManipulatorVisualization()
Definition: ManipulatorVisualization.cpp:41
armarx::ManipulatorVisualization::getUserDesiredPose
Eigen::Matrix4f getUserDesiredPose()
Definition: ManipulatorVisualization.cpp:158
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::ManipulatorVisualization::removeVisualization
void removeVisualization()
Definition: ManipulatorVisualization.cpp:138
armarx::ManipulatorVisualization
Definition: ManipulatorVisualization.h:51
armarx::ManipulatorVisualization::setVisualization
void setVisualization(VirtualRobot::EndEffectorPtr endEffector)
Definition: ManipulatorVisualization.cpp:52
armarx::intrusive_ptr_add_ref
void intrusive_ptr_add_ref(SoTransformerManip *obj)
Definition: ManipulatorVisualization.h:42
armarx::intrusive_ptr_release
void intrusive_ptr_release(SoTransformerManip *obj)
Definition: ManipulatorVisualization.h:46
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28