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 
30 namespace armarx
31 {
32  class KinematicUnitHelper;
33  using KinematicUnitHelperPtr = std::shared_ptr<KinematicUnitHelper>;
34 
36  {
37  public:
38  KinematicUnitHelper(const KinematicUnitInterfacePrx& kinUnit);
39 
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
armarx::KinematicUnitHelper::setJointTorques
void setJointTorques(const NameValueMap &jointTorques)
Definition: KinematicUnitHelper.cpp:48
armarx::KinematicUnitHelperPtr
std::shared_ptr< KinematicUnitHelper > KinematicUnitHelperPtr
Definition: KinematicUnitHelper.h:33
armarx::KinematicUnitHelper
Definition: KinematicUnitHelper.h:35
armarx::KinematicUnitHelper::setJointVelocities
void setJointVelocities(const NameValueMap &jointVelocities)
Definition: KinematicUnitHelper.cpp:41
armarx::channels::KinematicUnitObserver::jointVelocities
const KinematicUnitDatafieldCreator jointVelocities("jointVelocities")
armarx::KinematicUnitHelper::KinematicUnitHelper
KinematicUnitHelper(const KinematicUnitInterfacePrx &kinUnit)
Definition: KinematicUnitHelper.cpp:28
armarx::KinematicUnitHelper::MakeControlModes
static NameControlModeMap MakeControlModes(const NameValueMap &jointValues, ControlMode controlMode)
Definition: KinematicUnitHelper.cpp:55
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:41
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:88
armarx::channels::KinematicUnitObserver::jointAngles
const KinematicUnitDatafieldCreator jointAngles("jointAngles")
armarx::KinematicUnitHelper::setJointAngles
void setJointAngles(const NameValueMap &jointAngles)
Definition: KinematicUnitHelper.cpp:34
armarx::KinematicUnitHelper::ControlModeToString
static std::string ControlModeToString(ControlMode controlMode)
Definition: KinematicUnitHelper.h:47
armarx::channels::KinematicUnitObserver::jointTorques
const KinematicUnitDatafieldCreator jointTorques("jointTorques")
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27