���죬���˶�с���ָ���ҷ���һ��motionrt7�i�װ��ʹ�ã��լ�ʹ��qt��motionrt7������ǰ������
01 motionrt7���
motionrt7�����������˶������ƴ��ŀ�ƽ̨�˶�����ʵʱ�ںˣ�ҳ�ǹ�������ȫ�������у� �����ɿص�windows�˶�����ʵʱ���ˡ�
1.motionrt7�߱������ص㣺
��1������������װ���ʺϸ���windows���ԣ� ��ɫ�ⰲװ���������飻 ����ӳ������������֤��ȩ��δ��ȩҳ�����ã��� ���է�������á����������ӡ�ģ�����еȡ�
��2����motionrt�����汾���ܼ��ݣ�һ�ο������ɿ����л���ƕ��ʽ��linux����ƽ̨��
��3��ͳһ������ӿڣ����ٵı���local�ӿڣ��˶��������ÿ���us���𣬱���ͨpci������ʮ����
��4�����ɻ����ӿ������ٴ�����˶����� �����ӿ���ʵʱӧ�á�
��5��ǿ�����ܣ����240 ��������֧�ֿ翨��������������������������ƽ̨����������ʵ��λ������ / pso �ȸ����ܡ�
2.�����������˶�����ʵʱ�ں�motionrt
motionrt�����˶��������������뷢չ���˶�����ʵʱ�ںˣ��ѳ��ϵ����� 7������ motionrt1�� motionrt7��
3.motionrt7����ģ�黯�����ܹ�
�˶����ƴ����ӿ��㷨��motionrt7�˶��������棬ͨ���߹����ڴ�������ݽ�������������˶�����������ӿ��ľ���ч�ʡ�
�û��զ��幦�ܣ��ں�gmc��gear/cam��frame��robotics��cnc ���㷨������ �û���ר�ÿ���ϵͳ��
4.ͳһ���ŵ�api����
ͳһ���ƶ�sdk�� �����еĵ�������������ͬһ��api�ӿڣ���ƽ̨�ij�ʒ�ܹ������ч�ʣ����ּ����ԡ�
5.�����õ��˶����ƹ���
�������ԣ�
a.��λ�˶���ֱ�߲岹��բ���岹�������岹�������켣�ӹ���
b.�����֡����ӳ��֡�ͬ�����桢λ�����桢��������ӣ�
c.s���ӽ��٣�ss���ӽ��٣��켣�˶�����ͣ�
d.1d/2d/3d����λ��ͬ�����ps0����������ӿ����ġ����ٵ㽺������ӹ���
e.�ͻ����զ����˶������㷨���������������㷨��
f. ������������ӿ���ϡ�
6.���ŵ�ethercat�����õ��թ���
zdevelop�߱��������õ����ã����������ԣ���ϵȹ��ߡ�����zdevelop�ǹ���ɫ��ѵ��������߱�����ԣ���״̬��ʾ�����ȹ��ߡ�
motionrt7�㷺֧��ethercat���ߣ�motionrt7֧�������ϲ㷺���õ�ethercat�ŷ���ethercat������ethercat io��ethercat������ethercat��������
��������������ethercat�����ù��ߣ�����ŭ��������õ��˶����ơ�
02 motionrt7�i�װ��ʹ��
��һ������װ��������
1.��“�豸������”��ѡ��“����”�е�“���ӹ�ʱӳ��”������ѡ��“�ֶ�ѡ��”��
2.���“��һҳ”��
3.���“�ӵ��̰�װ”��
4.ѡ�����������ڵ�·�������ļ���“driver_signed”��ѡ��“motionrt64.sys”��
5.ȼ��һֱ�����һ����ֱ����װ��ɡ�
ע�⣺��������ʱ��ҫ���豸������ɾ���豸��һ��ҫѡ��������ļ�ҳɾ����
6.motionrt7������װ��ƶ��ʾ��
�ڶ��������п���̨����
1.����̨��������λ�ã����п�ִ���ļ�“motionrt710.exe”��
2.���“start”��
��������ʹ��zdevelop�������ӵ������������в������
zdevelop���ӿ������������汾3.10���ϣ�ʹ��pci/local��ʽ�������ӡ�
���ij���������չethercat��վэ��
1.�鿴�������ӡ�
2.ѡ������ethercat���������ҽ����ԣ���װэ�顣
3.����ӵ��̰�װ��ѡ�����������ڵ�·�������ļ���”driver_signed”��ѡ��“motionrtpacket.inf”��
4.��װ�ɹ���ȷ��motionrt64 packet protocol driverǰ����ѡ�ϡ�
��rt����̨����ѡ������addecat����ʱ�ܿ�����ӧ������ѡ���ϣ�ȼ������rt��
5. motionrt7 ethercatэ�鰲װ��ƶ��ʾ��
�դ�pc������ethercat��һ����ʵʱ�ԣ���ethercatҫ�������ܣ���ҫ������������э�鶼ȥ��������ʵʱ�ԡ�
�����һ������ʵʱ�ԣ���ʹ�����˶�ר�ŵ�ethercat�˶����ƿ�xpcie1032��
�������motionrt7�ij��������լ�������⣬�����“motionrt7˵����” ��
��������������˶���������www.zmotion.com.cn������ϵ���˶������ա��
03 qt creator����motionrt7��ŀ�ŀ���
1.�½�qt��ŀ��
2.��zmcaux.cpp��zmcaux.h��zmotion.dll��zmotion.lib��zmotion.h��5���ļ��ŵ��ոմ�����qt��ŀ�ļ����¡� �������ͽ�ͨ���ٶ��������ػ���ϵ���˶������ա��ȡ��
3.�����ⲿ��̬��“zmotion.lib”��
��1���һ���ŀ�ļ��у����“���ӿ�”��
��2��ѡ��“�ⲿ��”��
��3�����������ļ�ѡ��zmotion.lib,ȼ������ͼ�������á�
��4�������ɰ�ť����ɾ�̬������ӡ�
��5���ҽ����pro�ļ���ȼ����������ͼ��ʾ�ĵ�����������ŀ��������zmcaux.cpp��zmcaux.h��zmotion.h�ļ���������ɺ���”ctrl b”����ŀ������ļ�����ˢ�¡�
��6���������ӿ����������ӿ��zmc_handle g_handle�����žͿ��ե������˶��ṩ��api������ŀ�����ˡ�
4.��ع��ܿ�����local���ٽӿڲ��ԣ��������ȡ��ethercat�������ʹ�ã���
��1�����pc��������
��qt�����ʦ���棬�ҵ���ҫ�õ��� �ؼ���ק�������н���ui������ƣ�ч�����¡�
ע��ʹ��ipģʽ����motionrt7��ʱ��ҫ��motionrt710�е�config������eth num��ֵ����ϊһ������0������1-12���������ipϊ����ip��������zdevelop��ֱ�ӳ鿴��
��2��motionrt7����������zdevelop������ƶ��ʾ
��3����ش���
a.ͨ��ip���ӷ�ʽ�����ӱ�ť�ijۺ��������� ��������ip���ӷ�ʽ����
//ip���ӷ�ʽ���ӿ�����
void mainwindow::on_ipliskbutton_clicked()
{
//������ӵ��ڶͽ�״̬
if(g_handle == null)
{
//��ȡ�����������ip��ַ
qstring ipaddressbuff=ui->comboxiplist->currenttext();
qbytearray ba = ipaddressbuff.tolatin1();
char *ipaddress;
ipaddress=ba.data();
//���ӿ�����
iresult =zaux_openeth(ipaddress,&g_handle);
//��������״̬
if(iresult == 0)
{
ui->locallinkstatus->settext("���");
ui->locallinkstatus->setstylesheet("background-color: mistyrose");
ui->iplinkstatus->settext("���ӳɹ�");
ui->iplinkstatus->setstylesheet("background-color: palegreen");
}
}
else
{
qmessagebox::critical(this, "����", qstring("���ȵ���ͽ����ӱ�ť�ٽ������ӳ���"));
}
}
b.ͨ��local���ӷ�ʽ�����ӱ�ť�� �ۺ��������ӿ�������
//local���ӷ�ʽ���ӿ�����
void mainwindow::on_locallinkbutton_clicked()
{
//������ӵ��ڶͽ�״̬
if(g_handle == null)
{
//��ȡ�����������local���ӵ��ַ���
qstring localaddressbuff=ui->comboxlocal->currenttext();
qbytearray ba = localaddressbuff.tolatin1();
char *localaddress;
localaddress=ba.data();
//���ӿ�����
iresult = zaux_fastopen(zmc_connection_local,localaddress,3000,&g_handle);
//��������״̬
if(iresult == 0)
{
ui->locallinkstatus->settext("���ӳɹ�");
ui->locallinkstatus->setstylesheet("background-color: palegreen");
ui->iplinkstatus->settext("���");
ui->iplinkstatus->setstylesheet("background-color: mistyrose");
}
}
else
{
qmessagebox::critical(this, "����", qstring("���ȵ���ͽ����ӱ�ť�ٽ������ӳ���"));
}
}
c.ͨ���ͽ���ť�ijۺ������ͽ������������ӡ�
//�ͽ���λ���������������
void mainwindow::on_closelinkbutton_clicked()
{
//ֹͣ�������˶�
iresult =zaux_direct_rapidstop(g_handle,2);
//�ͽ�������������
iresult = zaux_close(g_handle);
}
d. ͨ�����߳�ʼ����ť�ijۺ������������������г�ʼ�� ��
//����ɨ��
void mainwindow::on_ecataxisinitbutton_clicked()
{
if(g_handle !=null)
{
int err;
//ɨ���λ��0�ϵ������豸���豸��ϊ1����ʱʱ��ϊ3000ms��
err = zaux_buscmd_ecatscan(g_handle,0,1,3000);
if(err!=0)
{
if(err == -2)
{
qmessagebox::critical(this, "����ɨ��ʧ��", qstring("ɨ�賬ʱ"));
}
else if(err == -1)
{
qmessagebox::critical(this, "����ɨ��ʧ��", qstring("�ڵ���ŀ��һ��"));
}
else
{
qmessagebox::critical(this, "����ɨ��ʧ��", qstring("�����������������"));
}
return ;
}
//��ʼ�������ᣬ��λ��0����ʼ���ϊ0������������ϊ65��pdoģʽ����ϊģʽ0
err = zaux_buscmd_ecataxisinit(g_handle,0,0,65,0);
if(err!=0)
{
if(err == -1)
{
qmessagebox::critical(this, "������ʹ��ʧ��", qstring("���߳�ʼ������"));
}
else
{
qmessagebox::critical(this, "������ʹ��ʧ��", qstring("��������"));
}
}
}
else
{
qmessagebox::critical(this, "����", qstring("�������ӿ�����"));
}
}
e. ͨ������ָ������ڵij���ť�ijۺ����������̣߳��ե���ָ��������ڽ��в��� ��
//�������̣߳��ե���ָ��������ڽ��в���
void mainwindow::on_singletestbutton_clicked()
{
//������ӿ�������������
if (g_handle != null)
{
//�������̷߳��������ź�
task1 = new mythread();
void (mythread::*pstarttesttask)(int) = &mythread::starttesttask;
void (mainwindow::*psingleapitest)(int) = &mainwindow::singleapitest;
connect(task1,pstarttesttask,this,psingleapitest);
//��ȡ���դ���
testnum = ui->singletestnum->currenttext().toint();
task1->start();
}
}
//task1��run����
void mythread::run()
{
//��ȡ����ǰ��ϵͳ��ʱ��ʱ��
starttime=clock();
for (int j=0; j
f. ͨ������ָ������ڵij���ť�ijۺ����������̣߳��զ���ָ��������ڽ��в��� ��
//�������̣߳��զ���ָ��������ڽ��в���
void mainwindow::on_testbutton_clicked()
{
//������ӿ�������������
if (g_handle != null)
{
//�������̷߳��������ź�
task2 = new mythread();
void (mythread::*pstarttesttask)(int) = &mythread::starttesttask;
void (mainwindow::*psingleapitest)(int) = &mainwindow::singleapitest;
connect(task2,pstarttesttask,this,psingleapitest);
//��ȡ���դ���
testnum = ui->testnum->currenttext().toint();
task2->start();
}
}
//task2��run����
void mythread::run()
{
//���������ַ���
char command[128]="?dpos(0),dpos(1),dpos(2),mspeed(0),mspeed(1),mspeed(2),idle(0),idle(1),idle(2)";
char returnbuff[64]={0};
//��ȡ����ǰ��ϵͳ��ʱ��ʱ��
starttime=clock();
for (int j=0; j
��4��qt���̽�����ƶ��ʾ
04 ���������
���ϸֱ��ƕ�ip��ʽ����motionrt7��local��ʽ����motionrt7��ָ������ԣ������������ч��ͼ��������ʾ���������կ��������� 1w�� �ͽ��� 10w�� �ĵ�ָ������ָ���ʱ��local���ӵķ�ʽ����ָ�������ҫ�ĵ���ָ���ʱ�䣨 ƽ��5us���� ����һ���զ�ȡ12��״̬�ķ���ָ���ʱ�䣨 ƽ��9us���� ������ҫ��ip���ӵķ�ʽ���죨 ƽ��34us������36us���� ����
��σ����ǿ��դ����н������motionrt7��local���ӵķ�ʽ�£�ָ�����ч��ҳ�ƿdz����ȶ���������������1w���ӵ�10wʱ������ָ���ʱ�������ָ���ʱ�䲨�������⽫ϊ������ҵ���ȶ����ṩ�˼���ı�֤��
motionrt7�ij��֣�������һ���ش�ľ�ϲ����������ϊ�����ڽ��д�����ָ����ĺ����у��ṩ�˸��õ�ч�����ȶ��ԣ�������������ߵ�ч�������ļ�ֵ��
��صĺ��������“zmotion pc���������ֲ�”��
���σ����˶����� windowsʵʱ�˶��������ˣ�������local���ٽӿڲ���֮qt ���ͷ��������
���ྫ���������ע“ ���˶�с���� ”���ںţ���ҫ��ؿ������������̴��룬����ѯ���˶��������۹���ʦ��400-089-8936��
���������˶�����ԭ������ӭ���ת�أ���ͬѧϰ��һ������й���������ˮƽ�����°�ȩ�����˶��������у�����ת����ע��������դ��
|