ARDone SDK 1.8自带 Win32 Demo,使用firmware 1.7.4
来源:互联网 发布:bl是什么意思网络用语 编辑:程序博客网 时间:2024/06/06 01:26
花了两天的时间 ,终于在ARDrone SDK 1.8,firmware 1.7.4平台下将SDK自带的Win32 Demo编译完成。
跟随SDK1.8和firmware1.7.4的发布,Linux和IPhone端例子用程序均有更新,Windows平台下的例子程序貌似没有在更新了,而且Windows平台下的SDK编译时也会蹦出来一堆的错误,下面就来一一解决这些错误。
首先编译ARDrone SDK 1.8,出现了以下错误:
1、error C2065: 'tv' : undeclared identifier
error C2224: left of '.tv_sec' must have struct/union type
error C2065: 'tv' : undeclared identifier
error C2224: left of '.tv_usec' must have struct/union type
win32平台同样需要结构体tv。在ardrone_control.c文件中,修改为:
#ifdef _WIN32
int timeout_windows=1000;/*milliseconds*/
#endif
struct timeval tv;
即可。
2、error C2275: 'video_macroblock_t' : illegal use of this type as an expression
error C2065: 'macroblock_root' : undeclared identifier
error C2065: 'macroblock_root' : undeclared identifier
error C2065: 'macroblock_root' : undeclared identifier
error C2275: 'uint32_t' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'UI32_i'
error C2065: 'UI32_i' : undeclared identifier
error C2143: syntax error : missing ';' before 'type'
error C2275: 'uint32_t' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'y_size'
error C2065: 'y_size' : undeclared identifier
error C2065: 'c_size' : undeclared identifier
按照C语言严格的语法定义,函数内部所使用的变量,必须在函数的前部进行定义。
所以,按照这个标准来修改即可。
3、arpa/inet.h,ifaddrs.h文件无法找到。
Windows平台当然不需要这些Linux平台下的文件。连同wifi_config.c文件中使用到ifaddr结构体的地方直接注释掉即可。
4、无法找到文件<SDL/SDL.h>
新版SDL库的头文件中SDL.h文件直接放在include目录下,没有单独的目录。
修改为<SDL.h>即可。
5、无法找到<ardrone_at.c>文件。
很诡异的错误,SDK1.8的源代码包中并没有这个文件,但它的工程项目中却又包含了这个文件。
通过查看ARDroneLib\Soft\Lib\ardrone_tool\AT目录,发现其中包含了ardrone_at_mutex.c文件,是ardrone_at.c实现了线程同步的版本。
从SDK的工程项目中移除ardrone_at.c文件,将ardrone_at_mutex.c文件添加到工程项目中。
编译出现下面这个错误:AT_CODEC_FUNCTIONS_PTRS的使用方式非法。
将函数内部的代码修改为:
if( funcs != NULL)
{
memcpy(&func_ptrs, funcs, sizeof(*funcs));
}
else
{
#if defined (_MSC_VER)
AT_CODEC_FUNCTIONS_PTRS ptrs =
{
/*init*/host_init,
/*shutdown*/host_shutdown,
/*enable*/host_enable,
/*open*/host_open,
/*close*/host_close,
/*write*/host_write,
/*read*/host_read
};
#else
AT_CODEC_FUNCTIONS_PTRS ptrs =
{
.init = host_init,
.shutdown = host_shutdown,
.enable = host_enable,
.open = host_open,
.close = host_close,
.read = host_read,
.write = host_write,
};
#endif
vp_os_mutex_init(&at_mutex);
ATcodec_Init_Library( &ptrs );
}即可。
6、Error 2 error LNK2001: unresolved external symbol _ardrone_general_navdata_release navdata.obj Win32Client
Error 3 error LNK2001: unresolved external symbol _ardrone_general_navdata_process navdata.obj Win32Client
Error 4 error LNK2001: unresolved external symbol _ardrone_general_navdata_init navdata.obj Win32Client
函数有声明却没有实现,当然就链接出错了。
在ardrone_navdata_control.c文件的末尾添加以下几段代码即可:
C_RESULT ardrone_general_navdata_init( void* data ) {
return C_OK;
}
C_RESULT ardrone_general_navdata_process( const navdata_unpacked_t* const navdata ) {
return C_OK;
}
C_RESULT ardrone_general_navdata_release( void ) {
return C_OK;
}
7、Error 4 error LNK2001: unresolved external symbol _custom_configuration_headers
Error 5 error LNK2001: unresolved external symbol _available_configurations
error LNK2019: unresolved external symbol _p264_codec_free referenced in function _video_codec_close_private
//extern void p264_codec_alloc( video_controller_t* controller );
//extern void p264_codec_free( video_controller_t* controller );
// case P264_CODEC:
// p264_codec_alloc( controller );
// break;
// case P264_CODEC:
// p264_codec_free( controller );
// break;
ardrone_at_set_toy_configuration_ids( configure_data[configure_index].var, ses_id, usr_id, app_id,
configure_data[configure_index].value );
ardrone_at_set_toy_configuration_ids( configure_data[configure_index].var, ses_id, usr_id, app_id,
configure_data[configure_index].value );
char app_name [APPLI_NAME_SIZE] = "Default application"; // Default application name.
char usr_id [MULTICONFIG_ID_SIZE] = "00000000"; // Default user ID.
char usr_name [USER_NAME_SIZE] = "Default user"; // Default user name.
char ses_id [MULTICONFIG_ID_SIZE] = "00000000"; // Default session ID.
char ses_name [SESSION_NAME_SIZE] = "Default session"; // Default session name.
#ifndef __SDK_VERSION__
#define __SDK_VERSION__ "1.8" // TEMPORARY LOCATION OF __SDK_VERSION__ !!!
#endif
Input device DirectX Keyboard added
Input device DirectX Gamepad init failed
Starting thread directx_renderer_thread
Starting thread video_stage
Starting thread navdata_update
Video stage thread initialisation
Thread navdata_update in progress...
Starting thread ardrone_control
Sending flat trim - make sure the drone is horizontal at client startup.
[Pitch 0.000000] [Roll 0.000000] [Yaw 0.000000] [Gaz 0.000000] port 5554
[Pitch 0.000000] [Roll 0.000000] [Yaw 0.000000] [Gaz 0.000000]
Connection timed out
sizeinit = strlen("\1\0\0\0");
camMode %= 4;
switch (camMode)
{
case 0:
{
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_channel, &camMode, NULL);
camMode += 1;
camMode %= 4;
switch (camMode)
{
case 0:
{
ardrone_at_set_toy_configuration_ids("video:video_channel", ses_id, usr_id, app_id, "0");
break;
}
case 1:
{
ardrone_at_set_toy_configuration_ids("video:video_channel", ses_id, usr_id, app_id, "1");
break;
}
case 2:
{
ardrone_at_set_toy_configuration_ids("video:video_channel", ses_id, usr_id, app_id, "2");
break;
}
case 3:
{
ardrone_at_set_toy_configuration_ids("video:video_channel", ses_id, usr_id, app_id, "3");
break;
}
}
}
{
if (!at_init)
return ;
vp_os_mutex_lock(&at_mutex);
ATcodec_Queue_Message_valist(ids.AT_MSG_ATCMD_CONFIG_EXE,
++nb_sequence,
video,
channel);
vp_os_mutex_unlock(&at_mutex);
}
camMode += 1;
camMode %= 4;
switch (camMode)
{
case 0:
{
ardrone_at_video_channel("video:video_channel", "0");
break;
}
case 1:
{
ardrone_at_video_channel("video:video_channel", "1");
break;
}
case 2:
{
ardrone_at_video_channel("video:video_channel", "2");
break;
}
case 3:
{
ardrone_at_video_channel("video:video_channel", "3");
break;
}
}
}
ARDrone SDk 1.8,固件 1.7.4,最新的平台,windows平台下新的demo程序,都可以跑起来了。
下面可以进行其他方面的实验了。
- ARDone SDK 1.8自带 Win32 Demo,使用firmware 1.7.4
- 导入SDK中自带的Demo
- 使用Android SDK 的核心自带的资源
- 使用android SDK自带 Lint工具优化源码
- 安卓sdk自带模拟器的使用
- SDK自带的draw9patch无法使用的解决办法
- 使用Android-sdk自带的工具查看布局
- android sdk自带的fragment标签使用
- XILINK SDK怎么使用自带串口终端
- lucene4.2自带demo
- xe10 自带DEMO集合
- VC win32 Application SDK创建窗口Demo
- opencv 2.4.4中自带的demo总结
- JNI配置+NDK自带DEMO详解
- android如何运行自带demo
- java自带MD5加密Demo
- Unity 安装及自带demo运行
- webservice(java自带的demo)
- wchar类型
- 定义struct/struct定义在哪里/函数返回指针类型/指针数组与数组指针/{}里是局部定义/fabs、abs
- OIS协议分层模型
- php实现首页自动选择语言转跳(转)
- Windows 7 64位下 Python 包安装的问题
- ARDone SDK 1.8自带 Win32 Demo,使用firmware 1.7.4
- HTTP 请求返回代码含义
- CSS+DIV美化和布局-理解CSS定位与DIV布局
- linux IO行为:page cache and pdflush
- Unity如何使用Java类(理论篇)
- Android手机开发:Intent和在Activity之间传递信息
- Visual Studio常用快捷键
- testPython
- php汉字乱码的一些解决方案