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 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
28 
29 namespace armarx
30 {
31  class KinematicUnitHelper;
32  using KinematicUnitHelperPtr = std::shared_ptr<KinematicUnitHelper>;
33 
35  {
36  public:
37  KinematicUnitHelper(const KinematicUnitInterfacePrx& kinUnit);
38 
42  static NameControlModeMap MakeControlModes(const NameValueMap& jointValues, ControlMode controlMode);
43  static std::string ControlModeToString(ControlMode controlMode)
44  {
45  std::string state;
46  switch (controlMode)
47  {
48  case eDisabled:
49  state = "Disabled";
50  break;
51 
52  case eUnknown:
53  state = "Unknown";
54  break;
55 
56  case ePositionControl:
57  state = "Position";
58  break;
59 
60  case eVelocityControl:
61  state = "Velocity";
62  break;
63 
64  case eTorqueControl:
65  state = "Torque";
66  break;
67 
68 
69  case ePositionVelocityControl:
70  state = "Position + Velocity";
71  break;
72 
73  default:
74  //show the value of the mode so it can be implemented
75  state = std::string("nyi Mode: " + std::to_string(controlMode));
76  break;
77  }
78  return state;
79  }
80  private:
81  KinematicUnitInterfacePrx kinUnit;
82  };
83 }
armarx::KinematicUnitHelper::setJointTorques
void setJointTorques(const NameValueMap &jointTorques)
Definition: KinematicUnitHelper.cpp:45
armarx::KinematicUnitHelperPtr
std::shared_ptr< KinematicUnitHelper > KinematicUnitHelperPtr
Definition: KinematicUnitHelper.h:32
armarx::KinematicUnitHelper
Definition: KinematicUnitHelper.h:34
armarx::KinematicUnitHelper::setJointVelocities
void setJointVelocities(const NameValueMap &jointVelocities)
Definition: KinematicUnitHelper.cpp:39
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:51
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:91
armarx::channels::KinematicUnitObserver::jointAngles
const KinematicUnitDatafieldCreator jointAngles("jointAngles")
armarx::KinematicUnitHelper::setJointAngles
void setJointAngles(const NameValueMap &jointAngles)
Definition: KinematicUnitHelper.cpp:33
armarx::KinematicUnitHelper::ControlModeToString
static std::string ControlModeToString(ControlMode controlMode)
Definition: KinematicUnitHelper.h:43
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:28