Skip to content
Snippets Groups Projects
Select Git revision
  • 91b8e505220b824c3c51acfa4c8de6951d5c8925
  • master default protected
  • restructure-2021
  • ae-submission
  • journal-diagrams
  • artifact-evaluation
  • artifact-evaluation-poster
  • ci
8 results

make_readme.sh

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