SPYSpheres
ZRGameInternal.cpp File Reference
#include <string.h>
#include <math.h>
#include "ZRGame.h"
#include "ZRGameInternal.h"
#include "ZR_API_internal.h"
#include "ZR_API.h"
#include "Constants.h"
#include "commands.h"
#include "system.h"
#include "math_matrix.h"
#include "gsp.h"
#include "control.h"
#include "find_state_error.h"
#include "housekeeping_internal.h"

Go to the source code of this file.

Functions

ZeroRoboticsGameImplgetGameImpl ()
void swingTwistDecomposition (float q[4], float q_sw[4], float q_tw[4], float tw_axis[3])
void quatToPositive (float quat[4])

Variables

state_vector initStateZR = {0.4,-0.6,0, 0,0,0, 0.7071,-0.7071,0,0, 0,0,0}
 This file is used to define the C++ implementation of both the public and the private game API functions.

Function Documentation

Definition at line 60 of file ZRGameInternal.cpp.

void quatToPositive ( float  quat[4])

Definition at line 223 of file ZRGameInternal.cpp.

                                   {
    if (quat[3] < 0) {
      for (int i = 0; i < 4; i++) {
        quat[4] *= -1;
      }
    }
}
void swingTwistDecomposition ( float  q[4],
float  q_sw[4],
float  q_tw[4],
float  tw_axis[3] 
)

Definition at line 201 of file ZRGameInternal.cpp.

                                   {
  
  // p = dot(q[0:2], tw_axis) * tw_axis
  // q_tw = [p[0], p[1], p[2], q[3]]
  float c = mathVecInner(q, tw_axis, 3);
  for (int i = 0; i < 3; i++) {
    q_tw[i]= tw_axis[i] * c;    
  }
  q_tw[3] = q[3];
  mathVecNormalize(q_tw, 4);
  
  // invert twist quaternion
  float q_tw_inv[4];
  memcpy(q_tw_inv, q_tw, 4*sizeof(float));  
  for (int i = 0; i < 3; i++) {
    q_tw_inv[i] *= -1.0f;
  }
    
  quatMult(q_sw, q_tw_inv, q);
}

Variable Documentation

state_vector initStateZR = {0.4,-0.6,0, 0,0,0, 0.7071,-0.7071,0,0, 0,0,0}

This file is used to define the C++ implementation of both the public and the private game API functions.

Public functions will be prefixed with ZeroRoboticsGame:: while private implementation functions will be prefixed with ZeroRoboticsGameImpl:: Use these vectors to choose the satellites state when the user is given control.

Definition at line 32 of file ZRGameInternal.cpp.