您好,欢迎来到爱问旅游网。
搜索
您的当前位置:首页智能机器人课程设计报告[资料]

智能机器人课程设计报告[资料]

来源:爱问旅游网


智能机器人课程设计报告[资料]

天津师范大学

计算机与信息工程学院

课程设计报告

课程名称: 机器人设计

设计题目:

专 业: 信息工程

班 级: 08(1)班

组 别:

学生姓名: 吴雪萍 学 号: ********

起止日期: 2011年3月1日 ~ 2011年 7月1日

指导教师: 刘岩恺 梁景莲

同组人员:

课程设计题目 机器人设计实验

姓名 吴雪萍 学号 ******** 班级 08信息(1)班

班级 专业 信息工程

组别 组长 组员

指导教师 刘岩恺 梁景莲

课程

设计设计家庭组机器人和机器人行走 目的

课程

设计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_FILE

static char THIS_FILE[] = __FILE__; #endif

/////////////////////////////////////////////////////////////////////////////

// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog {

public:

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

// Implementation

protected:

//{{AFX_MSG(CAboutDlg)

//}}AFX_MSG

DECLARE_MESSAGE_MAP()

};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)

{

//{{AFX_DATA_INIT(CAboutDlg)

//}}AFX_DATA_INIT

}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)

{

CDialog::DoDataExchange(pDX);

//{{AFX_DATA_MAP(CAboutDlg)

//}}AFX_DATA_MAP

}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)

//{{AFX_MSG_MAP(CAboutDlg)

// No message handlers

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

// CVoyTestDlg dialog

CVoyTestDlg::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 Win32

m_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_MAP

}

BEGIN_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_MAP

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

// CVoyTestDlg message handlers

BOOL 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 < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);

if (pSysMenu != NULL)

{

CString strAboutMenu;

strAboutMenu.LoadString(IDS_ABOUTBOX);

if (!strAboutMenu.IsEmpty())

{

pSysMenu->AppendMenu(MF_SEPARATOR);

pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);

}

}

// Set the icon for this dialog. The framework does this automatically

// when the application's main window is not a dialog

SetIcon(m_hIcon, TRUE); // Set big icon

SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control

}

void CVoyTestDlg::OnSysCommand(UINT nID, LPARAM lParam) {

if ((nID & 0xFFF0) == IDM_ABOUTBOX)

{

CAboutDlg dlgAbout;

dlgAbout.DoModal();

}

else

{

CDialog::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 painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle

int 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 icon

dc.DrawIcon(x, y, m_hIcon);

}

else

{

CDialog::OnPaint();

}

}

// The system calls this to obtain the cursor to display while the user drags

// the minimized window.

HCURSOR CVoyTestDlg::OnQueryDragIcon()

{

return (HCURSOR) m_hIcon;

}

void CVoyTestDlg::OnOpen()

{

// TODO: Add your control notification handler code here

UpdateData();

//CString str;

//str.Format(\"您打开的串口号为%d\

//AfxMessageBox(str);

m_Com.SetCmd(&m_Cmd); //协议层与通讯层对接

m_Com.Create(m_nPort); //打开通讯串口

}

void CVoyTestDlg::OnForward()

{

// TODO: Add your control notification handler code here

m_Cmd.SetBothMotorsSpeed(100,100); //前行 }

void CVoyTestDlg::OnBackward()

{

// TODO: Add your control notification handler code here

m_Cmd.SetBothMotorsSpeed(-100,-100);//后退 }

void CVoyTestDlg::OnTureleft()

{

// TODO: Add your control notification handler code here

m_Cmd.SetBothMotorsSpeed(-100,100); //左转 }

void CVoyTestDlg::OnTureright()

{

// TODO: Add your control notification handler code here

m_Cmd.SetBothMotorsSpeed(100,-100); //右转 }

void CVoyTestDlg::OnBrake()

{

// TODO: Add your control notification handler code here

m_Cmd.Brake(1); //刹车

}

总结:

1、程序调试及运行结果

通过程序运行~我们可以看到足球机器人前进~后退~左转~右转及刹车等

动作的分解。

2、小结:通过完成本次实验~我认识到理论与实践的结合很重要。实践中遇到了许

多问题~只有耐心的不断去修改、调试、运行~才能很好的把实验完成。理论是

实际的基础~只有牢固的学好理论知识~才能成功的完成实验。在实践中我们可

以学到许多新的知识~遇到问题困难的时候~才能更深刻的理解知识点~团队协

作精神很重要~一个人的想法十分有限~只有大家集思广益~相互启发~才能更

快更好地完成实验。

3、参考文献

项 目 权重 成绩

1、设计过程中学习态度等方面 0.1

2、课程设计质量与答辩 0.5 绩

3、设计报告书写规范程度 评0.1

定 4、平时成绩(含考勤) 0.3

总 成 绩

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- awee.cn 版权所有 湘ICP备2023022495号-5

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务