forked from ozkryn/EPOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathepos3.cpp
More file actions
executable file
·103 lines (79 loc) · 2.38 KB
/
epos3.cpp
File metadata and controls
executable file
·103 lines (79 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "epos3.h"
#include "ui_epos3.h"
#include "Epos3ReadWriteLib.h"
#include <string.h>
using namespace std;
Epos3ReadWriteLib epos3Lib;
epos3::epos3(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::epos3)
{
ui->setupUi(this);
}
epos3::~epos3()
{
delete ui;
}
void epos3::on_pushButton_9_clicked()
{
//epos3Lib = new Epos3ReadWriteLib();
epos3Lib.initEPOS3();
}
void epos3::on_pushButton_3_clicked()
{
epos3Lib.sendDownloadCommand("0","0x6040","0","uint16","0x017f");
}
void epos3::on_pushButton_5_clicked()
{
epos3Lib.sendDownloadCommand("0","0x6040","0","uint16","0x02");
}
void epos3::on_pushButton_7_clicked()
{
epos3Lib.sendDownloadCommand("1","0x6040","0","uint16","0x017f");
}
void epos3::on_pushButton_8_clicked()
{
epos3Lib.sendDownloadCommand("1","0x6040","0","uint16","0x02");
}
void epos3::on_pushButton_10_clicked()
{
int index,motor0, motor1;
QString targetPosition;
QString targetVelocity;
index = ui->comboBox->currentIndex();
cout << index <<endl;
if (index==0)
{
epos3Lib.sendDownloadCommand("0", "0x6060", "0", "uint8","0x01");
}
else if(index==1)
{
epos3Lib.sendDownloadCommand("0", "0x6060", "0", "uint8","0x03");
}
targetPosition = ui->lineEdit->text();
targetVelocity = ui->lineEdit_2->text();
if(targetPosition !=""){
epos3Lib.sendDownloadCommand("0", "0x607A", "0", "uint32",targetPosition.toStdString());
}
if(targetVelocity !=""){
epos3Lib.sendDownloadCommand("0", "0x60FF", "0", "uint32",targetVelocity.toStdString());
}
}
void epos3::on_pushButton_11_clicked()
{
int operationMode_int;
int actualPosition_int;
int actualVelocity_int;
int controlWord_int;
int statusWord_int;
operationMode_int = epos3Lib.sendUploadCommand("0", "0x6060", "0", "uint8");
actualPosition_int = epos3Lib.sendUploadCommand("0", "0x6064", "0", "uint32");
actualVelocity_int = epos3Lib.sendUploadCommand("0", "0x606C", "0", "uint32");
controlWord_int = epos3Lib.sendUploadCommand("0", "0x6040", "0", "uint16");
statusWord_int = epos3Lib.sendUploadCommand("0", "0x6041", "0", "uint16");
ui->lcdNumber_5->display(operationMode_int);
ui->lcdNumber_4->display(actualPosition_int);
ui->lcdNumber_3->display(actualVelocity_int);
ui->lcdNumber_2->display(controlWord_int);
ui->lcdNumber->display(statusWord_int);
}