Skip to content
Snippets Groups Projects
Select Git revision
  • 74c4fc1ee3d83644e4c7da2153faf89a5da1fa95
  • develop default protected
  • feature/tube-grasp-eef
  • master
  • simulated_grasping
  • simulation
  • 0.6.0
  • 0.5.0
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.2
  • 0.1.1
  • 0.1.0
17 results

control_mode.cpp

Blame
  • control_mode.cpp 1.17 KiB
    // Copyright (c) 2017 Franka Emika GmbH
    // Use of this source code is governed by the Apache-2.0 license, see LICENSE
    #include <franka_hw/control_mode.h>
    
    #include <algorithm>
    #include <iterator>
    #include <string>
    #include <vector>
    
    namespace franka_hw {
    
    std::ostream& operator<<(std::ostream& ostream, ControlMode mode) {
      if (mode == ControlMode::None) {
        ostream << "<none>";
      } else {
        std::vector<std::string> names;
        if ((mode & ControlMode::JointTorque) != ControlMode::None) {
          names.emplace_back("JointTorque");
        }
        if ((mode & ControlMode::JointPosition) != ControlMode::None) {
          names.emplace_back("JointPosition");
        }
        if ((mode & ControlMode::JointVelocity) != ControlMode::None) {
          names.emplace_back("JointVelocity");
        }
        if ((mode & ControlMode::CartesianVelocity) != ControlMode::None) {
          names.emplace_back("CartesianVelocity");
        }
        if ((mode & ControlMode::CartesianPose) != ControlMode::None) {
          names.emplace_back("CartesianPose");
        }
        std::copy(names.cbegin(), names.cend() - 1, std::ostream_iterator<std::string>(ostream, ", "));
        ostream << names.back();
      }
      return ostream;
    }
    
    }  // namespace franka_hw