control_mode.h
Go to the documentation of this file.
1 // Copyright (c) 2017 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 <ostream>
6 #include <type_traits>
7 
8 namespace franka_hw {
9 
10 enum class ControlMode {
11  None = 0,
12  JointTorque = (1 << 0),
13  JointPosition = (1 << 1),
14  JointVelocity = (1 << 2),
15  CartesianVelocity = (1 << 3),
16  CartesianPose = (1 << 4),
17 };
18 
19 std::ostream& operator<<(std::ostream& ostream, ControlMode mode);
20 
21 // Implement operators for BitmaskType concept
22 constexpr ControlMode operator&(ControlMode left, ControlMode right) {
23  return static_cast<ControlMode>(static_cast<std::underlying_type_t<ControlMode>>(left) &
24  static_cast<std::underlying_type_t<ControlMode>>(right));
25 }
26 
27 constexpr ControlMode operator|(ControlMode left, ControlMode right) {
28  return static_cast<ControlMode>(static_cast<std::underlying_type_t<ControlMode>>(left) |
29  static_cast<std::underlying_type_t<ControlMode>>(right));
30 }
31 
32 constexpr ControlMode operator^(ControlMode left, ControlMode right) {
33  return static_cast<ControlMode>(static_cast<std::underlying_type_t<ControlMode>>(left) ^
34  static_cast<std::underlying_type_t<ControlMode>>(right));
35 }
36 
38  return static_cast<ControlMode>(~static_cast<std::underlying_type_t<ControlMode>>(mode));
39 }
40 
41 constexpr ControlMode& operator&=(ControlMode& left, ControlMode right) {
42  return left = left & right;
43 }
44 
45 constexpr ControlMode& operator|=(ControlMode& left, ControlMode right) {
46  return left = left | right;
47 }
48 
49 } // namespace franka_hw
std::ostream & operator<<(std::ostream &ostream, ControlMode mode)
constexpr ControlMode operator|(ControlMode left, ControlMode right)
Definition: control_mode.h:27
constexpr ControlMode & operator&=(ControlMode &left, ControlMode right)
Definition: control_mode.h:41
constexpr ControlMode operator&(ControlMode left, ControlMode right)
Definition: control_mode.h:22
constexpr ControlMode & operator|=(ControlMode &left, ControlMode right)
Definition: control_mode.h:45
constexpr ControlMode operator^(ControlMode left, ControlMode right)
Definition: control_mode.h:32
constexpr ControlMode operator~(ControlMode mode)
Definition: control_mode.h:37


franka_hw
Author(s): Franka Emika GmbH
autogenerated on Fri Oct 23 2020 03:47:05