Beispiel #1
0
void MainWindow::mousePressEvent ( QMouseEvent * event ) {
  if ((event->x() >= 8) && (event->y() >= 8) && (event->x() <= (600)) && (event->y() <= 600)) {
      double mapX = abs(300 - event->x());
      double mapY = 300 - event->y();

      if ((300 - event->x()) < 0)
          setTargetDir(currRotorIndex,90-atan(mapY/mapX)*(180/PI));
      else
          setTargetDir(currRotorIndex,270+atan(mapY/mapX)*(180/PI));
  }
}
Beispiel #2
0
void Robot::spinAroundDribbler(bool reverse, float period, float radius, float forwardSpeed) {
  float speed = (2.0f * Math::PI * radius) / period;
  float omega = (2.0f * Math::PI) / period;

  if (reverse) {
    speed *= -1.0f;
    omega *= -1.0f;
  }

  setTargetDir(forwardSpeed, -speed, omega);
}
Beispiel #3
0
void Robot::stop() {
  //std::cout << "! Stopping robot" << std::endl;

  setTargetDir(0, 0, 0);
  dribbler->stop();
}
Beispiel #4
0
void Robot::setTargetDir(const Math::Angle &dir, float speed, float omega) {
  Math::Vector dirVector = Math::Vector::createForwardVec(dir.rad(), speed);

  setTargetDir(dirVector.x, dirVector.y, omega);
}
Beispiel #5
0
void MainWindow::pushButtonRotateCCWPressed() {
  //We don't have any way to control the webswitch CW/CCW so we just do like this instead
  setTargetDir(currRotorIndex,0);
}