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 <string>
28
29#include <IceUtil/Time.h>
30
33
34#include <RobotAPI/interface/core/RobotState.h>
36
37#include "PlatformUnit.h"
38
39namespace armarx
40{
41 /**
42 * \class PlatformUnitSimulation
43 * \brief Simulates a robot platform.
44 * \ingroup RobotAPI-SensorActorUnits-simulation
45 */
46 class PlatformUnitSimulation : virtual public PlatformUnit
47 {
48 public:
49 // inherited from Component
50 std::string
51 getDefaultName() const override
52 {
53 return "PlatformUnitSimulation";
54 }
55
56 void onInitPlatformUnit() override;
57 void onStartPlatformUnit() override;
58 void onStopPlatformUnit() override;
59 void onExitPlatformUnit() override;
60
61 void simulationFunction();
62
63 // proxy implementation
64 void moveTo(Ice::Float targetPlatformPositionX,
65 Ice::Float targetPlatformPositionY,
66 Ice::Float targetPlatformRotation,
67 Ice::Float positionalAccuracy,
68 Ice::Float orientationalAccuracy,
69 const Ice::Current& c = Ice::emptyCurrent) override;
70
71 /**
72 * \warning Not yet implemented!
73 */
74 void move(float targetPlatformVelocityX,
75 float targetPlatformVelocityY,
76 float targetPlatformVelocityRotation,
77 const Ice::Current& c = Ice::emptyCurrent) override;
78
79 void moveRelative(float targetPlatformOffsetX,
80 float targetPlatformOffsetY,
81 float targetPlatformOffsetRotation,
84 const Ice::Current& c = Ice::emptyCurrent) override;
85 void setMaxVelocities(float positionalVelocity,
86 float orientaionalVelocity,
87 const Ice::Current& c = Ice::emptyCurrent) override;
88 void stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override;
89 /**
90 * \see PropertyUser::createPropertyDefinitions()
91 */
93
94 protected:
95 std::mutex currentPoseMutex;
96 IceUtil::Time lastExecutionTime;
98
105
106 ::Ice::Float targetPositionX;
107 ::Ice::Float targetPositionY;
108 ::Ice::Float currentPositionX;
109 ::Ice::Float currentPositionY;
110 ::Ice::Float targetRotation;
111 ::Ice::Float currentRotation;
112
113 ::Ice::Float linearVelocityX;
114 ::Ice::Float linearVelocityY;
115 ::Ice::Float maxLinearVelocity;
116 ::Ice::Float angularVelocity;
117 ::Ice::Float maxAngularVelocity;
118
119 ::Ice::Float positionalAccuracy;
121
122 std::string referenceFrame;
124 Eigen::Vector2f currentTranslationVelocity = Eigen::Vector2f::Zero();
125
127
128
129 private:
130 Eigen::Matrix4f currentPlatformPose() const;
131
132 RobotStateComponentInterfacePrx robotStateComponent;
133
134 std::string agentName;
135 std::string robotRootFrame;
136 };
137} // namespace armarx
constexpr T c
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
Simulates a robot platform.
void setMaxVelocities(float positionalVelocity, float orientaionalVelocity, const Ice::Current &c=Ice::emptyCurrent) override
void moveTo(Ice::Float targetPlatformPositionX, Ice::Float targetPlatformPositionY, Ice::Float targetPlatformRotation, Ice::Float positionalAccuracy, Ice::Float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent) override
enum armarx::PlatformUnitSimulation::PlatformMode platformMode
PropertyDefinitionsPtr createPropertyDefinitions() override
void move(float targetPlatformVelocityX, float targetPlatformVelocityY, float targetPlatformVelocityRotation, const Ice::Current &c=Ice::emptyCurrent) override
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
PeriodicTask< PlatformUnitSimulation >::pointer_type simulationTask
void moveRelative(float targetPlatformOffsetX, float targetPlatformOffsetY, float targetPlatformOffsetRotation, float positionalAccuracy, float orientationalAccuracy, const Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
The PlatformUnit class.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
std::shared_ptr< MultiDimPIDControllerTemplate<> > MultiDimPIDControllerPtr
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx