ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / Soft / Lib / ardrone_tool / config_keys.c
1
2 #include <Maths/maths.h>
3 #include <Maths/matrices.h>
4
5 #undef ARDRONE_CONFIG_KEY_IMM
6 #undef ARDRONE_CONFIG_KEY_REF
7 #undef ARDRONE_CONFIG_KEY_STR
8 #include <config_keys.h>
9
10 const vector31_t default_accs_offset = {{{ -2048.0f, 2048.0f, 2048.0f}}};
11 const matrix33_t default_accs_gain = {1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f };
12 const vector31_t default_gyros_offset = {{{ 1662.5f, 1662.5f, 1662.5f}}};
13 const vector31_t default_gyros_gains = {{{ 395.0f * MDEG_TO_RAD, -395.0f * MDEG_TO_RAD, -207.5f * MDEG_TO_RAD }}};
14 const vector21_t default_gyros110_offset = {{ 1662.5f, 1662.5f}};
15 const vector21_t default_gyros110_gains = {{ 87.5f * MDEG_TO_RAD, -87.5f * MDEG_TO_RAD }};
16
17 /* Stephane - multiconfiguration support */
18
19         /* Those data are present both on the client and the drone side */
20
21         const char * custom_configuration_id_keys[NB_CONFIG_CATEGORIES+1]=
22         {
23                         "",
24                         "custom:application_desc",
25                         "custom:profile_desc",
26                         "custom:session_desc",
27         };
28
29         const char * custom_configuration_headers[NB_CONFIG_CATEGORIES+1]=
30         {
31                         "[common]",
32                         "[applis]",
33                         "[profiles]",
34                         "[sessions]"
35         };
36
37         const char *configuration_switching_commands[NB_CONFIG_CATEGORIES+1]=
38         {
39                         "",
40                         "custom:application_id",
41                         "custom:profile_id",
42                         "custom:session_id",
43                         NULL
44         };
45
46         custom_configuration_list_t available_configurations[NB_CONFIG_CATEGORIES];
47
48
49         /* Stephane - multiconfiguration support */
50
51         C_RESULT configuration_check_config_id_char(const char session_id_char)
52         {
53                 char c = session_id_char;
54                 return ( (c>='a' && c<='f') || (c>='A' && c<='F') || (c>='0' && c<='9') );
55         }
56
57         C_RESULT configuration_check_config_id(const char * session_id)
58         {
59                 int i;
60                 unsigned char c;
61                 // Session IDs should be strings containing a 32-bit integer hexadecimal representation
62                 if (session_id==NULL) return C_FAIL;
63                 for (i=0;i<CUSTOM_CONFIGURATION_ID_LENGTH;i++){
64                         c=session_id[i];
65                         if (c==0) { return C_FAIL; }  /* string is too short */
66                         if (!(configuration_check_config_id_char(c))) { return C_FAIL; }  /* character is invalid */
67                 }
68                 if (session_id[i]!=0) { return C_FAIL; } /* string is too long */
69                 return C_OK;
70         }