int Mobot_moveForwardNB(mobot_t* comms, double angle)
{
  switch(comms->formFactor) {
    case MOBOTFORM_ORIGINAL:
      return Mobot_moveNB(comms, angle, 0, 0, angle);
    case MOBOTFORM_I:
      return Mobot_moveNB(comms, angle, 0, -angle, 0);
    default:
      return -1;
  }
}
int Mobot_turnRightNB(mobot_t* comms, double angle, double radius, double tracklength)
{
  double theta;
  theta = (angle*tracklength)/(2*radius);
  switch(comms->formFactor) {
    case MOBOTFORM_ORIGINAL:
      return Mobot_moveNB(comms, theta, 0, 0, -theta);
    case MOBOTFORM_I:
      return Mobot_moveNB(comms, theta, 0, theta, 0);
    default:
      return -1;
  }
}
Esempio n. 3
0
int MainWindow::moveNB (const QString& address, double angle1, double angle2, double angle3, double angle4) {
  auto it = m_connectedRobots.find(address);
  if (m_connectedRobots.end() == it) {
    return -1;
  }
  return Mobot_moveNB(it->second, angle1, angle2, angle3, angle4);
}
int Mobot_move(mobot_t* comms,
                               double angle1,
                               double angle2,
                               double angle3,
                               double angle4)
{
  Mobot_moveNB(comms, 
      angle1,
      angle2,
      angle3,
      angle4);

  /* Wait for the motion to complete */
  return Mobot_moveWait(comms);
}