PlatformSubUnit.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 RobotAPI::ArmarXObjects::PlatformSubUnit
17  * @author Raphael ( raphael dot grimm at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <mutex>
26 
27 #include <Eigen/Core>
28 
29 #include <VirtualRobot/MathTools.h>
30 
35 #include <RobotAPI/interface/core/RobotState.h>
37 
38 #include "../SensorValues/SensorValueHolonomicPlatform.h"
39 #include "RobotUnitSubUnit.h"
40 
41 namespace armarx
42 {
43  class GlobalRobotPoseCorrectionSensorDevice;
44 
45  TYPEDEF_PTRS_HANDLE(PlatformSubUnit);
46 
48  virtual public RobotUnitSubUnit,
49  virtual public PlatformUnit,
50  virtual public PlatformSubUnitInterface
51  {
52  public:
53  void update(const SensorAndControl& sc, const JointAndNJointControllers& c) override;
54 
55  // PlatformUnitInterface interface
56  void move(Ice::Float vx,
57  Ice::Float vy,
58  Ice::Float vr,
59  const Ice::Current& = Ice::emptyCurrent) override;
60  void moveTo(Ice::Float rx,
61  Ice::Float ry,
62  Ice::Float rr,
63  Ice::Float lac,
64  Ice::Float rac,
65  const Ice::Current& = Ice::emptyCurrent) override;
66  void moveRelative(Ice::Float rx,
67  Ice::Float ry,
68  Ice::Float rr,
69  Ice::Float lac,
70  Ice::Float rac,
71  const Ice::Current& = Ice::emptyCurrent) override;
72  void setMaxVelocities(Ice::Float mxVLin,
73  Ice::Float mxVAng,
74  const Ice::Current& = Ice::emptyCurrent) override;
75 
76  // PlatformUnit interface
77  void
78  onInitPlatformUnit() override
79  {
80  }
81 
82  void
84  {
85  agentName = robotStateComponent->getRobotName();
86  robotRootFrame = robotStateComponent->getSynchronizedRobot()->getRootNode()->getName();
87  }
88 
89  void
90  onExitPlatformUnit() override
91  {
92  }
93 
94  void stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override;
95 
96  NJointHolonomicPlatformVelocityControllerInterfacePtr pt;
97  NJointHolonomicPlatformRelativePositionControllerPtr relativePosCtrl;
98  NJointHolonomicPlatformGlobalPositionControllerPtr globalPosCtrl;
99 
100  std::size_t platformSensorIndex;
101 
102  protected:
103  mutable std::mutex dataMutex;
104 
105  Ice::Float maxVLin = std::numeric_limits<Ice::Float>::infinity();
106  Ice::Float maxVAng = std::numeric_limits<Ice::Float>::infinity();
107 
108 
109  private:
110  std::string agentName;
111  std::string robotRootFrame;
112  };
113 } // namespace armarx
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:918
armarx::JointAndNJointControllers
Structure used by the RobotUnit to swap lists of Joint and NJoint controllers.
Definition: JointAndNJointControllers.h:32
NJointHolonomicPlatformVelocityControllerInterface.h
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
armarx::PlatformSubUnit::platformSensorIndex
std::size_t platformSensorIndex
Definition: PlatformSubUnit.h:100
armarx::PlatformSubUnit::dataMutex
std::mutex dataMutex
Definition: PlatformSubUnit.h:103
NJointHolonomicPlatformRelativePositionController.h
Pose.h
armarx::PlatformSubUnit::moveRelative
void moveRelative(Ice::Float rx, Ice::Float ry, Ice::Float rr, Ice::Float lac, Ice::Float rac, const Ice::Current &=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:174
NJointHolonomicPlatformGlobalPositionController.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::PlatformSubUnit
Definition: PlatformSubUnit.h:47
armarx::RobotUnitSubUnit
Definition: RobotUnitSubUnit.h:35
armarx::PlatformSubUnit::maxVAng
Ice::Float maxVAng
Definition: PlatformSubUnit.h:106
armarx::PlatformSubUnit::pt
NJointHolonomicPlatformVelocityControllerInterfacePtr pt
Definition: PlatformSubUnit.h:96
armarx::PlatformSubUnit::onExitPlatformUnit
void onExitPlatformUnit() override
Definition: PlatformSubUnit.h:90
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
armarx::PlatformUnit
The PlatformUnit class.
Definition: PlatformUnit.h:70
armarx::PlatformSubUnit::setMaxVelocities
void setMaxVelocities(Ice::Float mxVLin, Ice::Float mxVAng, const Ice::Current &=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:192
armarx::PlatformSubUnit::globalPosCtrl
NJointHolonomicPlatformGlobalPositionControllerPtr globalPosCtrl
Definition: PlatformSubUnit.h:98
armarx::PlatformSubUnit::update
void update(const SensorAndControl &sc, const JointAndNJointControllers &c) override
Definition: PlatformSubUnit.cpp:38
armarx::PlatformSubUnit::stopPlatform
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:215
armarx::PlatformSubUnit::moveTo
void moveTo(Ice::Float rx, Ice::Float ry, Ice::Float rr, Ice::Float lac, Ice::Float rac, const Ice::Current &=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:159
RobotUnitSubUnit.h
armarx::PlatformSubUnit::move
void move(Ice::Float vx, Ice::Float vy, Ice::Float vr, const Ice::Current &=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:145
armarx::PlatformSubUnit::onInitPlatformUnit
void onInitPlatformUnit() override
Definition: PlatformSubUnit.h:78
armarx::PlatformUnit::robotStateComponent
RobotStateComponentInterfacePrx robotStateComponent
Definition: PlatformUnit.h:129
PlatformUnit.h
armarx::PlatformSubUnit::maxVLin
Ice::Float maxVLin
Definition: PlatformSubUnit.h:105
armarx::PlatformSubUnit::relativePosCtrl
NJointHolonomicPlatformRelativePositionControllerPtr relativePosCtrl
Definition: PlatformSubUnit.h:97
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PlatformSubUnit::onStartPlatformUnit
void onStartPlatformUnit() override
Definition: PlatformSubUnit.h:83