#include <iostream> #include “serial_debug.h” using namespace std; int debug_wait() { #if DEBUG cout << “press any key to contine” << endl; getchar(); #endif return 0; } bool creat_serial(HANDLE &hComm,string strPort) { hComm = CreateFile(strPort.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hComm == INVALID_HANDLE_VALUE) { cout << “Fail to open Serial Port.!!!” << endl; debug_wait(); return FALSE; } else { cout << “Success to open Serial Port. ” << endl; debug_wait(); return TRUE; } } bool close_serial(HANDLE &hComm) { CloseHandle(hComm); return TRUE; } bool set_serial(HANDLE &hComm) { DCB dcb; GetCommState(hComm, &dcb); dcb.BaudRate = CBR_115200; dcb.ByteSize = 8; dcb.StopBits = ONESTOPBIT; SetCommState(hComm, &dcb); return TRUE; } bool WriteSerial(char* btData, ULONG ulSize, HANDLE hSerial) { DWORD dwNumBytes, dwRet; dwRet = WriteFile(hSerial, //Handle btData, //Data buffer ulSize, //Buffer size &dwNumBytes, //written bytes NULL); //don’t support return (dwRet != 0); }; int serial_process() { HANDLE hComm; string portname = “com6”; bool ret = FALSE; string buff = “serial opened”; char c[20]=””; //A5 5A 03 81 00 01 ret=creat_serial(hComm, portname); if (!ret) return 0; set_serial(hComm); if (!WriteSerial(c, 7, hComm))//Send data hello to com1 printf(“ERROR!!”); wait_for_end();// pending until uart is not need. close_serial(hComm); return 0; },As a kind of semi-autonomous or fully self-help robot, service robots are able to perform useful service work for human beings, such as carrying, cleaning, and rescue. As service robots gradually enter the social life of people, they are now widely used in public places such as exhibition halls, restaurants and hotels, which have a profound impact on improving the quality of human life and service industry.,Usually service robots are equipped with high-precision LIDAR, voice acquisition module, motion module, display screen, wireless connection module and other major equipment. The robot uses LIDAR to build a high-precision indoor map, a voice module to receive voice commands, a motion module to move the robot to the target location, and a wireless module to receive remote commands from the controller to achieve remote intelligent control.,The movement process of the service robot needs to go through functions such as map construction, path planning, speed planning, and roadblock avoidance, as shown in the figure below.,In this paper, a mobile robot demo is built, using an omnidirectional mobile chassis, so that the robot can complete steering, translation and other actions in a small range.
本文链接:http://china-kangda.com/?p=3199 转载请注明出处.
如果喜欢:点此查看RSS订阅
相关文章
为您推荐
各种观点