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/manips/SoTransformerManip.h>
27#include <Inventor/nodes/SoMaterial.h>
28#include <Inventor/nodes/SoSeparator.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
37namespace 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
43 inline void
44 intrusive_ptr_add_ref(SoTransformerManip* obj)
45 {
46 obj->ref();
47 }
48
49 inline void
50 intrusive_ptr_release(SoTransformerManip* obj)
51 {
52 obj->unref();
53 }
54
55 class ManipulatorVisualization : SoSeparator
56 {
57 public:
60
61 void setVisualization(VirtualRobot::EndEffectorPtr endEffector);
63
64 void setColor(float r, float g, float b);
65
66 Eigen::Matrix4f getUserDesiredPose();
67 std::string getUserDesiredPoseString();
68 void setUserDesiredPose(Eigen::Matrix4f globalPose);
69
70 bool
72 {
73 return isVisualizing;
74 }
75
76 private:
78 SoMaterial* material;
79 bool isVisualizing;
80 bool hasEndEffectorVisualizer;
81 Eigen::Matrix4f localTransformation;
82 };
83} // namespace armarx
void setUserDesiredPose(Eigen::Matrix4f globalPose)
void setVisualization(VirtualRobot::EndEffectorPtr endEffector)
void setColor(float r, float g, float b)
This file offers overloads of toIce() and fromIce() functions for STL container types.
void intrusive_ptr_release(SoTransformerManip *obj)
void intrusive_ptr_add_ref(SoTransformerManip *obj)
boost::intrusive_ptr< SoTransformerManip > SoTransformerManipPtr