PlatformUnitSimulation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-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 ArmarXCore::units
19  * @author Christian Boege (boege dot at kit dot edu)
20  * @date 2011
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include "PlatformUnit.h"
28 
32 #include <RobotAPI/interface/core/RobotState.h>
33 
34 #include <IceUtil/Time.h>
35 
36 #include <string>
37 
38 namespace armarx
39 {
40  /**
41  * \class PlatformUnitSimulation
42  * \brief Simulates a robot platform.
43  * \ingroup RobotAPI-SensorActorUnits-simulation
44  */
46  virtual public PlatformUnit
47  {
48  public:
49  // inherited from Component
50  std::string getDefaultName() const override
51  {
52  return "PlatformUnitSimulation";
53  }
54 
55  void onInitPlatformUnit() override;
56  void onStartPlatformUnit() override;
57  void onStopPlatformUnit() override;
58  void onExitPlatformUnit() override;
59 
60  void simulationFunction();
61 
62  // proxy implementation
63  void moveTo(Ice::Float targetPlatformPositionX, Ice::Float targetPlatformPositionY, Ice::Float targetPlatformRotation, Ice::Float positionalAccuracy, Ice::Float orientationalAccuracy, const Ice::Current& c = Ice::emptyCurrent) override;
64 
65  /**
66  * \warning Not yet implemented!
67  */
68  void move(float targetPlatformVelocityX, float targetPlatformVelocityY, float targetPlatformVelocityRotation, const Ice::Current& c = Ice::emptyCurrent) override;
69 
70  void moveRelative(float targetPlatformOffsetX, float targetPlatformOffsetY, float targetPlatformOffsetRotation, float positionalAccuracy, float orientationalAccuracy, const Ice::Current& c = Ice::emptyCurrent) override;
71  void setMaxVelocities(float positionalVelocity, float orientaionalVelocity, const Ice::Current& c = Ice::emptyCurrent) override;
72  void stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override;
73  /**
74  * \see PropertyUser::createPropertyDefinitions()
75  */
77 
78  protected:
79  std::mutex currentPoseMutex;
82 
84  {
88  }
90 
97 
103 
106 
107  std::string referenceFrame;
109  Eigen::Vector2f currentTranslationVelocity = Eigen::Vector2f::Zero();
110 
112 
113 
114  private:
115  Eigen::Matrix4f currentPlatformPose() const;
116 
117  RobotStateComponentInterfacePrx robotStateComponent;
118 
119  std::string agentName;
120  std::string robotRootFrame;
121 
122 
123  };
124 }
125 
armarx::PlatformUnitSimulation::intervalMs
int intervalMs
Definition: PlatformUnitSimulation.h:81
armarx::PlatformUnitSimulation::currentRotation
::Ice::Float currentRotation
Definition: PlatformUnitSimulation.h:96
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:918
armarx::PlatformUnitSimulation::targetRotation
::Ice::Float targetRotation
Definition: PlatformUnitSimulation.h:95
armarx::PlatformUnitSimulation::linearVelocityY
::Ice::Float linearVelocityY
Definition: PlatformUnitSimulation.h:99
armarx::PlatformUnitSimulation::eVelocityControl
@ eVelocityControl
Definition: PlatformUnitSimulation.h:87
armarx::PlatformUnitSimulation::velPID
MultiDimPIDControllerPtr velPID
Definition: PlatformUnitSimulation.h:108
armarx::PlatformUnitSimulation::onExitPlatformUnit
void onExitPlatformUnit() override
Definition: PlatformUnitSimulation.cpp:118
armarx::PlatformUnitSimulation::currentTranslationVelocity
Eigen::Vector2f currentTranslationVelocity
Definition: PlatformUnitSimulation.h:109
armarx::PlatformUnitSimulation::angularVelocity
::Ice::Float angularVelocity
Definition: PlatformUnitSimulation.h:101
PeriodicTask.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::PlatformUnitSimulation::platformMode
enum armarx::PlatformUnitSimulation::PlatformMode platformMode
armarx::PlatformUnitSimulation::maxLinearVelocity
::Ice::Float maxLinearVelocity
Definition: PlatformUnitSimulation.h:100
armarx::PlatformUnit
The PlatformUnit class.
Definition: PlatformUnit.h:70
armarx::PlatformUnitSimulation::currentPositionY
::Ice::Float currentPositionY
Definition: PlatformUnitSimulation.h:94
armarx::PlatformUnitSimulation::moveTo
void moveTo(Ice::Float targetPlatformPositionX, Ice::Float targetPlatformPositionY, Ice::Float targetPlatformRotation, Ice::Float positionalAccuracy, Ice::Float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnitSimulation.cpp:247
armarx::PlatformUnitSimulation::PlatformMode
PlatformMode
Definition: PlatformUnitSimulation.h:83
armarx::MultiDimPIDControllerPtr
std::shared_ptr< MultiDimPIDControllerTemplate<> > MultiDimPIDControllerPtr
Definition: MultiDimPIDController.h:251
armarx::PlatformUnitSimulation::currentPositionX
::Ice::Float currentPositionX
Definition: PlatformUnitSimulation.h:93
armarx::PlatformUnitSimulation::linearVelocityX
::Ice::Float linearVelocityX
Definition: PlatformUnitSimulation.h:98
armarx::PlatformUnitSimulation::targetPositionX
::Ice::Float targetPositionX
Definition: PlatformUnitSimulation.h:91
armarx::PlatformUnitSimulation::onInitPlatformUnit
void onInitPlatformUnit() override
Definition: PlatformUnitSimulation.cpp:63
armarx::PlatformUnitSimulation::ePositionControl
@ ePositionControl
Definition: PlatformUnitSimulation.h:86
armarx::PlatformUnitSimulation
Simulates a robot platform.
Definition: PlatformUnitSimulation.h:45
armarx::PlatformUnitSimulation::positionalAccuracy
::Ice::Float positionalAccuracy
Definition: PlatformUnitSimulation.h:104
armarx::PlatformUnitSimulation::simulationTask
PeriodicTask< PlatformUnitSimulation >::pointer_type simulationTask
Definition: PlatformUnitSimulation.h:111
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::PlatformUnitSimulation::orientationalAccuracy
::Ice::Float orientationalAccuracy
Definition: PlatformUnitSimulation.h:105
armarx::PlatformUnitSimulation::targetPositionY
::Ice::Float targetPositionY
Definition: PlatformUnitSimulation.h:92
PIDController.h
armarx::PlatformUnitSimulation::move
void move(float targetPlatformVelocityX, float targetPlatformVelocityY, float targetPlatformVelocityRotation, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnitSimulation.cpp:271
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::PlatformUnitSimulation::currentPoseMutex
std::mutex currentPoseMutex
Definition: PlatformUnitSimulation.h:79
armarx::PlatformUnitSimulation::lastExecutionTime
IceUtil::Time lastExecutionTime
Definition: PlatformUnitSimulation.h:80
PlatformUnit.h
armarx::PlatformUnitSimulation::eUndefined
@ eUndefined
Definition: PlatformUnitSimulation.h:85
IceUtil::Handle
Definition: forward_declarations.h:29
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::PlatformUnitSimulation::maxAngularVelocity
::Ice::Float maxAngularVelocity
Definition: PlatformUnitSimulation.h:102
armarx::PlatformUnitSimulation::posPID
MultiDimPIDControllerPtr posPID
Definition: PlatformUnitSimulation.h:108
armarx::PlatformUnitSimulation::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PlatformUnitSimulation.h:50
armarx::PlatformUnitSimulation::onStartPlatformUnit
void onStartPlatformUnit() override
Definition: PlatformUnitSimulation.cpp:92
armarx::PlatformUnitSimulation::stopPlatform
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnitSimulation.cpp:301
armarx::PlatformUnitSimulation::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlatformUnitSimulation.cpp:43
armarx::PlatformUnitSimulation::simulationFunction
void simulationFunction()
Definition: PlatformUnitSimulation.cpp:126
armarx::PlatformUnitSimulation::moveRelative
void moveRelative(float targetPlatformOffsetX, float targetPlatformOffsetY, float targetPlatformOffsetRotation, float positionalAccuracy, float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnitSimulation.cpp:282
armarx::PlatformUnitSimulation::onStopPlatformUnit
void onStopPlatformUnit() override
Definition: PlatformUnitSimulation.cpp:109
armarx::PlatformUnitSimulation::referenceFrame
std::string referenceFrame
Definition: PlatformUnitSimulation.h:107
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PlatformUnitSimulation::setMaxVelocities
void setMaxVelocities(float positionalVelocity, float orientaionalVelocity, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformUnitSimulation.cpp:294
ImportExportComponent.h