资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
天津师范大学计算机与信息工程学院课程设计报告课程名称: 机器人设计 设计题目: 专 业: 信息工程 班 级: 组 别: 学生姓名: 学 号: 起止日期: 指导教师: 同组人员: 课程设计题目机器人设计实验姓名学号班级班级专业信息工程组别组长组员指导教师课程设计目的设计家庭组机器人和机器人行走课程设计环境Vc+课程设计任务和要求用C+语言设计一个颜色识别的程序和一个机器人行走程序课程设计内容描述:1 绪论 通过学习机器人设计2课程,学会了家庭组机器人和足球机器人的一些理论知识。了解了机器人方向识别,动手调试了全景摄像头和前置摄像头,设置了场地、球门、白线、足球等的颜色数值。2. 颜色识别的产生 结合梁老师给的人脸识别程序,通过改变人脸模型建立颜色识别程序。 3. 平台的选择及搭建 根据刘老师给的参考资料,首先安装了DirectX9.0 SDK和Visual C+软件,然后一步步的按照老师所给的步骤,先建立基本界面,接着编制串口通讯控制机器人的程序,读取距离传感器信息等,最后得出了机器人行走程序如下。课程设计源程序:机器人行走/ VoyTestDlg.cpp : implementation file/#include stdafx.h#include VoyTest.h#include VoyTestDlg.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialogpublic:CAboutDlg();/ Dialog Data/AFX_DATA(CAboutDlg)enum IDD = IDD_ABOUTBOX ;/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:/AFX_MSG(CAboutDlg)/AFX_MSGDECLARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)/AFX_MSG_MAP(CAboutDlg)/ No message handlers/AFX_MSG_MAPEND_MESSAGE_MAP()/ CVoyTestDlg dialogCVoyTestDlg:CVoyTestDlg(CWnd* pParent /*=NULL*/): CDialog(CVoyTestDlg:IDD, pParent)/AFX_DATA_INIT(CVoyTestDlg)m_nPort = 0;/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);void CVoyTestDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CVoyTestDlg)DDX_Text(pDX, IDC_PORT, m_nPort);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CVoyTestDlg, CDialog)/AFX_MSG_MAP(CVoyTestDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_OPEN, OnOpen)ON_BN_CLICKED(IDC_FORWARD, OnForward)ON_BN_CLICKED(IDC_BACKWARD, OnBackward)ON_BN_CLICKED(IDC_TURELEFT, OnTureleft)ON_BN_CLICKED(IDC_TURERIGHT, OnTureright)ON_BN_CLICKED(IDC_BRAKE, OnBrake)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CVoyTestDlg message handlersBOOL CVoyTestDlg:OnInitDialog()CDialog:OnInitDialog();/ Add About. menu item to system menu./ IDM_ABOUTBOX must be in the system command range.ASSERT(IDM_ABOUTBOX & 0xFFF0) = IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEPARATOR);pSysMenu-AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);/ Set the icon for this dialog. The framework does this automatically/ when the applications main window is not a dialogSetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE);/ Set small icon/ TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a controlvoid CVoyTestDlg:OnSysCommand(UINT nID, LPARAM lParam)if (nID & 0xFFF0) = IDM_ABOUTBOX)CAboutDlg dlgAbout;dlgAbout.DoModal();elseCDialog:OnSysCommand(nID, lParam);/ If you add a minimize button to your dialog, you will need the code below/ to draw the icon. For MFC applications using the document/view model,/ this is automatically done for you by the framework.void CVoyTestDlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/ Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号