SimulatedObject.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 armarx::simulation::scene_generation
17 * @author Patrick Hegemann ( patrick dot hegemann at kit dot edu )
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <optional>
25
26#include <VirtualRobot/CollisionDetection/CollisionChecker.h>
27
29
32
33#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
34
36{
43
45 {
48
49 std::optional<armarx::ObjectID> objectID;
50 };
51
52 struct ObjectSet
53 {
54 std::vector<ObjectSource> objects;
55 };
56
58 {
59 public:
60 SimulatedObject() = delete;
61
62 SimulatedObject(const std::string& instanceName, const ObjectSource& objectSource) :
63 instanceName_(instanceName), objectSource_(objectSource)
64 {
65 }
66
67 virtual void addToSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
68 virtual void updatePoseFromSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
69 virtual void updatePoseToSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
70
71 virtual bool checkCollision(const VirtualRobot::CollisionCheckerPtr& col,
72 const VirtualRobot::SceneObjectSetPtr& objectSet) = 0;
73
74 virtual std::unique_ptr<Pose> getLocalPose() = 0;
75 virtual void setLocalPose(const armarx::PosePtr& pose) = 0;
76
77 virtual ~SimulatedObject() = default;
78
79 const std::string&
81 {
82 return instanceName_;
83 }
84
85 void
86 setInstanceName(const std::string& newName)
87 {
88 instanceName_ = newName;
89 }
90
91 const ObjectSource&
93 {
94 return objectSource_;
95 }
96
97 private:
98 std::string instanceName_;
99 const ObjectSource& objectSource_;
100 };
101} // namespace armarx::simulation::scene_generation
virtual void updatePoseToSimulator(armarx::SimulatorInterfacePrx &simulator)=0
virtual void addToSimulator(armarx::SimulatorInterfacePrx &simulator)=0
SimulatedObject(const std::string &instanceName, const ObjectSource &objectSource)
virtual bool checkCollision(const VirtualRobot::CollisionCheckerPtr &col, const VirtualRobot::SceneObjectSetPtr &objectSet)=0
virtual void updatePoseFromSimulator(armarx::SimulatorInterfacePrx &simulator)=0
virtual void setLocalPose(const armarx::PosePtr &pose)=0
virtual std::unique_ptr< Pose > getLocalPose()=0
IceInternal::Handle< Pose > PosePtr
Definition Pose.h:306