-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServoParametersViewForm.qml
More file actions
227 lines (214 loc) · 10.3 KB
/
ServoParametersViewForm.qml
File metadata and controls
227 lines (214 loc) · 10.3 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
import QtQuick 2.9
import ServoPRMViewModel 1.0
import QtQuick.Controls 1.4
Item {
id: element
property var titleNames: ["Motor", "Absolute Encoder", "Inertia Ratio Setting", "Position P Gain1", "Position P Gain2", "Pos Filter Command Time Constant", "Position Feed-Forward Gain", "Notch Filter
Use", "Notch Filter Frequency", "Notch Filter Bandwidth"]
ServoPRMViewModel {
id: servoprmviewmodel
}
ScrollView {
anchors.fill: parent
Flickable {
contentHeight: topGrid.height
contentWidth: topGrid.width
height: 390
Grid {
//main grid for both gain and
width: 690
height: 550
id: topGrid
rows: 12
columns: 8
flow: Grid.LeftToRight
spacing: 4
MFrame {
id: titles
width: topGrid.width / 7 +12
height: topGrid.height
Grid {
//titles
x: -5
y: 0
width: topGrid.width / 7
height: titles.height
verticalItemAlignment: Grid.AlignTop
horizontalItemAlignment: Grid.AlignHCenter
rows: 12
spacing: 1
Repeater {
width: titles.width
height: titles.height
model: 10
Label {
width: titles.width // 12+3
height: titles.height / 10 - 5
text: "<b>" + titleNames[index] + "<\b>"
wrapMode: Label.WordWrap
color: "#EFECCA"
font.pointSize: 10
}
}
}
}
Repeater {
model: 6
MFrame {
id: motorFrame
width: topGrid.width / 7 - 2
height: topGrid.height
property int mIndex: index
property var mParam: ({
})
Grid {
id: r4g
rows: 13
width: topGrid.width / 7 -2
height: topGrid.height
flow: Grid.TopToBottom
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
spacing: 1
Label {
width: topGrid.width
height: topGrid.height / 10
text: "<b> " + (mIndex + 1) + "<\b>"
color: "#EFECCA"
}
MButton {
width: topGrid.width
height: topGrid.height / 10
_text: "Reset"
_width: topGrid.width / 11
_height: topGrid.height / 24 // 12
onBtnClick: {
servoprmviewmodel.resetAbsoluteEncoder()
}
}
TextInput{
id:mytext0
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.InertiaRatioSetting[mIndex]//Parameters[mIndex][index]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished:{
mParam[0] = parseInt(mytext0.text)
}
}
TextInput{
id:mytext1
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.PositionProportionalGain1[mIndex]//Parameters[mIndex][index]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[1] = parseInt(mytext1.text)
}
TextInput{
id:mytext2
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.PositionProportionalGain2[mIndex]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[2] = parseInt(mytext2.text)
}
TextInput{
id:mytext3
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.PositionFilterCommandTimeConstant[mIndex]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[3] = parseInt(mytext3.text)
}
TextInput{
id:mytext4
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.PositionFeedForwardGain[mIndex]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[4] = parseInt(mytext4.text)
}
TextInput{
id:mytext5
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.NotchFilterUse[mIndex]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[5] = parseInt(mytext5.text)
}
TextInput{
id:mytext6
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.NotchFilterFrequency[mIndex]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[6] = parseInt(mytext6.text)
}
TextInput{
id:mytext7
height: topGrid.height / 10 -8
width: topGrid.width
text: ""+servoprmviewmodel.NotchFilterBandwidth[mIndex]//Parameters[mIndex][index]
color: "#EFECCA"
validator: IntValidator {
bottom: 0
top: 65535
}
onEditingFinished: mParam[7] = parseInt(mytext7.text)
}
MButton {
// anchors.topMargin:
id: setBtn
_text: "Set"
_width: topGrid.width / 11 //- 5 // 11 - 15
_height: motorFrame.height / 24
width: topGrid.width
onBtnClick: {
setBtn.visible = true
servoprmviewmodel.INDEX=index
servoprmviewmodel.InertiaRatioSetting[mIndex]=mParam[0]
servoprmviewmodel.PositionProportionalGain1[mIndex]=mParam[1]
servoprmviewmodel.PositionProportionalGain2[mIndex]=mParam[2]
servoprmviewmodel.PositionFilterCommandTimeConstant[mIndex]=mParam[3]
servoprmviewmodel.PositionFeedForwardGain[mIndex]=mParam[4]
servoprmviewmodel.NotchFilterUse[mIndex]=mParam[5]
servoprmviewmodel.NotchFilterFrequency[mIndex]=mParam[6]
servoprmviewmodel.NotchFilterBandwidth[mIndex]=mParam[7]
//absolute encoder ham reset she?
}
}
}
}
}
}
}
}
}