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 <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
27 
30 
32 
33 #include <VirtualRobot/CollisionDetection/CollisionChecker.h>
34 
36 {
38  {
42  };
43 
44  struct ObjectSource
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  SimulatedObject(const std::string& instanceName, const ObjectSource& objectSource) :
62  instanceName_(instanceName),
63  objectSource_(objectSource)
64  {}
65 
66  virtual void addToSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
67  virtual void updatePoseFromSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
68  virtual void updatePoseToSimulator(armarx::SimulatorInterfacePrx& simulator) = 0;
69 
70  virtual bool checkCollision(const VirtualRobot::CollisionCheckerPtr& col,
71  const VirtualRobot::SceneObjectSetPtr& objectSet) = 0;
72 
73  virtual std::unique_ptr<Pose> getLocalPose() = 0;
74  virtual void setLocalPose(const armarx::PosePtr& pose) = 0;
75 
76  virtual ~SimulatedObject() = default;
77 
78  const std::string& getInstanceName()
79  {
80  return instanceName_;
81  }
82 
83  void setInstanceName(const std::string& newName)
84  {
85  instanceName_ = newName;
86  }
87 
89  {
90  return objectSource_;
91  }
92 
93  private:
94  std::string instanceName_;
95  const ObjectSource& objectSource_;
96  };
97 } // namespace armarx::simulation::scene_generation
armarx::simulation::scene_generation::ObjectSource
Definition: SimulatedObject.h:44
armarx::simulation::scene_generation::SimulatedObject::~SimulatedObject
virtual ~SimulatedObject()=default
armarx::simulation::scene_generation::SimulatedObject::getObjectSource
const ObjectSource & getObjectSource()
Definition: SimulatedObject.h:88
armarx::simulation::scene_generation::SimulatedObjectType
SimulatedObjectType
Definition: SimulatedObject.h:37
Pose.h
armarx::simulation::scene_generation::ObjectSet::objects
std::vector< ObjectSource > objects
Definition: SimulatedObject.h:54
armarx::simulation::scene_generation
Definition: ClutteredSceneGenerator.cpp:48
armarx::simulation::scene_generation::AsObject
@ AsObject
Definition: SimulatedObject.h:39
armarx::simulation::scene_generation::SimulatedObject::setInstanceName
void setInstanceName(const std::string &newName)
Definition: SimulatedObject.h:83
armarx::simulation::scene_generation::SimulatedObject::checkCollision
virtual bool checkCollision(const VirtualRobot::CollisionCheckerPtr &col, const VirtualRobot::SceneObjectSetPtr &objectSet)=0
armarx::simulation::scene_generation::ObjectSource::objectID
std::optional< armarx::ObjectID > objectID
Definition: SimulatedObject.h:49
armarx::simulation::scene_generation::ObjectSet
Definition: SimulatedObject.h:52
IceInternal::Handle< Pose >
armarx::simulation::scene_generation::ObjectSource::path
armarx::PackagePath path
Definition: SimulatedObject.h:46
armarx::simulation::scene_generation::SimulatedObject::addToSimulator
virtual void addToSimulator(armarx::SimulatorInterfacePrx &simulator)=0
armarx::simulation::scene_generation::SimulatedObject::getInstanceName
const std::string & getInstanceName()
Definition: SimulatedObject.h:78
armarx::simulation::scene_generation::ObjectSource::type
SimulatedObjectType type
Definition: SimulatedObject.h:47
armarx::simulation::scene_generation::SimulatedObject::setLocalPose
virtual void setLocalPose(const armarx::PosePtr &pose)=0
armarx::simulation::scene_generation::SimulatedObject::SimulatedObject
SimulatedObject()=delete
ObjectID.h
armarx::simulation::scene_generation::AsRobot
@ AsRobot
Definition: SimulatedObject.h:40
armarx::simulation::scene_generation::SimulatedObject::updatePoseToSimulator
virtual void updatePoseToSimulator(armarx::SimulatorInterfacePrx &simulator)=0
armarx::simulation::scene_generation::SimulatedObject::getLocalPose
virtual std::unique_ptr< Pose > getLocalPose()=0
armarx::simulation::scene_generation::SimulatedObject::SimulatedObject
SimulatedObject(const std::string &instanceName, const ObjectSource &objectSource)
Definition: SimulatedObject.h:61
armarx::PackagePath
Definition: PackagePath.h:55
armarx::simulation::scene_generation::SimulatedObject
Definition: SimulatedObject.h:57
armarx::simulation::scene_generation::SimulatedObject::updatePoseFromSimulator
virtual void updatePoseFromSimulator(armarx::SimulatorInterfacePrx &simulator)=0
armarx::simulation::scene_generation::Automatic
@ Automatic
Definition: SimulatedObject.h:41
PackagePath.h