KinematicUnitHelper.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5 * Karlsruhe Institute of Technology (KIT), all rights reserved.
6 *
7 * ArmarX is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
20 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23
24#pragma once
25
26#include <memory>
27
28#include <RobotAPI/interface/units/KinematicUnitInterface.h>
29
30namespace armarx
31{
33 using KinematicUnitHelperPtr = std::shared_ptr<KinematicUnitHelper>;
34
36 {
37 public:
38 KinematicUnitHelper(const KinematicUnitInterfacePrx& kinUnit);
39
40 void setJointAngles(const NameValueMap& jointAngles);
41 void setJointVelocities(const NameValueMap& jointVelocities);
42 void setJointTorques(const NameValueMap& jointTorques);
43 static NameControlModeMap MakeControlModes(const NameValueMap& jointValues,
44 ControlMode controlMode);
45
46 static std::string
47 ControlModeToString(ControlMode controlMode)
48 {
49 std::string state;
50 switch (controlMode)
51 {
52 case eDisabled:
53 state = "Disabled";
54 break;
55
56 case eUnknown:
57 state = "Unknown";
58 break;
59
60 case ePositionControl:
61 state = "Position";
62 break;
63
64 case eVelocityControl:
65 state = "Velocity";
66 break;
67
68 case eTorqueControl:
69 state = "Torque";
70 break;
71
72
73 case ePositionVelocityControl:
74 state = "Position + Velocity";
75 break;
76
77 default:
78 //show the value of the mode so it can be implemented
79 state = std::string("nyi Mode: " + std::to_string(controlMode));
80 break;
81 }
82 return state;
83 }
84
85 private:
86 KinematicUnitInterfacePrx kinUnit;
87 };
88} // namespace armarx
static std::string ControlModeToString(ControlMode controlMode)
void setJointAngles(const NameValueMap &jointAngles)
void setJointTorques(const NameValueMap &jointTorques)
static NameControlModeMap MakeControlModes(const NameValueMap &jointValues, ControlMode controlMode)
KinematicUnitHelper(const KinematicUnitInterfacePrx &kinUnit)
void setJointVelocities(const NameValueMap &jointVelocities)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< KinematicUnitHelper > KinematicUnitHelperPtr