Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //xbox 360 kinect accelorometer
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <termios.h>
- #include <fcntl.h>
- #include <libfreenect.h>
- #include <libfreenect_sync.h>
- //gcc -Wall -g -o "%e" "%f" -lfreenect -lfreenect_sync
- double xThresh, yThersh, zThresh =0.0;
- void no_kinect_quit(void){
- printf("Error: Kinect not connected?\n");
- exit(1);
- }
- int main(){
- freenect_sync_set_led(4, 0);
- while (1) {
- freenect_raw_tilt_state *state = 0;
- double dx, dy, dz;
- // Get the raw accelerometer values and tilt data
- if (freenect_sync_get_tilt_state(&state, 0)) no_kinect_quit();
- // Get the processed accelerometer values (calibrated to gravity)
- freenect_get_mks_accel(state, &dx, &dy, &dz);
- printf("accel[%lf,%lf,%lf]\n",dx,dy,dz);
- sleep(3);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement