KukaFRIalgorithm.hpp
Go to the documentation of this file.
1 #ifndef _KUKA_FRI_ALGORITHM
2 #define _KUKA_FRI_ALGORITHM
3 
4 #include <chrono>
5 #include <stdexcept>
6 #include <algorithm>
7 
8 #include <boost/range/adaptor/copied.hpp>
9 #include <boost/range/algorithm/copy.hpp>
10 #include <boost/range/distance.hpp>
11 #include <boost/range.hpp>
12 #include <boost/geometry/core/access.hpp>
13 #include <boost/units/physical_dimensions/torque.hpp>
14 #include <boost/units/physical_dimensions/plane_angle.hpp>
15 #include <boost/units/physical_dimensions/torque.hpp>
16 #include <boost/lexical_cast.hpp>
17 #include <boost/asio.hpp>
18 #include <boost/container/static_vector.hpp>
19 
20 // Kuka include files
21 #include "friClientIf.h"
22 #include "FRIMessages.pb.h"
23 #include "friCommandMessageEncoder.h"
24 #include "friMonitoringMessageDecoder.h"
25 #include "grl/tags.hpp"
26 #include "grl/kuka/KukaNanopb.hpp"
27 #include "grl/kuka/Kuka.hpp"
28 
29 namespace grl { namespace robot {
30 
31 
32  namespace arm {
33 
34  namespace kuka {
35  // Following from Kuka example program
36  const int default_port_id = 30200;
37  struct send_period{};
39 
40  namespace detail {
41 
42  /// @todo replace with joint_iterator<tRepeatedDoubleArguments,T>()
43  template<typename T, typename OutputIterator>
44  void copyJointState(T values,OutputIterator it, bool dataAvailable = true){
45  if(dataAvailable) std::copy(static_cast<double*>(static_cast<tRepeatedDoubleArguments*>(values)->value),static_cast<double*>(static_cast<tRepeatedDoubleArguments*>(values)->value)+KUKA::LBRState::NUM_DOF,it);
46  }
47 
48  /**
49  * copies double data from a _CartesianVector to
50  * an Output iterator which is assumed to contain doubles
51  * as well, for example std::back_inserter(std::vector<double>)
52  * The wrench vector consists of:
53  * [F_x, F_y, F_z, tau_A, tau_B, tau_C]
54  *
55  * F ... forces (in N) applied along the Cartesian axes of the
56  * currently used motion center.
57  * tau ... torques (in Nm) applied along the orientation angles
58  * (Euler angles A, B, C) of the currently used motion center.
59  template<typename T, typename OutputIterator>
60  */
61  template<typename T, typename OutputIterator>
62  void copyCartesianState(T values,OutputIterator it, bool dataAvailable = true){
63  // min of element_count and 6 to prevent buffer overflow attack
64  if(dataAvailable) std::copy(&values.element[0],&values.element[0]+std::min(values.element_count,static_cast<std::size_t>(6)),it);
65  }
66 
67  /// @todo handle dataAvaliable = false case
68  /// @todo support tRepeatedIntArguments, and perhaps const versions
69  template<typename T>
70  boost::iterator_range<T> get(T& values, bool dataAvailable = true){
71  return boost::iterator_range<T>(*values);
72  }
73 
74  }
75  } // namespace kuka
76 
77 
78  /// copy measured joint angle to output iterator
79  template<typename OutputIterator>
80  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, revolute_joint_angle_open_chain_state_tag){
81  kuka::detail::copyJointState(monitoringMsg.monitorData.measuredJointPosition.value.arg,it,monitoringMsg.monitorData.has_measuredJointPosition);
82  }
83 
84  /// copy interpolated commanded joint angles
85  template<typename OutputIterator>
86  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it,revolute_joint_angle_interpolated_open_chain_state_tag){
87  kuka::detail::copyJointState(monitoringMsg.ipoData.jointPosition.value.arg,it,monitoringMsg.ipoData.has_jointPosition);
88  }
89 
90  /// copy commanded joint angle to output iterator
91  template<typename OutputIterator>
92  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, revolute_joint_angle_open_chain_command_tag){
93  kuka::detail::copyJointState(monitoringMsg.monitorData.commandedJointPosition.value.arg,it, monitoringMsg.monitorData.has_commandedJointPosition);
94  }
95 
96 
97  /// copy measured joint torque to output iterator
98  template<typename OutputIterator>
99  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, revolute_joint_torque_open_chain_state_tag){
100  kuka::detail::copyJointState(monitoringMsg.monitorData.measuredTorque.value.arg,it, monitoringMsg.monitorData.has_measuredTorque);
101  }
102 
103  /// copy measured external joint torque to output iterator
104  template<typename OutputIterator>
105  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, revolute_joint_torque_external_open_chain_state_tag){
106  kuka::detail::copyJointState(monitoringMsg.monitorData.externalTorque.value.arg,it, monitoringMsg.monitorData.has_externalTorque);
107  }
108 
109  /// copy measured external force to output iterator
110  /// note that this has a strange layout and actually contains
111  /// an array of values for cartesian space.
112  /// order is from the kuka documentation:
113  ///
114  /// The wrench vector consists of: [F_x, F_y, F_z, tau_A, tau_B, tau_C]
115  ///
116  /// F ... forces (in N) applied along the Cartesian axes of the currently used
117  /// motion center. tau ... torques (in Nm) applied along the orientation angles
118  /// (Euler angles A, B, C) of the currently used motion center.
119  template<typename OutputIterator>
120  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, cartesian_external_force_tag){
121  kuka::detail::copyCartesianState(monitoringMsg.monitorData.externalForce,it, monitoringMsg.monitorData.has_externalForce);
122  }
123 
124 
125  /// copy commanded joint torque to output iterator
126  template<typename OutputIterator>
127  void copy(const FRIMonitoringMessage& monitoringMsg, OutputIterator it, revolute_joint_torque_open_chain_command_tag){
128  kuka::detail::copyJointState(monitoringMsg.monitorData.commandedTorque.value.arg,it, monitoringMsg.monitorData.has_commandedTorque);
129  }
130 
131  /// @todo consider using another default value, or perhaps boost::optional<Kuka::FRI::ESafetyState>?
132  KUKA::FRI::ESafetyState get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::ESafetyState) {
133  KUKA::FRI::ESafetyState state = KUKA::FRI::ESafetyState::NORMAL_OPERATION;
134  if (monitoringMsg.has_robotInfo) {
135  if (monitoringMsg.robotInfo.has_safetyState)
136  return static_cast<KUKA::FRI::ESafetyState>(monitoringMsg.robotInfo.safetyState);
137  }
138  return state;
139  }
140 
141 
142  KUKA::FRI::EOperationMode get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::EOperationMode) {
143  KUKA::FRI::EOperationMode state = KUKA::FRI::EOperationMode::TEST_MODE_1;
144  if (monitoringMsg.has_robotInfo) {
145  if (monitoringMsg.robotInfo.has_operationMode)
146  state = static_cast<KUKA::FRI::EOperationMode>(monitoringMsg.robotInfo.operationMode);
147  }
148  return state;
149  }
150 
151 
152  KUKA::FRI::EControlMode get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::EControlMode) {
153  KUKA::FRI::EControlMode state = KUKA::FRI::EControlMode::NO_CONTROL;
154  if (monitoringMsg.has_robotInfo) {
155  if (monitoringMsg.robotInfo.has_controlMode)
156  state = static_cast<KUKA::FRI::EControlMode>(monitoringMsg.robotInfo.controlMode);
157  }
158  return state;
159  }
160 
161 
162  KUKA::FRI::EClientCommandMode get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::EClientCommandMode) {
163  KUKA::FRI::EClientCommandMode state = KUKA::FRI::EClientCommandMode::NO_COMMAND_MODE;
164  if (monitoringMsg.has_ipoData) {
165  if (monitoringMsg.ipoData.has_clientCommandMode)
166  state = static_cast<KUKA::FRI::EClientCommandMode>(monitoringMsg.ipoData.clientCommandMode);
167  }
168  return state;
169  }
170 
171 
172  KUKA::FRI::EOverlayType get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::EOverlayType) {
173  KUKA::FRI::EOverlayType state = KUKA::FRI::EOverlayType::NO_OVERLAY;
174  if (monitoringMsg.has_ipoData) {
175  if (monitoringMsg.ipoData.has_overlayType)
176  state = static_cast<KUKA::FRI::EOverlayType>(monitoringMsg.ipoData.overlayType);
177  }
178  return state;
179  }
180 
181 
182  KUKA::FRI::EDriveState get(const FRIMonitoringMessage& _message, const KUKA::FRI::EDriveState)
183  {
184  tRepeatedIntArguments *values =
185  (tRepeatedIntArguments *)_message.robotInfo.driveState.arg;
186  int firstState = (int)values->value[0];
187  for (int i=1; i<KUKA::LBRState::NUM_DOF; i++)
188  {
189  int state = (int)values->value[i];
190  if (state != firstState)
191  {
192  return KUKA::FRI::EDriveState::TRANSITIONING;
193  }
194  }
195  return (KUKA::FRI::EDriveState)firstState;
196  }
197 
198  KUKA::FRI::ESessionState get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::ESessionState){
199  KUKA::FRI::ESessionState KukaSessionState = KUKA::FRI::ESessionState::IDLE;
200  if (monitoringMsg.has_connectionInfo) {
201  KukaSessionState = static_cast<KUKA::FRI::ESessionState>(monitoringMsg.connectionInfo.sessionState);
202  }
203  return KukaSessionState;
204  }
205 
206  KUKA::FRI::EConnectionQuality get(const FRIMonitoringMessage& monitoringMsg, const KUKA::FRI::EConnectionQuality){
207  KUKA::FRI::EConnectionQuality KukaQuality = KUKA::FRI::EConnectionQuality::POOR;
208  if (monitoringMsg.has_connectionInfo) {
209  KukaQuality = static_cast<KUKA::FRI::EConnectionQuality>(monitoringMsg.connectionInfo.quality);
210  }
211  return KukaQuality;
212  }
213 
214  /// @brief Get FRI UDP packet time step (1-5ms) in milliseconds between each device sync
215  ///
216  /// "time step" is also known as "time duration", "milliseconds per tick", or "send period"
217  /// gets the time duration between when udp packets are expected to be sent in milliseconds
218  uint32_t get(const FRIMonitoringMessage& monitoringMsg, const grl::time_step_tag){
219  uint32_t KukaSendPeriod = 0;
220  if (monitoringMsg.has_connectionInfo) {
221  if (monitoringMsg.connectionInfo.has_sendPeriod)
222  KukaSendPeriod = monitoringMsg.connectionInfo.sendPeriod;
223  }
224  return KukaSendPeriod;
225  }
226 
227  std::size_t get(const FRIMonitoringMessage& monitoringMsg,const kuka::receive_multiplier){
228  std::size_t KukaReceiveMultiplier = 0;
229  if (monitoringMsg.has_connectionInfo) {
230  if (monitoringMsg.connectionInfo.has_receiveMultiplier)
231  KukaReceiveMultiplier = monitoringMsg.connectionInfo.receiveMultiplier;
232  }
233  return KukaReceiveMultiplier;
234  }
235 
236  std::chrono::time_point<std::chrono::high_resolution_clock> get(const FRIMonitoringMessage& monitoringMsg,const std::chrono::time_point<std::chrono::high_resolution_clock>){
237  // defaults to the epoch
238  std::chrono::time_point<std::chrono::high_resolution_clock> timestamp;
239  if (monitoringMsg.monitorData.has_timestamp) {
240  timestamp += std::chrono::seconds(monitoringMsg.monitorData.timestamp.sec) +
241  std::chrono::nanoseconds(monitoringMsg.monitorData.timestamp.nanosec);
242  }
243  return timestamp;
244  }
245 
246 
247  /**
248  * \brief Set the joint positions for the current interpolation step.
249  *
250  * This method is only effective when the client is in a commanding state.
251  * @param state Object which stores the current state of the robot, including the command to send next
252  * @param range Array with the new joint positions (in radians)
253  * @param tag identifier object indicating that revolute joint angle commands should be modified
254  */
255  template<typename Range>
256  static inline void set(FRICommandMessage & state, Range&& range, grl::revolute_joint_angle_open_chain_command_tag) {
257  if(boost::size(range))
258  {
259  state.has_commandData = true;
260  state.commandData.has_jointPosition = true;
261  tRepeatedDoubleArguments *dest = (tRepeatedDoubleArguments*)state.commandData.jointPosition.value.arg;
262  boost::copy(range, dest->value);
263  }
264  }
265 
266  /**
267  * \brief Set the applied joint torques for the current interpolation step.
268  *
269  * This method is only effective when the client is in a commanding state.
270  * The ControlMode of the robot has to be joint impedance control mode. The
271  * Client Command Mode has to be torque.
272  *
273  * @param state Object which stores the current state of the robot, including the command to send next
274  * @param torques Array with the applied torque values (in Nm)
275  * @param tag identifier object indicating that the torqe value command should be modified
276  */
277  template<typename Range>
278  static inline void set(FRICommandMessage & state, Range&& range, grl::revolute_joint_torque_open_chain_command_tag) {
279  if(boost::size(range))
280  {
281  state.has_commandData = true;
282  state.commandData.has_jointTorque = true;
283  tRepeatedDoubleArguments *dest = (tRepeatedDoubleArguments*)state.commandData.jointTorque.value.arg;
284  boost::copy(range, dest->value);
285  }
286  }
287 
288 
289  /**
290  * \brief Set the applied wrench vector of the current interpolation step.
291  *
292  * The wrench vector consists of:
293  * [F_x, F_y, F_z, tau_A, tau_B, tau_C]
294  *
295  * F ... forces (in N) applied along the Cartesian axes of the
296  * currently used motion center.
297  * tau ... torques (in Nm) applied along the orientation angles
298  * (Euler angles A, B, C) of the currently used motion center.
299  *
300  * This method is only effective when the client is in a commanding state.
301  * The ControlMode of the robot has to be Cartesian impedance control mode. The
302  * Client Command Mode has to be wrench.
303  *
304  * @param FRICommandMessage object storing the command data that will be sent to the physical device
305  * @param range wrench Applied Cartesian wrench vector, in x, y, z, roll, pitch, yaw force measurments.
306  * @param tag identifier object indicating that the wrench value command should be modified
307  *
308  * @todo perhaps support some specific more useful data layouts
309  * @note copies only the elements that will fit
310  */
311  template<typename Range>
312  static inline void set(FRICommandMessage & state, Range&& range, grl::cartesian_wrench_command_tag) {
313  if(boost::size(range))
314  {
315  state.has_commandData = true;
316  state.commandData.has_cartesianWrenchFeedForward = true;
317  std::copy_n(std::begin(range),std::min(boost::size(range),state.commandData.cartesianWrenchFeedForward.element_count), &state.commandData.cartesianWrenchFeedForward.element[0]);
318  }
319  }
320 
321 
322  /// set the left destination FRICommandMessage state to be equal to the right source FRICommandMessage state
323  static inline void set(FRICommandMessage & state, const FRICommandMessage& sourceState, grl::command_tag) {
324  state.has_commandData = sourceState.has_commandData;
325 
326  // cartesianWrench
327  state.commandData.has_cartesianWrenchFeedForward = state.commandData.has_cartesianWrenchFeedForward;
328  std::copy_n(&state.commandData.cartesianWrenchFeedForward.element[0],std::min(state.commandData.cartesianWrenchFeedForward.element_count,sourceState.commandData.cartesianWrenchFeedForward.element_count), &state.commandData.cartesianWrenchFeedForward.element[0]);
329 
330  // for joint copying
331  tRepeatedDoubleArguments *dest;
332  tRepeatedDoubleArguments *source;
333 
334 
335 
336  // jointTorque
337  state.commandData.has_jointTorque = state.commandData.has_jointTorque;
338  dest = (tRepeatedDoubleArguments*)state.commandData.jointTorque.value.arg;
339  source = (tRepeatedDoubleArguments*)sourceState.commandData.jointTorque.value.arg;
340  std::copy_n(source->value,std::min(source->size,dest->size), dest->value);
341 
342 
343  // jointPosition
344  state.commandData.has_jointPosition = state.commandData.has_jointPosition;
345  dest = (tRepeatedDoubleArguments*)state.commandData.jointPosition.value.arg;
346  source = (tRepeatedDoubleArguments*)sourceState.commandData.jointPosition.value.arg;
347  std::copy_n(source->value,std::min(source->size,dest->size), dest->value);
348 
349  }
350 
351 
352  static inline void set(FRICommandMessage & state, const FRICommandMessage& sourceState) {
353  set(state,sourceState, grl::command_tag());
354  }
355 
356 
357 }}} // namespace grl::robot::arm
358 
359 
360 
361 ///////////////////////////////////////////////////////////////////////////////
362 // Register CoordinateBase as a model of the boost::geometry point concept.
363 // Registration does not add any dependencies
364 // until the templates are instantiated.
365 // @see boost.org/libs/geometry for details
366 //
367 // include is required for macro below:
368 // #include <boost/geometry/geometries/register/point.hpp>
369 // macro unrolled and modified to create registration below:
370 // BOOST_GEOMETRY_REGISTER_POINT_2D(nrec::spatial::CoordinateBase ,nrec::spatial::CoordinateBase::value_type,cs::cartesian, operator[](0), operator[](1) )
371 ///////////////////////////////////////////////////////////////////////////////
372 namespace mpl_ {template< int N > struct int_;} // forward declaration
373 namespace boost {
374 // _MSC_VER is a workaround for MSVC2010
375 // where multiple using declarations cause
376 // multiple definition error code C2874
377 #ifdef _MSC_VER
378 namespace mpl {template< int N > struct int_;}
379 #else // _MSC_VER
380 namespace mpl { using ::mpl_::int_; }
381 #endif // _MSC_VER
382 
383 
384 namespace geometry {
385 namespace cs { struct cartesian; } // forward declaration
386 struct box_tag; // forward declaration
387 struct point_tag; // forward declaration
388 
389 namespace traits {
390  template<typename T, typename Enable> struct tag; // forward declaration
391  template<typename T, typename Enable> struct dimension; // forward declaration
392  template<typename T, typename Enable> struct coordinate_type; // forward declaration
393  template<typename T, typename Enable> struct coordinate_system; // forward declaration
394  template <typename Geometry, std::size_t Dimension, typename Enable > struct access; // forward declaration
395 
396  template<typename Enable> struct tag<FRIMonitoringMessage, Enable > { typedef grl::device_state_tag type; };
397  template<typename Enable> struct dimension<FRIMonitoringMessage, Enable > : boost::mpl::int_<KUKA::LBRState::NUM_DOF> {};
398  template<typename Enable> struct coordinate_type<FRIMonitoringMessage, Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
399 
400 
401 
402 // template<typename GeometryTag,typename Enable> struct coordinate_type<FRIMonitoringMessage, GeometryTag, Enable >;
403 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_angle_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
404 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_angle_interpolated_open_chain_state_tag, Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
405 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_torque_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
406 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_torque_external_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
407 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_angle_open_chain_command_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
408 // template<typename Enable> struct coordinate_type<FRIMonitoringMessage, revolute_joint_torque_open_chain_command_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
409 
410  template<typename Enable> struct access<FRIMonitoringMessage , KUKA::LBRState::NUM_DOF, Enable>
411  {
412  // angle
414  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_angle_open_chain_state_tag) {
415  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.monitorData.commandedJointPosition.value.arg),monitoringMsg.monitorData.has_measuredJointPosition);
416  }
417 
418  // interpolated angle
420  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_angle_interpolated_open_chain_state_tag) {
421  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.ipoData.jointPosition.value.arg), monitoringMsg.ipoData.has_jointPosition);
422  }
423 
424  // torque
426  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_torque_open_chain_state_tag) {
427  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.monitorData.measuredTorque.value.arg),monitoringMsg.monitorData.has_measuredTorque);
428  }
429 
430  // external torque
432  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_torque_external_open_chain_state_tag) {
433  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.monitorData.externalTorque.value.arg),monitoringMsg.monitorData.has_externalTorque);
434  }
435 
436  // commanded angle
438  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_angle_open_chain_command_tag) {
439  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.ipoData.jointPosition.value.arg),monitoringMsg.ipoData.has_jointPosition);
440  }
441 
442  // commanded torque
444  get(FRIMonitoringMessage const& monitoringMsg,grl::revolute_joint_torque_open_chain_command_tag) {
445  return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.monitorData.commandedTorque.value.arg), monitoringMsg.monitorData.has_commandedTorque);
446  }
447 
448  //static inline void set(nrec::spatial::Coordinate<Dim,T,U> & p, typename nrec::spatial::Coordinate<Dim,T,U>::value_type const& value) { p.operator[](Index) = value; }
449 
450 
451 
452 
453 
454 
455 
456 
457 // // angle
458 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_angle_open_chain_state_tag,Enable>::type
459 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_angle_open_chain_state_tag) {
460 // return grl::robot::arm::kuka::get(monitoringMsg.monitorData.commandedJointPosition.value.arg,monitoringMsg.monitorData.has_measuredJointPosition);
461 // }
462 //
463 // // interpolated angle
464 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_angle_interpolated_open_chain_state_tag,Enable>::type
465 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_angle_interpolated_open_chain_state_tag) {
466 // return grl::robot::arm::kuka::get(monitoringMsg.ipoData.jointPosition.value.arg, monitoringMsg.ipoData.has_jointPosition);
467 // }
468 //
469 // // torque
470 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_torque_open_chain_state_tag,Enable>::type
471 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_torque_open_chain_state_tag) {
472 // return grl::robot::arm::kuka::get(monitoringMsg.monitorData.measuredTorque.value.arg,monitoringMsg.monitorData.has_measuredTorque);
473 // }
474 //
475 // // external torque
476 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_torque_external_open_chain_state_tag,Enable>::type
477 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_torque_external_open_chain_state_tag) {
478 // return grl::robot::arm::kuka::get(monitoringMsg.monitorData.externalTorque.value.arg,monitoringMsg.monitorData.has_externalTorque);
479 // }
480 //
481 // // commanded angle
482 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_angle_open_chain_command_tag,Enable>::type
483 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_angle_open_chain_command_tag) {
484 // return grl::robot::arm::kuka::get(monitoringMsg.ipoData.jointPosition.value.arg,monitoringMsg.ipoData.has_jointPosition);
485 // }
486 //
487 // // commanded torque
488 // const typename coordinate_type<FRIMonitoringMessage,revolute_joint_torque_open_chain_command_tag,Enable>::type
489 // get(FRIMonitoringMessage const& monitoringMsg,revolute_joint_torque_open_chain_command_tag) {
490 // return grl::robot::arm::kuka::get(monitoringMsg.monitorData.commandedTorque.value.arg, monitoringMsg.monitorData.has_commandedTorque);
491 // }
492 //
493  };
494 
495 
496 
497 
498 
499 
500 
501 
502 
503 
504 
505 
506 
507 
508  template<typename Enable> struct tag<FRICommandMessage, Enable > { typedef grl::device_command_tag type; };
509  template<typename Enable> struct dimension<FRICommandMessage, Enable > : boost::mpl::int_<1> {}; // each joint is 1 dimensional
510  template<typename Enable> struct coordinate_type<FRICommandMessage, Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
511 
512 
513 
514  // template<typename GeometryTag,typename Enable> struct coordinate_type<FRICommandMessage, GeometryTag, Enable >;
515  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_angle_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
516  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_angle_interpolated_open_chain_state_tag, Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
517  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_torque_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
518  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_torque_external_open_chain_state_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
519  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_angle_open_chain_command_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
520  // template<typename Enable> struct coordinate_type<FRICommandMessage, revolute_joint_torque_open_chain_command_tag , Enable > { typedef boost::iterator_range<repeatedDoubleArguments> type; };
521 
522  template<typename Enable> struct access<FRICommandMessage , KUKA::LBRState::NUM_DOF, Enable>
523  {
524  // angle
525 // const typename coordinate_type<FRICommandMessage,Enable>::type
526 // get(FRICommandMessage const& monitoringMsg,grl::revolute_joint_angle_open_chain_state_tag) {
527 // return grl::robot::arm::kuka::detail::get(*static_cast<tRepeatedDoubleArguments*>(monitoringMsg.monitorData.commandedJointPosition.value.arg),monitoringMsg.monitorData.has_measuredJointPosition);
528 // }
529 
530  template<typename Range>
531  static inline void set(FRICommandMessage & state, Range&& range, grl::revolute_joint_angle_open_chain_command_tag) {
532  state.has_commandData = true;
533  state.commandData.has_jointPosition = true;
534  tRepeatedDoubleArguments *dest = (tRepeatedDoubleArguments*)state.commandData.jointPosition.value.arg;
535  boost::copy(range, dest->value);
536  }
537 
538 
539 
540  };
541 
542 
543 }}} // boost::geometry::traits
544 
545 
546 
547 
548 #endif
549 
external joint torque, i.e. torques applied to an arm excluding those caused by the mass of the arm i...
Definition: tags.hpp:64
OutputIterator copy(std::string model, OutputIterator it, grl::revolute_joint_velocity_open_chain_state_constraint_tag)
copy vector of joint velocity limits in radians/s
Definition: Kuka.hpp:131
Definition: Kuka.hpp:16
defines tag dispatching types used throughout grl
const int NUM_DOF
Definition: Kuka.hpp:19
data for changing a system&#39;s physical state, such as joint angles to be sent to a robot arm...
Definition: tags.hpp:35
void copyJointState(T values, OutputIterator it, bool dataAvailable=true)
void copyCartesianState(T values, OutputIterator it, bool dataAvailable=true)
boost::iterator_range< T > get(T &values, bool dataAvailable=true)
if(EXISTS "${PROJECT_DOC_DIR}/CMakeLists.txt") option(BUILD_DOCUMENTATION "Request build and/or installation of documentation." OFF) endif() if(EXISTS "$
time step between measurements
Definition: tags.hpp:24
external forces, i.e. forces applied to an arm excluding those caused by the mass of the arm itself a...
Definition: tags.hpp:67
void copy(const FRIMonitoringMessage &monitoringMsg, OutputIterator it, revolute_joint_torque_open_chain_command_tag)
copy commanded joint torque to output iterator
EClientCommandMode
Type of command being sent to the arm (Dimensonal units)