Пример #1
0
DataTrace::DataTrace(YouBotJoint& youBotJoint, const std::string Name, const bool overwriteFiles) :
    joint(youBotJoint)
{
  // Bouml preserved body begin 000C8F71

  roundsPerMinuteSetpoint.rpm = 0;
  PWMSetpoint.pwm = 0;
  encoderSetpoint.encoderTicks = 0;

  InverseMovementDirection invertDirectionParameter;
  joint.getConfigurationParameter(invertDirectionParameter);
  bool inverted = false;
  invertDirectionParameter.getParameter(inverted);
  if (inverted)
  {
    invertDirection = -1;
  }
  else
  {
    invertDirection = 1;
  }

  this->name = Name;
  if (Name != "")
  {
    this->path = Name;
    this->path.append("/");
  }
  char input = 0;

  if (boost::filesystem::exists((path + "jointDataTrace").c_str()))
  {
    while (input != 'y' && input != 'n' && overwriteFiles == false)
    {
      std::cout << "Do you want to overwrite the existing files? [n/y]" << std::endl;

      input = getchar();

      if (input == 'n')
      {
        throw std::runtime_error("Will not overwrite files!");
      }
    }

  }
  else
  {
    boost::filesystem::path rootPath(this->path);

    if (!boost::filesystem::create_directories(rootPath))
      throw std::runtime_error("could not create folder!");

  }

  // Bouml preserved body end 000C8F71
}