资源简介
调用mavlink协议各类头文件,实现遥控遥测串口数据的收发功能
代码片段和文件信息
// demo002.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
//Variable Definition
int system_type = 0;
int autopilot_type = 0;
bool looping = false;
int16_t Pwork_data[1][10];
HANDLE hSerial hThreadRead hThreadWrite;
uint8_t BufReceive[MAVlink_MAX_PACKET_LEN];
uint8_t BufSend[MAVlink_MAX_PACKET_LEN];
uint16_t BufSendLen = 0;
uint16_t BufReceiveLen = 0;
uint8_t *ptrMsg_id_in;
uint8_t *ptrMsg_id_out;
bool IsDataReady = 0;
//Function Definition
DWORD WINAPI mavThreadRead(LPVOID lpParam);
DWORD WINAPI mavThreadWrite(LPVOID lpParam);
uint8_t mavlink_msg_decode(int16_t(*Pwork_data)[10] mavlink_message_t msg);
BOOL WriteBuffer(uint8_t* lpBuf DWORD dwToWrite);
bool mavlink_init();
void testfunction1(); //测试直接发送
void testfunction2(); //测试发串口封装函数
int _tmain(int argc _TCHAR* argv[])
{
mavlink_init();
//============================================
while (1)
{
int a;
cout << “输入mavlink消息ID(0/1/2/3/4):“ << endl;
cin >> a;
if (a == 0)
{
cout << “test_TAKEOFF_ “ << endl;
cout << “\r\n “ << endl;
mavlink_message_t msg;
//mavlink_msg_command_long_pack(251/*系统ID--FB*/ 190/*组件ID--BE(190 MAV_COMP_ID_MISSIONPLANNER 任务管理器)*/ &msg
// this->getUASID() 0 MAV_CMD_NAV_TAKEOFF 1 mode num 0 0 0 0 alt);
BufSendLen = mavlink_msg_to_send_buffer(BufSend &msg);
IsDataReady = 1;
}
else if (a == 1)
{
cout << “mavlink_msg_set_attitude_target_pack “ << endl;
cout << “\r\n “ << endl;
mavlink_message_t msg;
float roll pitch yaw thrust;
roll = 10; pitch = 20; yaw = 30; thrust = 40;
float q[4];
q[0] = 0.01; q[1] = 0.02; q[2] = 0.03; q[3] = 0.04;
mavlink_msg_set_attitude_target_pack(100 200 &msg 0 system_type autopilot_type 0 q roll pitch yaw thrust);
BufSendLen = mavlink_msg_to_send_buffer(BufSend &msg);
IsDataReady = 1;
}
else if (a == 2)
{
cout << “mavlink_msg_heartbeat_pack “ << endl;
cout << “\r\n “ << endl;
mavlink_message_t msg;
mavlink_msg_heartbeat_pack(100 200 &msg system_type autopilot_type 0 0 1);
BufSendLen = mavlink_msg_to_send_buffer(BufSend &msg);
IsDataReady = 1;
}
else if (a == 3)
{
cout << “mavlink_msg_set_position_target_local_ned_pack “ << endl;
cout << “\r\n “ << endl;
mavlink_message_t msg;
mavlink_msg_set_position_target_local_ned_pack(100 200 &msg 0 system_type autopilot_type 0 0 1 2 3 11 22 33 111 222 333 1111 11111);
//(uint8_t system_id uint8_t component_id mavlink_message_t* msg
//uint32_t time_boot_ms uint8_t target_system uint8_t target_component uint8_t coordinate_frame uint16_t type_mask float x float y float z float vx float vy float vz float afx float afy float afz float yaw float yaw_rate)
BufSendLen = mavlink_msg_to_send_buffer(BufSend &msg);
IsDataReady = 1;
}
else if (a == 4)
{
cout << “mavlink_msg_set_mode_pack -- offboard“ << endl;
cou
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-06 20:04 demo\
目录 0 2018-12-06 20:04 demo\c_library_v1-master\
目录 0 2018-12-06 20:04 demo\c_library_v1-master\ardupilotmega\
文件 94015 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\ardupilotmega.h
文件 590 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 13782 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 11769 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 15081 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 19627 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 11914 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 10845 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 9106 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 21943 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 17600 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 14761 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 9361 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 9359 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 9361 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 9359 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 19572 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 22975 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 20900 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 15657 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 11177 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 13543 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 12167 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 13851 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 21972 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 14928 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 11055 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
文件 10855 2018-11-30 16:04 demo\c_library_v1-master\ardupilotmega\mavli
............此处省略668个文件信息
相关资源
- 高质量程序设计指南第三版 修订版
- LINUX网络编程_宋敬彬_孙海滨(pdf&代码
- 信息学奥赛一本通 NOIP500+第2部分
- Head First C(英+中+代码)
- FastReport_VCL_Enterprise_6.8.3For Rad Studio
- FMSoft_uniGUI_Professional整套安装包官方破
- Qt Creator快速入门_第三版 完整版
- Qt Creator快速入门-第2版qt4.8-PDF(书签
- QT+OpenCV+VS Gerber光绘文件识别2
- mingw-w64压缩包
- opencv2计算机视觉编程手册中文清晰扫
- QT5 黄金矿工 游戏开发
- ImageFusion.zip
- PDFium功能.zip
- opencv4.0调用TensorFlow实现mask rcnn的训练
- obj加载/三维图像拖动放大缩小旋转
- 《二级C++语言程序设计》专用教材
- nehe的OpenGL教程bcb6源码.rar
- FPGA USB 通信
- 连通域分割代码 vs2015+opencv3.3
- QT Tabwidget 冻结表头和冻结列
- 后台开发:核心技术与应用实践.徐晓
- AdvancedInstaller16.2 工具
- 声呐成像仿真
- 高程大作业 扫雷 代码实现
- 基于机器视觉的交通标志识别系统
- 基于Qt、FFMpeg的音视频播放器
- Qt5开发及_高清版含电子书、随书PPT以
- STM32Cube_fw_F4_V1.24.1 CubeMX的F4系列的封装
- 软件工程 面向对象和传统的方法 原书
评论
共有 条评论