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/VirtualRobot.h>
30
32
36#include <RobotAPI/interface/units/PlatformUnitInterface.h>
38
42
43namespace armarx
44{
45
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
65 };
66
68 {
69 Eigen::Vector2f target{0, 0}; // x,y
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 */
92 NJointHolonomicPlatformGlobalPositionControllerTarget>
93 {
94 public:
95 using ConfigPtrT = NJointHolonomicPlatformGlobalPositionControllerConfigPtr;
96
98 RobotUnit* robotUnit,
99 const NJointHolonomicPlatformGlobalPositionControllerConfigPtr& cfg,
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
#define TYPEDEF_PTRS_HANDLE(T)
Brief description of class ControlTargetHolonomicPlatformVelocity.
NJointControllerWithTripleBuffer(const NJointHolonomicPlatformGlobalPositionControllerTarget &initialCommands=NJointHolonomicPlatformGlobalPositionControllerTarget())
virtual std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
void setTarget(float x, float y, float yaw, float translationAccuracy, float rotationAccuracy)
NJointHolonomicPlatformGlobalPositionController(RobotUnit *robotUnit, const NJointHolonomicPlatformGlobalPositionControllerConfigPtr &cfg, const VirtualRobot::RobotPtr &)
virtual void rtPreActivateController() override
This function is called before the controller is activated.
virtual void rtRun(const IceUtil::Time &, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
The RobotUnit class manages a robot and its controllers.
Definition RobotUnit.h:192
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
MultiDimPIDControllerTemplate<> MultiDimPIDController