NJointHolonomicPlatformRelativePositionController.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 Mirko Waechter( mirko.waechter at kit dot edu)
20  * @date 2017
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 
37 #include "../ControlTargets/ControlTarget1DoFActuator.h"
38 #include "../SensorValues/SensorValueHolonomicPlatform.h"
40 
41 namespace armarx
42 {
43 
44  TYPEDEF_PTRS_HANDLE(NJointHolonomicPlatformRelativePositionControllerConfig);
45 
47  virtual public NJointControllerConfig
48  {
49  public:
50  std::string platformName;
51  float p = 1.0f;
52  float i = 0.0f;
53  float d = 0.0f;
54  float maxVelocity = 300;
55  float maxAcceleration = 500;
56  float maxRotationVelocity = 0.5;
58  // float rad2MMFactor = 50.0f;
59  };
60 
62  {
63  Eigen::Vector2f target{0, 0}; // x,y
64  float targetOrientation = 0;
65  float translationAccuracy = 0.0f;
66  float rotationAccuracy = 0.0f;
67  bool newTargetSet = false;
68  };
69 
71 
72  /**
73  * @brief The NJointHolonomicPlatformRelativePositionController class
74  * @ingroup Library-RobotUnit-NJointControllers
75  */
77  virtual public NJointControllerWithTripleBuffer<
78  NJointHolonomicPlatformRelativePositionControllerTarget>
79  {
80  public:
81  using ConfigPtrT = NJointHolonomicPlatformRelativePositionControllerConfigPtr;
82 
84  RobotUnit* robotUnit,
85  const NJointHolonomicPlatformRelativePositionControllerConfigPtr& cfg,
86  const VirtualRobot::RobotPtr&);
87 
88  inline virtual void rtRun(const IceUtil::Time&,
89  const IceUtil::Time& timeSinceLastIteration) override;
90  inline virtual void rtPreActivateController() override;
91 
92  //ice interface
93  inline virtual std::string
94  getClassName(const Ice::Current& = Ice::emptyCurrent) const override
95  {
96  return "NJointHolonomicPlatformRelativePositionController";
97  }
98 
99  void
100  setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy);
101 
102 
103  protected:
108  Eigen::Vector2f startPosition{0, 0}, currentPosition{0, 0};
111  // float rad2MMFactor;
112  };
113 } // namespace armarx
armarx::ControlTargetHolonomicPlatformVelocity
Brief description of class ControlTargetHolonomicPlatformVelocity.
Definition: ControlTargetHolonomicPlatformVelocity.h:38
armarx::NJointHolonomicPlatformRelativePositionControllerTarget
Definition: NJointHolonomicPlatformRelativePositionController.h:61
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::maxRotationVelocity
float maxRotationVelocity
Definition: NJointHolonomicPlatformRelativePositionController.h:56
armarx::NJointHolonomicPlatformRelativePositionController::setTarget
void setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy)
Definition: NJointHolonomicPlatformRelativePositionController.cpp:128
armarx::SensorValueHolonomicPlatform
Definition: SensorValueHolonomicPlatform.h:128
NJointControllerWithTripleBuffer.h
armarx::NJointHolonomicPlatformRelativePositionControllerTarget::target
Eigen::Vector2f target
Definition: NJointHolonomicPlatformRelativePositionController.h:63
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
armarx::NJointControllerWithTripleBuffer
Definition: NJointControllerWithTripleBuffer.h:10
armarx::PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition
Definition: BasicControllers.h:447
armarx::NJointHolonomicPlatformRelativePositionControllerConfig
Definition: NJointHolonomicPlatformRelativePositionController.h:46
armarx::MultiDimPIDControllerTemplate<>
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::maxRotationAcceleration
float maxRotationAcceleration
Definition: NJointHolonomicPlatformRelativePositionController.h:57
armarx::NJointHolonomicPlatformRelativePositionController::getClassName
virtual std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
Definition: NJointHolonomicPlatformRelativePositionController.h:94
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::maxAcceleration
float maxAcceleration
Definition: NJointHolonomicPlatformRelativePositionController.h:55
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::i
float i
Definition: NJointHolonomicPlatformRelativePositionController.h:52
armarx::NJointHolonomicPlatformRelativePositionController
The NJointHolonomicPlatformRelativePositionController class.
Definition: NJointHolonomicPlatformRelativePositionController.h:76
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::platformName
std::string platformName
Definition: NJointHolonomicPlatformRelativePositionController.h:50
armarx::NJointHolonomicPlatformRelativePositionController::startOrientation
float startOrientation
Definition: NJointHolonomicPlatformRelativePositionController.h:109
armarx::NJointHolonomicPlatformRelativePositionControllerTarget::newTargetSet
bool newTargetSet
Definition: NJointHolonomicPlatformRelativePositionController.h:67
armarx::NJointHolonomicPlatformRelativePositionController::pid
MultiDimPIDController pid
Definition: NJointHolonomicPlatformRelativePositionController.h:105
BasicControllers.h
armarx::NJointHolonomicPlatformRelativePositionControllerTarget::rotationAccuracy
float rotationAccuracy
Definition: NJointHolonomicPlatformRelativePositionController.h:66
armarx::NJointHolonomicPlatformRelativePositionController::rtRun
virtual void rtRun(const IceUtil::Time &, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: NJointHolonomicPlatformRelativePositionController.cpp:64
armarx::NJointHolonomicPlatformRelativePositionController::sv
const SensorValueHolonomicPlatform * sv
Definition: NJointHolonomicPlatformRelativePositionController.h:104
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::p
float p
Definition: NJointHolonomicPlatformRelativePositionController.h:51
armarx::NJointHolonomicPlatformRelativePositionController::oriCtrl
PositionThroughVelocityControllerWithAccelerationBoundsAndPeriodicPosition oriCtrl
Definition: NJointHolonomicPlatformRelativePositionController.h:106
armarx::NJointHolonomicPlatformRelativePositionController::startPosition
Eigen::Vector2f startPosition
Definition: NJointHolonomicPlatformRelativePositionController.h:108
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::maxVelocity
float maxVelocity
Definition: NJointHolonomicPlatformRelativePositionController.h:54
armarx::NJointHolonomicPlatformRelativePositionController::NJointHolonomicPlatformRelativePositionController
NJointHolonomicPlatformRelativePositionController(RobotUnit *robotUnit, const NJointHolonomicPlatformRelativePositionControllerConfigPtr &cfg, const VirtualRobot::RobotPtr &)
Definition: NJointHolonomicPlatformRelativePositionController.cpp:37
armarx::NJointHolonomicPlatformRelativePositionController::currentPosition
Eigen::Vector2f currentPosition
Definition: NJointHolonomicPlatformRelativePositionController.h:108
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
ExpressionException.h
PIDController.h
ControlTargetHolonomicPlatformVelocity.h
armarx::NJointHolonomicPlatformRelativePositionController::rtPreActivateController
virtual void rtPreActivateController() override
This function is called before the controller is activated.
Definition: NJointHolonomicPlatformRelativePositionController.cpp:120
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
armarx::NJointHolonomicPlatformRelativePositionController::target
ControlTargetHolonomicPlatformVelocity * target
Definition: NJointHolonomicPlatformRelativePositionController.h:107
armarx::NJointHolonomicPlatformRelativePositionControllerTarget::translationAccuracy
float translationAccuracy
Definition: NJointHolonomicPlatformRelativePositionController.h:65
armarx::NJointHolonomicPlatformRelativePositionController::currentOrientation
float currentOrientation
Definition: NJointHolonomicPlatformRelativePositionController.h:110
armarx::NJointHolonomicPlatformRelativePositionControllerTarget::targetOrientation
float targetOrientation
Definition: NJointHolonomicPlatformRelativePositionController.h:64
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::NJointHolonomicPlatformRelativePositionControllerConfig::d
float d
Definition: NJointHolonomicPlatformRelativePositionController.h:53