Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package armar7_rt
* @author Tobias Gröger ( tobias dot groeger at student dot kit dot edu )
* @date 2023
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include <RobotAPI/components/units/RobotUnit/ControlTargets/ControlTarget1DoFActuator.h>
#include <RobotAPI/components/units/RobotUnit/NJointControllers/NJointController.h>
#include <RobotAPI/components/units/RobotUnit/RobotUnit.h>
namespace armarx
{
struct Params
{
std::string kneeJointName;
std::string hipJointName;
std::string hipBodyName;
};
struct Config
{
Params params;
float kneeAngle;
float bowAngle;
};
TYPEDEF_PTRS_HANDLE(NJointKneeHipControllerConfig);
class NJointKneeHipControllerConfig : virtual public armarx::NJointControllerConfig
{
public:
std::string deviceName1;
std::string deviceName;
std::string controlMode;
};
TYPEDEF_PTRS_HANDLE(NJointKneeHipController);
class NJointKneeHipController :
virtual public armarx::NJointControllerWithTripleBuffer<Config>
{
public:
using ConfigPtrT = NJointKneeHipControllerConfigPtr;
NJointKneeHipController(RobotUnit* robotUnit,
const armarx::NJointControllerConfigPtr& config,
const VirtualRobot::RobotPtr& /* unused */);
~NJointKneeHipController() override;
// void updateConfig(const ::armarx::aron::data::dto::DictPtr& dto,
// const Ice::Current& iceCurrent = Ice::emptyCurrent) ;
protected:
//
// NJointControllerInterface interface
//
void onInitNJointController() override;
void onConnectNJointController() override;
std::string getClassName(const Ice::Current& = Ice::emptyCurrent) const override;
void rtRun(const IceUtil::Time& sensorValuesTimestamp,
const IceUtil::Time& timeSinceLastIteration) override;
void rtPreActivateController() override;
void rtPostDeactivateController() override;
// ----------------
private:
// rt variables
VirtualRobot::RobotPtr _rtRobot;
VirtualRobot::RobotNodePtr _rtKneeNode;
VirtualRobot::RobotNodePtr _rtHipNode;
VirtualRobot::RobotNodePtr _rtHipBodyNode;
armarx::ControlTarget1DoFActuatorPosition* _rtKneeCtrlTarget;
armarx::ControlTarget1DoFActuatorPosition* _rtHipCtrlTarget;
};
} // namespace armarx