control_tools.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Franka Emika GmbH
2 // Use of this source code is governed by the Apache-2.0 license, see LICENSE
3 #pragma once
4 
5 #include <array>
6 #include <cmath>
7 
13 namespace franka {
14 
22 inline bool isValidElbow(const std::array<double, 2>& elbow) noexcept {
23  return elbow[1] == -1.0 || elbow[1] == 1.0;
24 }
25 
33 inline bool isHomogeneousTransformation(const std::array<double, 16>& transform) noexcept {
34  constexpr double kOrthonormalThreshold = 1e-5;
35 
36  if (transform[3] != 0.0 || transform[7] != 0.0 || transform[11] != 0.0 || transform[15] != 1.0) {
37  return false;
38  }
39  for (size_t j = 0; j < 3; ++j) { // i..column
40  if (std::abs(std::sqrt(std::pow(transform[j * 4 + 0], 2) + std::pow(transform[j * 4 + 1], 2) +
41  std::pow(transform[j * 4 + 2], 2)) -
42  1.0) > kOrthonormalThreshold) {
43  return false;
44  }
45  }
46  for (size_t i = 0; i < 3; ++i) { // j..row
47  if (std::abs(std::sqrt(std::pow(transform[0 * 4 + i], 2) + std::pow(transform[1 * 4 + i], 2) +
48  std::pow(transform[2 * 4 + i], 2)) -
49  1.0) > kOrthonormalThreshold) {
50  return false;
51  }
52  }
53  return true;
54 }
55 
64 bool hasRealtimeKernel();
65 
74 bool setCurrentThreadToHighestSchedulerPriority(std::string* error_message);
75 
76 } // namespace franka
bool isHomogeneousTransformation(const std::array< double, 16 > &transform) noexcept
Determines whether the given array represents a valid homogeneous transformation matrix.
Definition: control_tools.h:33
bool setCurrentThreadToHighestSchedulerPriority(std::string *error_message)
Sets the current thread to the highest possible scheduler priority.
bool isValidElbow(const std::array< double, 2 > &elbow) noexcept
Determines whether the given elbow configuration is valid or not.
Definition: control_tools.h:22
bool hasRealtimeKernel()
Determines whether the current OS kernel is a realtime kernel.


libfranka
Author(s): Franka Emika GmbH
autogenerated on Tue Jul 9 2019 03:32:01