机械手运动仿真实验报告(仅供借鉴)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

机械手运动仿真实验报告
一、机械手结构组成(简图)
①为机械手底座②为机械臂1
③为机械臂2 ④为机械臂3
a、b、c为转动副,机械臂实现3自由度运动
二、机械手运动学方程推导
绘图框及转动副夹角:
绘图框大小为400X400
转动副a:anglea
转动副b:angleb
转动副c:anglec
机械手运动范围:
机械臂1长度50,机械臂2长度100,机械臂3长度50。

三个关节可实现360度旋转。

故机械臂运动范围为以半径为200的圆内。

机械手底座:
X:(150,200)
Y:(250,200)
机械臂1:
X1:(200,200)
Y1:((200+ 50 * cos(anglea*3.1415926/180)), (200-50 * sin(anglea*3.1415926/180)))
机械臂2:
X2:((200+ 50 * cos(anglea*3.1415926/180)), (200-50* sin(anglea*3.1415926/180)))
Y2:((200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb*3.1415926/180)), (200 - 50 * sin (anglea*3.1415926/180)-100* sin(angleb*3.1415926/180)))
机械臂3:
X3:((200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb*3.1415926/180)), (200 - 50 * sin (angLea*3.1415926/180)-100* sin(angleb*3.1415926/180)))
Y3:( (200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb*3.1415926/180)+50 * cos(anglec *3.1415926/180)), (200 - 50 * sin(anglea*3.1415926/180)-100* sin(angleb*3.1415926/180)-50 * sin(anglec*3.1415926/180)))
三、机械手运动仿真程序编写(关键函数代码)
pWnd->Invalidate();
pWnd->UpdateWindow() ;
pDC->Rectangle(0,0,400,400);
DrawRobotBase();
DrawRobotMemberBar1(m_fanglea);
DrawRobotMemberBar2(m_fanglea, m_fangleb);
DrawRobotMemberBar3(m_fanglea, m_fangleb, m_fanglec);
//绘制底座及其颜色代码
void CDrawRobotDlg::DrawRobotBase()
{
CPen SuiyiPen;
SuiyiPen.CreatePen(PS_SOLID,Wide,RGB(hong, lv, lan));
CPen *oldPen;
oldPen = pDC->SelectObject(&SuiyiPen);
pDC->MoveTo(150,200);
pDC->LineTo(250,200);
pDC->SelectObject(oldPen);
DeleteObject(SuiyiPen) ;
}
//绘制杆1
void CDrawRobotDlg::DrawRobotMemberBar1(float anglea)
{
pDC->MoveTo(200,200);
pDC->LineTo(int(200+ 50 * cos(anglea*3.1415926/180)),int(200-50 * sin (anglea*3.1415926/180)));
}
//绘制杆2
void CDrawRobotDlg::DrawRobotMemberBar2(float anglea,float angleb)
{
pDC->MoveTo(int(200+ 50 * cos(anglea*3.1415926/180)),int(200-50* sin (anglea*3.1415926/180)));
pDC->LineTo(int(200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb *3.1415926/180)),int(200 - 50 * sin(anglea*3.1415926/180)-100* sin(angleb
*3.1415926/180)));
}
//绘制杆3
void CDrawRobotDlg::DrawRobotMemberBar3(float anglea, float angleb, float anglec)
{
pDC->MoveTo(int(200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb *3.1415926/180)),int(200 - 50 * sin(anglea*3.1415926/180)-100* sin(angleb
*3.1415926/180)));
pDC->LineTo(int(200 + 50 * cos(anglea*3.1415926/180)+100 * cos(angleb *3.1415926/180)+50 * cos(anglec*3.1415926/180)),int(200 - 50 * sin(anglea
*3.1415926/180)-100* sin(angleb*3.1415926/180)-50* sin(anglec*3.1415926 /180)));
}
//转动副a加减角度按钮代码
void CDrawRobotDlg:: OnButton 1()
{
m_fanglea = m_fanglea + 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
void CDrawRobotDlg::OnButton2()
{
m_fanglea = m_fanglea - 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
//转动副b加减角度按钮代码
void CDrawRobotDlg::OnButton3()
{
m_fangleb = m_fangleb + 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
void CDrawRobotDlg::OnButton4()
{
m_fangleb = m_fangleb - 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
//转动副c加减角度按钮代码
void CDrawRobotDlg::OnButton5()
{
m_fanglec = m_fanglec + 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
void CDrawRobotDlg::OnButton6()
{
m_fanglec = m_fanglec - 1 ;
UpdateData(FALSE);
Invalidate(FALSE) ;
}
//机械臂1启动按钮代码
void CDrawRobotDlg::OnButton7()
{
AfxBeginThread(MoveThreada, this) ; }
//机械臂2启动按钮代码
void CDrawRobotDlg::OnButton8()
{
AfxBeginThread(MoveThreadb, this) ; }
//机械臂3启动按钮代码
void CDrawRobotDlg::OnButton9()
{
AfxBeginThread(MoveThreadc, this) ;
}
//机械臂1旋转代码
UINT CDrawRobotDlg::MoveThreada(void *parama) {
CDrawRobotDlg *pDlga = (CDrawRobotDlg*)parama ;
while(1)
{
pDlga->m_fanglea = pDlga->m_fanglea + 1 ;
pDlga->Invalidate(FALSE) ;
Sleep(100) ;
}
return 0 ;
}
//机械臂2旋转代码
UINT CDrawRobotDlg::MoveThreadb(void *paramb) {
CDrawRobotDlg *pDlgb = (CDrawRobotDlg*)paramb ;
while(1)
{
pDlgb->m_fangleb = pDlgb->m_fangleb + 1 ;
pDlgb->Invalidate(FALSE) ;
Sleep(100) ;
}
return 0 ;
}
//机械臂3旋转代码
UINT CDrawRobotDlg::MoveThreadc(void *paramc) {
CDrawRobotDlg *pDlgc = (CDrawRobotDlg*)paramc ;
while(1)
{
pDlgc->m_fanglec = pDlgc->m_fanglec + 1 ;
pDlgc->Invalidate(FALSE) ;
Sleep(100) ;
}
return 0 ;
}。

相关文档
最新文档