机械手运动仿真实验报告(仅供借鉴)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 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) ;
}