NJointHolonomicPlatformGlobalPositionController.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2017, 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 ArmarX
19  * @author Markus Grotz (markus.grotz at kit dot edu)
20  * @date 2019
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 
27 #include <atomic>
28 
29 #include <VirtualRobot/Robot.h>
30 
32 
36 #include <RobotAPI/interface/units/PlatformUnitInterface.h>
38 
39 #include "../ControlTargets/ControlTarget1DoFActuator.h"
40 #include "../SensorValues/SensorValueHolonomicPlatform.h"
42 
43 namespace armarx
44 {
45 
46  TYPEDEF_PTRS_HANDLE(NJointHolonomicPlatformGlobalPositionControllerConfig);
47 
49  virtual public NJointControllerConfig
50  {
51  public:
52  std::string platformName;
53  float p = 1.0f;
54  float i = 0.0f;
55  float d = 0.0f;
56  float maxVelocity = 400;
57  float maxAcceleration = 300;
58 
59  float p_rot = 0.8f;
60  float i_rot = 0.0f;
61  float d_rot = 0.0f;
62 
63  float maxRotationVelocity = 1.0;
65  };
66 
68  {
69  Eigen::Vector2f target{0, 0}; // x,y
70  float targetOrientation = 0;
71  float translationAccuracy = 0.0f;
72  float rotationAccuracy = 0.0f;
73  bool newTargetSet = false;
74 
75  // Eigen::Vector2f startPosition;
76  // float startOrientation;
77 
78  // Eigen::Vector2f globalPosition;
79  // float globalOrientation;
80 
81  IceUtil::Time lastUpdate = IceUtil::Time::seconds(0);
82  };
83 
85 
86  /**
87  * @brief The NJointHolonomicPlatformGlobalPositionController class
88  * @ingroup Library-RobotUnit-NJointControllers
89  */
91  virtual public NJointControllerWithTripleBuffer<
92  NJointHolonomicPlatformGlobalPositionControllerTarget>
93  {
94  public:
95  using ConfigPtrT = NJointHolonomicPlatformGlobalPositionControllerConfigPtr;
96 
98  RobotUnit* robotUnit,
99  const NJointHolonomicPlatformGlobalPositionControllerConfigPtr& cfg,
100  const VirtualRobot::RobotPtr&);
101 
102  inline virtual void rtRun(const IceUtil::Time&,
103  const IceUtil::Time& timeSinceLastIteration) override;
104  inline virtual void rtPreActivateController() override;
105 
106  //ice interface
107  inline virtual std::string
108  getClassName(const Ice::Current& = Ice::emptyCurrent) const override
109  {
110  return "NJointHolonomicPlatformGlobalPositionController";
111  }
112 
113  void
114  setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy);
115 
116  protected:
120 
122 
123  bool isTargetSet = false;
124  };
125 } // namespace armarx
armarx::SensorValueGlobalRobotPose
Definition: GlobalRobotPoseSensorDevice.h:41
armarx::ControlTargetHolonomicPlatformVelocity
Brief description of class ControlTargetHolonomicPlatformVelocity.
Definition: ControlTargetHolonomicPlatformVelocity.h:38
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget
Definition: NJointHolonomicPlatformGlobalPositionController.h:67
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::newTargetSet
bool newTargetSet
Definition: NJointHolonomicPlatformGlobalPositionController.h:73
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::d_rot
float d_rot
Definition: NJointHolonomicPlatformGlobalPositionController.h:61
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig
Definition: NJointHolonomicPlatformGlobalPositionController.h:48
NJointControllerWithTripleBuffer.h
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
armarx::NJointControllerWithTripleBuffer
Definition: NJointControllerWithTripleBuffer.h:10
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::p
float p
Definition: NJointHolonomicPlatformGlobalPositionController.h:53
armarx::NJointHolonomicPlatformGlobalPositionController::isTargetSet
bool isTargetSet
Definition: NJointHolonomicPlatformGlobalPositionController.h:123
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::lastUpdate
IceUtil::Time lastUpdate
Definition: NJointHolonomicPlatformGlobalPositionController.h:81
armarx::MultiDimPIDControllerTemplate<>
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::i
float i
Definition: NJointHolonomicPlatformGlobalPositionController.h:54
armarx::NJointHolonomicPlatformGlobalPositionController::setTarget
void setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy)
Definition: NJointHolonomicPlatformGlobalPositionController.cpp:150
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::targetOrientation
float targetOrientation
Definition: NJointHolonomicPlatformGlobalPositionController.h:70
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::rotationAccuracy
float rotationAccuracy
Definition: NJointHolonomicPlatformGlobalPositionController.h:72
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::maxAcceleration
float maxAcceleration
Definition: NJointHolonomicPlatformGlobalPositionController.h:57
BasicControllers.h
armarx::NJointHolonomicPlatformGlobalPositionController::opid
PIDController opid
Definition: NJointHolonomicPlatformGlobalPositionController.h:119
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::p_rot
float p_rot
Definition: NJointHolonomicPlatformGlobalPositionController.h:59
armarx::PIDController
Definition: PIDController.h:43
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::d
float d
Definition: NJointHolonomicPlatformGlobalPositionController.h:55
armarx::NJointHolonomicPlatformGlobalPositionController::getClassName
virtual std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
Definition: NJointHolonomicPlatformGlobalPositionController.h:108
armarx::NJointHolonomicPlatformGlobalPositionController::sv
const GlobalRobotLocalizationSensorDevice::SensorValueType * sv
Definition: NJointHolonomicPlatformGlobalPositionController.h:117
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::maxRotationVelocity
float maxRotationVelocity
Definition: NJointHolonomicPlatformGlobalPositionController.h:63
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::NJointHolonomicPlatformGlobalPositionController
The NJointHolonomicPlatformGlobalPositionController class.
Definition: NJointHolonomicPlatformGlobalPositionController.h:90
armarx::NJointHolonomicPlatformGlobalPositionController::target
ControlTargetHolonomicPlatformVelocity * target
Definition: NJointHolonomicPlatformGlobalPositionController.h:121
ExpressionException.h
PIDController.h
ControlTargetHolonomicPlatformVelocity.h
armarx::NJointHolonomicPlatformGlobalPositionController::NJointHolonomicPlatformGlobalPositionController
NJointHolonomicPlatformGlobalPositionController(RobotUnit *robotUnit, const NJointHolonomicPlatformGlobalPositionControllerConfigPtr &cfg, const VirtualRobot::RobotPtr &)
Definition: NJointHolonomicPlatformGlobalPositionController.cpp:44
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::maxRotationAcceleration
float maxRotationAcceleration
Definition: NJointHolonomicPlatformGlobalPositionController.h:64
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::target
Eigen::Vector2f target
Definition: NJointHolonomicPlatformGlobalPositionController.h:69
GlobalRobotPoseSensorDevice.h
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::maxVelocity
float maxVelocity
Definition: NJointHolonomicPlatformGlobalPositionController.h:56
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::platformName
std::string platformName
Definition: NJointHolonomicPlatformGlobalPositionController.h:52
armarx::NJointHolonomicPlatformGlobalPositionController::pid
MultiDimPIDController pid
Definition: NJointHolonomicPlatformGlobalPositionController.h:118
armarx::NJointHolonomicPlatformGlobalPositionController::rtRun
virtual void rtRun(const IceUtil::Time &, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: NJointHolonomicPlatformGlobalPositionController.cpp:71
armarx::NJointHolonomicPlatformGlobalPositionController::rtPreActivateController
virtual void rtPreActivateController() override
This function is called before the controller is activated.
Definition: NJointHolonomicPlatformGlobalPositionController.cpp:142
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::NJointHolonomicPlatformGlobalPositionControllerConfig::i_rot
float i_rot
Definition: NJointHolonomicPlatformGlobalPositionController.h:60
armarx::NJointHolonomicPlatformGlobalPositionControllerTarget::translationAccuracy
float translationAccuracy
Definition: NJointHolonomicPlatformGlobalPositionController.h:71
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18