void Camera::moveKeyboard()
{
	// you may change key controls for the interactive
	// camera controls here, make sure you document your changes
	// in your README file

	if (Fl::event_key('w'))
		moveForward(+0.05);
	if (Fl::event_key('s'))
		moveForward(-0.05);
	if (Fl::event_key('a'))
		moveSideways(-0.05);
	if (Fl::event_key('d'))
		moveSideways(+0.05);
	if (Fl::event_key(FL_Up))
		moveVertical(+0.05);
	if (Fl::event_key(FL_Down))
		moveVertical(-0.05);
	if (Fl::event_key(FL_Left))
		rotateYaw(+0.05);
	if (Fl::event_key(FL_Right))
		rotateYaw(-0.05);
	if (Fl::event_key(FL_Page_Up))
		rotatePitch(+0.05);
	if (Fl::event_key(FL_Page_Down))
		rotatePitch(-0.05);
}
Beispiel #2
0
/**
 * Yaw carefree mode means yaw will stay in world coordinates. So even though
 * the Crazyflie rotates around the yaw, front will stay the same as when it started.
 * This makes makes it a bit easier for beginners
 */
static void rotateYawCarefree(setpoint_t *setpoint, const state_t *state, bool reset)
{
  static float carefreeFrontAngle;

  if (reset) {
    carefreeFrontAngle = state->attitude.yaw;
  }

  float yawRad = (state->attitude.yaw - carefreeFrontAngle) * (float)M_PI / 180;
  rotateYaw(setpoint, yawRad);
}
Beispiel #3
0
static void yawModeUpdate(setpoint_t *setpoint, const state_t *state)
{
  switch (yawMode)
  {
    case CAREFREE:
      rotateYawCarefree(setpoint, state, carefreeResetFront);
      break;
    case PLUSMODE:
      rotateYaw(setpoint, 45 * M_PI / 180);
      break;
    case XMODE: // Fall through
    default:
      // Default in x-mode. Do nothing
      break;
  }
}
/**
 * Update Yaw according to current setting
 */
static void yawModeUpdate(setpoint_t *setpoint)
{
  switch (yawMode)
  {
    case CAREFREE:
      // TODO: Add frame of reference to setpoint
      ASSERT(false);
      break;
    case PLUSMODE:
      rotateYaw(setpoint, 45 * M_PI / 180);
      break;
    case XMODE: // Fall through
    default:
      // Default in x-mode. Do nothing
      break;
  }
}