diff --git a/Source/Audio.cpp b/Source/Audio.cpp index a790b04139..a2f19fec7d 100644 --- a/Source/Audio.cpp +++ b/Source/Audio.cpp @@ -28,6 +28,9 @@ const int ECHO_SERVER_TEST = 1; const int AUDIO_UDP_LISTEN_PORT = 55444; +char WORKCLUB_AUDIO_SERVER[] = "192.168.1.19"; +char EC2_WEST_AUDIO_SERVER[] = "54.241.92.53"; + pthread_mutex_t jitterMutex; #define LOG_SAMPLE_DELAY 1 @@ -71,7 +74,7 @@ int audioCallback (const void *inputBuffer, // int16_t *inputRight = ((int16_t **) inputBuffer)[1]; if (inputLeft != NULL) { - data->audioSocket->send((char *) "192.168.1.19", 55443, (void *)inputLeft, BUFFER_LENGTH_BYTES); + data->audioSocket->send((char *) EC2_WEST_AUDIO_SERVER, 55443, (void *)inputLeft, BUFFER_LENGTH_BYTES); } int16_t *outputLeft = ((int16_t **) outputBuffer)[0]; diff --git a/Source/Head.cpp b/Source/Head.cpp index 77c3054d90..4b799ada25 100644 --- a/Source/Head.cpp +++ b/Source/Head.cpp @@ -69,18 +69,18 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea float measured_roll_rate = serialInterface->getRelativeValue(ROLL_RATE); // Update avatar head position based on measured gyro rates - const float HEAD_ROTATION_SCALE = 0.20; - const float HEAD_ROLL_SCALE = 0.50; - const float HEAD_LEAN_SCALE = 0.02; + const float HEAD_ROTATION_SCALE = 0.80; + const float HEAD_ROLL_SCALE = 0.80; + const float HEAD_LEAN_SCALE = 0.01; if (head_mirror) { - addYaw(measured_yaw_rate * HEAD_ROTATION_SCALE * frametime); + addYaw(-measured_yaw_rate * HEAD_ROTATION_SCALE * frametime); addPitch(measured_pitch_rate * -HEAD_ROTATION_SCALE * frametime); - addRoll(measured_roll_rate * HEAD_ROLL_SCALE * frametime); - addLean(measured_lateral_accel * frametime * HEAD_LEAN_SCALE, measured_fwd_accel*frametime * HEAD_LEAN_SCALE); + addRoll(-measured_roll_rate * HEAD_ROLL_SCALE * frametime); + addLean(-measured_lateral_accel * frametime * HEAD_LEAN_SCALE, -measured_fwd_accel*frametime * HEAD_LEAN_SCALE); } else { addYaw(measured_yaw_rate * -HEAD_ROTATION_SCALE * frametime); addPitch(measured_pitch_rate * -HEAD_ROTATION_SCALE * frametime); - addRoll(measured_roll_rate * HEAD_ROLL_SCALE * frametime); + addRoll(-measured_roll_rate * HEAD_ROLL_SCALE * frametime); addLean(measured_lateral_accel * frametime * -HEAD_LEAN_SCALE, measured_fwd_accel*frametime * HEAD_LEAN_SCALE); } } diff --git a/Source/SerialInterface.cpp b/Source/SerialInterface.cpp index 755e97082b..3037cbf1b1 100644 --- a/Source/SerialInterface.cpp +++ b/Source/SerialInterface.cpp @@ -22,6 +22,8 @@ char serial_buffer[MAX_BUFFER]; int serial_buffer_pos = 0; int samples_total = 0; +const int ZERO_OFFSET = 2048; + // Init the serial port to the specified values int SerialInterface::init(char * portname, int baud) { @@ -79,6 +81,7 @@ void SerialInterface::renderLevels(int width, int height) { char val[10]; for(i = 0; i < NUM_CHANNELS; i++) { + // Actual value glLineWidth(2.0); glColor4f(1, 1, 1, 1); @@ -93,12 +96,14 @@ void SerialInterface::renderLevels(int width, int height) { glVertex2f(disp_x + 2, height*(0.25 + 0.75f*getTrailingValue(i)/4096)); glEnd(); + /* glColor3f(1,0,0); glBegin(GL_LINES); - glLineWidth(2.0); - glVertex2f(disp_x - 10, height*0.5 - getRelativeValue(i)); - glVertex2f(disp_x + 10, height*0.5 - getRelativeValue(i)); + glLineWidth(4.0); + glVertex2f(disp_x - 10, height*0.5 - getValue(i)/4096); + glVertex2f(disp_x + 10, height*0.5 - getValue(i)/4096); glEnd(); + */ sprintf(val, "%d", getValue(i)); drawtext(disp_x-GAP/2, (height*0.95)+2, 0.08, 90, 1.0, 0, val, 0, 1, 0); @@ -120,7 +125,7 @@ void SerialInterface::renderLevels(int width, int height) { void SerialInterface::readData() { // This array sets the rate of trailing averaging for each channel. // If the sensor rate is 100Hz, 0.001 will make the long term average a 10-second average - const float AVG_RATE[] = {0.001, 0.001, 0.001, 0.001, 0.001, 0.001}; + const float AVG_RATE[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01}; char bufchar[1]; while (read(serial_fd, bufchar, 1) > 0) { diff --git a/Source/SerialInterface.h b/Source/SerialInterface.h index 39070d344e..82d35f85d7 100644 --- a/Source/SerialInterface.h +++ b/Source/SerialInterface.h @@ -20,13 +20,13 @@ #define NUM_CHANNELS 6 // Acceleration sensors, in screen/world coord system (X = left/right, Y = Up/Down, Z = fwd/back) -#define ACCEL_X 4 -#define ACCEL_Y 5 -#define ACCEL_Z 3 +#define ACCEL_X 3 +#define ACCEL_Y 4 +#define ACCEL_Z 5 // Gyro sensors, in coodinate system of head/airplane -#define PITCH_RATE 0 -#define YAW_RATE 1 +#define PITCH_RATE 1 +#define YAW_RATE 0 #define ROLL_RATE 2 class SerialInterface { diff --git a/Source/hardware/head_hand/head_hand.pde b/Source/hardware/head_hand/head_hand.pde index 6cec667fd6..844f352e56 100644 --- a/Source/hardware/head_hand/head_hand.pde +++ b/Source/hardware/head_hand/head_hand.pde @@ -5,8 +5,8 @@ // // PIN WIRING: Connect input sensors to the channels in following manner // -// AIN 15: Pitch Gyro (nodding your head 'yes') -// AIN 16: Yaw Gyro (shaking your head 'no') +// AIN 10: Yaw Gyro (shaking your head 'no') +// AIN 16: Pitch Gyro (nodding your head 'yes') // AIN 17: Roll Gyro (looking quizzical, tilting your head) // AIN 18: Lateral acceleration (moving from side-to-side in front of your monitor) // AIN 19: Up/Down acceleration (sitting up/ducking in front of your monitor) @@ -17,7 +17,7 @@ #define LED_PIN 12 -int inputPins[NUM_CHANNELS] = {15,16,17,18,19,20}; +int inputPins[NUM_CHANNELS] = {10,16,17,18,19,20}; int LED = 0; unsigned int samplesSent = 0;