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 
33 #include <RobotAPI/interface/core/RobotState.h>
35 
36 #include "../SensorValues/SensorValueHolonomicPlatform.h"
37 #include "RobotUnitSubUnit.h"
38 
39 namespace armarx
40 {
41  class GlobalRobotPoseCorrectionSensorDevice;
42 
43  TYPEDEF_PTRS_HANDLE(PlatformSubUnit);
44 
46  virtual public RobotUnitSubUnit,
47  virtual public PlatformUnit,
48  virtual public PlatformSubUnitInterface
49  {
50  public:
51  void update(const SensorAndControl& sc, const JointAndNJointControllers& c) override;
52 
53  // PlatformUnitInterface interface
54  void move(Ice::Float vx,
55  Ice::Float vy,
56  Ice::Float vr,
57  const Ice::Current& = Ice::emptyCurrent) override;
58  void moveTo(Ice::Float rx,
59  Ice::Float ry,
60  Ice::Float rr,
61  Ice::Float lac,
62  Ice::Float rac,
63  const Ice::Current& = Ice::emptyCurrent) override;
64  void moveRelative(Ice::Float rx,
65  Ice::Float ry,
66  Ice::Float rr,
67  Ice::Float lac,
68  Ice::Float rac,
69  const Ice::Current& = Ice::emptyCurrent) override;
70  void setMaxVelocities(Ice::Float mxVLin,
71  Ice::Float mxVAng,
72  const Ice::Current& = Ice::emptyCurrent) override;
73 
74  // PlatformUnit interface
75  void
76  onInitPlatformUnit() override
77  {
78  }
79 
80  void
82  {
83  agentName = robotStateComponent->getRobotName();
84  robotRootFrame = robotStateComponent->getSynchronizedRobot()->getRootNode()->getName();
85  }
86 
87  void
88  onExitPlatformUnit() override
89  {
90  }
91 
92  void stopPlatform(const Ice::Current& c = Ice::emptyCurrent) override;
93 
94  NJointHolonomicPlatformVelocityControllerInterfacePtr pt;
95  NJointHolonomicPlatformRelativePositionControllerPtr relativePosCtrl;
96  NJointHolonomicPlatformGlobalPositionControllerPtr globalPosCtrl;
97 
98  std::size_t platformSensorIndex;
99 
100  protected:
101  mutable std::mutex dataMutex;
102 
103  Ice::Float maxVLin = std::numeric_limits<Ice::Float>::infinity();
104  Ice::Float maxVAng = std::numeric_limits<Ice::Float>::infinity();
105 
106 
107  private:
108  std::string agentName;
109  std::string robotRootFrame;
110  };
111 } // namespace armarx
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
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:98
armarx::PlatformSubUnit::dataMutex
std::mutex dataMutex
Definition: PlatformSubUnit.h:101
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:175
NJointHolonomicPlatformGlobalPositionController.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::PlatformSubUnit
Definition: PlatformSubUnit.h:45
armarx::RobotUnitSubUnit
Definition: RobotUnitSubUnit.h:35
armarx::PlatformSubUnit::maxVAng
Ice::Float maxVAng
Definition: PlatformSubUnit.h:104
armarx::PlatformSubUnit::pt
NJointHolonomicPlatformVelocityControllerInterfacePtr pt
Definition: PlatformSubUnit.h:94
armarx::PlatformSubUnit::onExitPlatformUnit
void onExitPlatformUnit() override
Definition: PlatformSubUnit.h:88
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:182
armarx::PlatformUnit
The PlatformUnit class.
Definition: PlatformUnit.h:69
armarx::PlatformSubUnit::setMaxVelocities
void setMaxVelocities(Ice::Float mxVLin, Ice::Float mxVAng, const Ice::Current &=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:193
armarx::PlatformSubUnit::globalPosCtrl
NJointHolonomicPlatformGlobalPositionControllerPtr globalPosCtrl
Definition: PlatformSubUnit.h:96
armarx::PlatformSubUnit::update
void update(const SensorAndControl &sc, const JointAndNJointControllers &c) override
Definition: PlatformSubUnit.cpp:39
armarx::PlatformSubUnit::stopPlatform
void stopPlatform(const Ice::Current &c=Ice::emptyCurrent) override
Definition: PlatformSubUnit.cpp:216
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:160
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:146
armarx::PlatformSubUnit::onInitPlatformUnit
void onInitPlatformUnit() override
Definition: PlatformSubUnit.h:76
armarx::PlatformUnit::robotStateComponent
RobotStateComponentInterfacePrx robotStateComponent
Definition: PlatformUnit.h:139
PlatformUnit.h
armarx::PlatformSubUnit::maxVLin
Ice::Float maxVLin
Definition: PlatformSubUnit.h:103
armarx::PlatformSubUnit::relativePosCtrl
NJointHolonomicPlatformRelativePositionControllerPtr relativePosCtrl
Definition: PlatformSubUnit.h:95
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::PlatformSubUnit::onStartPlatformUnit
void onStartPlatformUnit() override
Definition: PlatformSubUnit.h:81