Commit 9ec415cc authored by 15김건우's avatar 15김건우

update bt_datea

parent df57354a
......@@ -4,7 +4,7 @@
all:
@$(MAKE) -C ../../ARDroneLib/Soft/Build USE_LINUX=yes
@$(MAKE) -C Navigation/Build USE_LINUX=yes
@$(MAKE) -C custom_test/Build USE_LINUX=yes
@$(MAKE) -C drone_control/Build USE_LINUX=yes
@$(MAKE) -C bt_test/Build USE_LINUX=yes
@$(MAKE) -C sdk_demo/Build USE_LINUX=yes
@$(MAKE) -C video_demo/Build USE_LINUX=yes
......@@ -14,7 +14,7 @@ all:
$(MAKECMDGOALS):
@$(MAKE) -C ../../ARDroneLib/Soft/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C Navigation/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C custom_test/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C drone_control/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C bt_test/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C sdk_demo/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE) -C video_demo/Build USE_LINUX=yes $(MAKECMDGOALS)
......
......@@ -20,11 +20,25 @@
#include "bt_connect.h"
char bt_data[2048];
bt_data_t bt_data = {0};
float32_t uint2float(uint32_t v) {
return *(float*)(&v);
}
void update_data(char *line) {
memcpy(bt_data, line, sizeof(bt_data));
printf("received: [%s]\n", line);
static uint32_t value[7];
sscanf(line, "=%x %x %x %x %x %x %x %d %d %hhd",
&bt_data.microsecond,
&value[0], &value[1], &value[2],
&value[3], &value[4], &value[5],
&bt_data.scroll_x, &bt_data.scroll_y, &bt_data.click);
bt_data.accel_x = uint2float(value[0]);
bt_data.accel_y = uint2float(value[1]);
bt_data.accel_z = uint2float(value[2]);
bt_data.gyro_x = uint2float(value[3]);
bt_data.gyro_y = uint2float(value[4]);
bt_data.gyro_z = uint2float(value[5]);
}
bdaddr_t find_client(char *target) {
......
......@@ -4,7 +4,20 @@
#include <config.h>
#include <VP_Api/vp_api_thread_helper.h>
extern char bt_data[2048];
typedef struct _bt_data_t {
uint32_t microsecond;
float32_t accel_x;
float32_t accel_y;
float32_t accel_z;
float32_t gyro_x;
float32_t gyro_y;
float32_t gyro_z;
int32_t scroll_x;
int32_t scroll_y;
bool_t click;
} bt_data_t;
extern bt_data_t bt_data;
PROTO_THREAD_ROUTINE( bluetooth_connect, data );
......
#include <ardrone_tool/Navdata/ardrone_navdata_client.h>
#include <Navdata/navdata.h>
#include <Control/control.h>
#include <stdio.h>
#include <stdlib.h>
#define CTRL_STATES_STRING
#include "control_states.h"
#include "navdata.h"
#include "control.h"
#include "bt_connect.h"
/* Initialization local variables before event loop */
inline C_RESULT demo_navdata_client_init( void* data )
{
......@@ -18,17 +20,22 @@ inline C_RESULT demo_navdata_client_init( void* data )
inline C_RESULT demo_navdata_client_process( const navdata_unpacked_t* const navdata )
{
const navdata_demo_t*nd = &navdata->navdata_demo;
const controller_info_t*cs = &controller_state;
printf("===================== Navdata for flight demonstrations =====================\n");
printf("Control state : %i / Battery level : %i mV\n", nd->ctrl_state, nd->vbat_flying_percentage);
printf("Altitude : %i\n",nd->altitude);
printf("Orientation : [Theta] %4.3f [Phi] %4.3f [Psi] %4.3f\n", nd->theta, nd->phi, nd->psi);
printf("Speed : [vX] %4.3f [vY] %4.3f [vZ] %4.3f\n",nd->vx,nd->vy,nd->vz);
printf("Speed : [vX] %4.3f [vY] %4.3f [vZ] %4.3f\n",nd->vx,nd->vy,nd->vz);
printf("============================= Controller states =============================\n");
printf("Start : %i / Emergency : %i\n", controller_state.start, controller_state.emergency);
printf("[Gaz] %4.3f\n", controller_state.gaz);
printf("[Theta] %4.3f [Phi] %4.3f [Yaw] %4.3f [magnet-Psi] %4.3f\n", controller_state.theta, controller_state.phi, controller_state.yaw, controller_state.magneto_psi);
printf("Mode : [hover] %i [yaw] %i [absolute] %i [psi-accuracy] %4.3f\n", controller_state.hover_mode, controller_state.yaw_mode, controller_state.absolute_mode, controller_state.magneto_psi_accuracy);
printf("Start : %i / Emergency : %i\n", cs->start, cs->emergency);
printf("[Theta] %4.3f [Phi] %4.3f [Gaz] %4.3f [Yaw] %4.3f [magnet-Psi] %4.3f\n", cs->theta, cs->phi, cs->gaz, cs->yaw, cs->magneto_psi);
printf("Mode : [hover] %i [yaw] %i [absolute] %i [psi-accuracy] %4.3f\n", cs->hover_mode, cs->yaw_mode, cs->absolute_mode, cs->magneto_psi_accuracy);
printf("============================== Bluetooth data ===============================\n");
printf("microsecond: %d\n", bt_data.microsecond);
printf("acceleration: [x] %4.3f [y] %4.3f [z] %4.3f\n", bt_data.accel_x, bt_data.accel_y, bt_data.accel_z);
printf("gyrometer: [x] %4.3f [y] %4.3f [z] %4.3f\n", bt_data.gyro_x, bt_data.gyro_y, bt_data.gyro_z);
printf("scroll: [x] %4.3f [y] %4.3f / click: %i\n", bt_data.scroll_x, bt_data.scroll_y, bt_data.click);
return C_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment