mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Adding oscilloscope, fixing serial channels
This commit is contained in:
parent
fa3ffa8bc4
commit
1a5880b13e
6 changed files with 67 additions and 3 deletions
|
@ -10,7 +10,7 @@ int init_port (int baud);
|
||||||
int read_sensors(int first_measurement, float * avg_adc_channels, int * adc_channels, int * samples_averaged, int * LED_state);
|
int read_sensors(int first_measurement, float * avg_adc_channels, int * adc_channels, int * samples_averaged, int * LED_state);
|
||||||
|
|
||||||
#define NUM_CHANNELS 6
|
#define NUM_CHANNELS 6
|
||||||
#define SERIAL_PORT_NAME "/dev/tty.usbmodemfd131"
|
#define SERIAL_PORT_NAME "/dev/tty.usbmodem411"
|
||||||
|
|
||||||
// Acceleration sensors, in screen/world coord system (X = left/right, Y = Up/Down, Z = fwd/back)
|
// Acceleration sensors, in screen/world coord system (X = left/right, Y = Up/Down, Z = fwd/back)
|
||||||
#define ACCEL_X 4
|
#define ACCEL_X 4
|
||||||
|
|
30
Source/oscilloscope.cpp
Normal file
30
Source/oscilloscope.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// oscilloscope.cpp
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Philip on 1/28/13.
|
||||||
|
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "oscilloscope.h"
|
||||||
|
|
||||||
|
Oscilloscope::Oscilloscope(int w,
|
||||||
|
int h) {
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
data = new float[width];
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
data[i] = 0.0;
|
||||||
|
}
|
||||||
|
current_sample = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Oscilloscope::addData(float d) {
|
||||||
|
data[current_sample++] = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Oscilloscope::render() {
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
//glVertex2f(
|
||||||
|
glEnd();
|
||||||
|
}
|
30
Source/oscilloscope.h
Normal file
30
Source/oscilloscope.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// oscilloscope.h
|
||||||
|
// interface
|
||||||
|
//
|
||||||
|
// Created by Philip on 1/28/13.
|
||||||
|
// Copyright (c) 2013 Rosedale Lab. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __interface__oscilloscope__
|
||||||
|
#define __interface__oscilloscope__
|
||||||
|
|
||||||
|
#include "glm.hpp"
|
||||||
|
#include "util.h"
|
||||||
|
#include "world.h"
|
||||||
|
#include <GLUT/glut.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class Oscilloscope {
|
||||||
|
public:
|
||||||
|
Oscilloscope(int width,
|
||||||
|
int height);
|
||||||
|
void addData(float data);
|
||||||
|
void render();
|
||||||
|
private:
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
float * data;
|
||||||
|
int current_sample;
|
||||||
|
};
|
||||||
|
#endif /* defined(__interface__oscilloscope__) */
|
|
@ -29,8 +29,6 @@ float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float
|
||||||
return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180 / PI + render_yaw + head_yaw;
|
return atan2(head_pos.x - source_pos.x, head_pos.z - source_pos.z) * 180 / PI + render_yaw + head_yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void render_vector(glm::vec3 * vec)
|
void render_vector(glm::vec3 * vec)
|
||||||
{
|
{
|
||||||
// Show edge of world
|
// Show edge of world
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
B6BDADE415F44AC7002A07DF /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6BDADDC15F444D3002A07DF /* AudioUnit.framework */; };
|
B6BDADE415F44AC7002A07DF /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6BDADDC15F444D3002A07DF /* AudioUnit.framework */; };
|
||||||
D40BDFD513404BA300B0BE1F /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD413404BA300B0BE1F /* GLUT.framework */; };
|
D40BDFD513404BA300B0BE1F /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD413404BA300B0BE1F /* GLUT.framework */; };
|
||||||
D40BDFD713404BB300B0BE1F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD613404BB300B0BE1F /* OpenGL.framework */; };
|
D40BDFD713404BB300B0BE1F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40BDFD613404BB300B0BE1F /* OpenGL.framework */; };
|
||||||
|
D477AEAC16B7696200F3F8F6 /* oscilloscope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
@ -513,6 +514,8 @@
|
||||||
B6BDADDE15F444DB002A07DF /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
|
B6BDADDE15F444DB002A07DF /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
|
||||||
D40BDFD413404BA300B0BE1F /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = /System/Library/Frameworks/GLUT.framework; sourceTree = "<absolute>"; };
|
D40BDFD413404BA300B0BE1F /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = /System/Library/Frameworks/GLUT.framework; sourceTree = "<absolute>"; };
|
||||||
D40BDFD613404BB300B0BE1F /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
D40BDFD613404BB300B0BE1F /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
||||||
|
D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = oscilloscope.cpp; sourceTree = "<group>"; };
|
||||||
|
D477AEAB16B7696200F3F8F6 /* oscilloscope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oscilloscope.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -623,6 +626,8 @@
|
||||||
5325C24B16AF4DBE0051A40B /* texture.cpp */,
|
5325C24B16AF4DBE0051A40B /* texture.cpp */,
|
||||||
5325C24C16AF4DBE0051A40B /* texture.h */,
|
5325C24C16AF4DBE0051A40B /* texture.h */,
|
||||||
5325C24D16AF4DBE0051A40B /* util.cpp */,
|
5325C24D16AF4DBE0051A40B /* util.cpp */,
|
||||||
|
D477AEAA16B7696200F3F8F6 /* oscilloscope.cpp */,
|
||||||
|
D477AEAB16B7696200F3F8F6 /* oscilloscope.h */,
|
||||||
5325C24E16AF4DBE0051A40B /* util.h */,
|
5325C24E16AF4DBE0051A40B /* util.h */,
|
||||||
5325C24F16AF4DBE0051A40B /* world.h */,
|
5325C24F16AF4DBE0051A40B /* world.h */,
|
||||||
);
|
);
|
||||||
|
@ -1364,6 +1369,7 @@
|
||||||
5325C26016AF4DBE0051A40B /* texture.cpp in Sources */,
|
5325C26016AF4DBE0051A40B /* texture.cpp in Sources */,
|
||||||
5325C26116AF4DBE0051A40B /* util.cpp in Sources */,
|
5325C26116AF4DBE0051A40B /* util.cpp in Sources */,
|
||||||
5325C26416AF4E2C0051A40B /* audio.cpp in Sources */,
|
5325C26416AF4E2C0051A40B /* audio.cpp in Sources */,
|
||||||
|
D477AEAC16B7696200F3F8F6 /* oscilloscope.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue