YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
jointitem.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7#include "jointitem.h"
8#include "ui_jointitem.h"
9
10#include "log.h"
11#include "yarpmotorgui.h"
12
13#include <cmath>
14
15#include <yarp/os/Log.h>
16#include <QDebug>
17#include <QKeyEvent>
18
20{
21 ui->sliderTrajectoryPosition->resetTarget();
22 ui->sliderMixedPosition->resetTarget();
23}
24
26{
27 if (this->internalState == Velocity)
28 {
29 velocityTimer.stop();
30 }
31 emit homeClicked(this);
32}
33
35{
36 if (this->internalState == Velocity)
37 {
38 velocityTimer.stop();
39 }
40 emit runClicked(this);
41}
42
44{
45 if (this->internalState == Velocity)
46 {
47 velocityTimer.stop();
48 }
49 emit idleClicked(this);
50}
51
53{
54 emit pidClicked(this);
55}
56
58{
59 QColor output;
60 switch (mode) {
61 case JointItem::Idle:{
62 output = idleColor;
63 break;
64 }
66 output = positionColor;
67 break;
68 }
70 output = positionDirectColor;
71 break;
72 }
73 case JointItem::Mixed:{
74 output = mixedColor;
75 break;
76 }
78 output = velocityColor;
79 break;
80 }
82 output = torqueColor;
83 break;
84 }
85 case JointItem::Pwm:{
86 output = pwmColor;
87 break;
88 }
90 output = currentColor;
91 break;
92 }
93
95 output = disconnectColor;
96 break;
97 }
99 output = hwFaultColor;
100 break;
101 }
103 output = calibratingColor;
104 break;
105 }
107 output = calibratingColor;
108 break;
109 }
111 output = calibratingColor;
112 break;
113 }
114
115 default:
116 output = calibratingColor;
117 break;
118 }
119
120 return output;
121
122}
123
125{
126 QString output;
127 switch (mode) {
128 case JointItem::Idle:{
129 output = "Idle";
130 break;
131 }
133 output = "Position";
134 break;
135 }
137 output = "Position Direct";
138 break;
139 }
140 case JointItem::Mixed:{
141 output = "Mixed";
142 break;
143 }
145 output = "Velocity";
146 break;
147 }
148 case JointItem::Torque:{
149 output = "Torque";
150 break;
151 }
152 case JointItem::Pwm:{
153 output = "PWM";
154 break;
155 }
156 case JointItem::Current:{
157 output = "Current";
158 break;
159 }
160
162 output = "Disconnected";
163 break;
164 }
165 case JointItem::HwFault:{
166 output = "Hardware Fault";
167 break;
168 }
170 output = "Calibrating";
171 break;
172 }
174 output = "Not Configured";
175 break;
176 }
178 output = "Configured";
179 break;
180 }
181
182 default:
183 output = "Unknown";
184 break;
185 }
186
187 return output;
188
189}
190
191void JointItem::updateTrajectoryPositionTarget(double val)
192{
193 ui->sliderTrajectoryPosition->updateSliderTarget(val);
194}
195
196void JointItem::updateMixedPositionTarget(double val)
197{
198 ui->sliderMixedPosition->updateSliderTarget(val);
199}
200
201JointItem::JointItem(int index,QWidget *parent) :
202 QWidget(parent),
203 ui(new Ui::JointItem)
204{
205 ui->setupUi(this);
206 internalState = StateStarting;
207 internalInteraction = InteractionStarting;
208 jointIndex = index;
209 sliderDirectPositionPressed = false;
210 sliderMixedPositionPressed = false;
211 sliderMixedVelocityPressed = false;
212 sliderTrajectoryPositionPressed = false;
213 sliderTrajectoryVelocityPressed = false;
214 sliderTorquePressed = false;
215 sliderPWMPressed = false;
216 sliderCurrentPressed = false;
217 sliderVelocityPressed = false;
218 enableCalib = true;
219 joint_speedVisible = false;
220 joint_motorPositionVisible = false;
221 joint_currentVisible = false;
222 joint_dutyVisible = false;
223 lastVelocity = 0;
224 velocityModeEnabled = false;
225 motionDone = true;
226
227 max_position = 0;
228 min_position = 0;
229 max_velocity = 0;
230 min_velocity = 0;
231 max_trajectory_velocity = 0;
232 max_torque = 0;
233 min_torque = 0;
234 max_current = 0;
235 min_current = 0;
236 ref_torque = 0;
237 ref_pwm = 0;
238 ref_current = 0;
239
240 IDLE = 0;
241 POSITION = 1;
242 POSITION_DIR = 2;
243 MIXED = 3;
244 VELOCITY = 4;
245 TORQUE = 5;
246 PWM = 6;
247 CURRENT = 7;
248 HW_FAULT = 8;
249
250
251
252 connect(ui->comboMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onModeChanged(int)));
253 connect(ui->comboInteraction,SIGNAL(currentIndexChanged(int)),this,SLOT(onInteractionChanged(int)));
254
255 ui->sliderTrajectoryPosition->installEventFilter(this);
256 connect(ui->sliderTrajectoryPosition,SIGNAL(sliderPressed()),this,SLOT(onSliderTrajectoryPositionPressed()));
257 connect(ui->sliderTrajectoryPosition, SIGNAL(sliderReleased()), this, SLOT(onSliderTrajectoryPositionReleased()));
258 ui->sliderTrajectoryPosition->disableClickOutOfHandle=true;
259 ui->sliderTrajectoryPosition->enableViewTargetBox = true;
260 ui->sliderTrajectoryPosition->enableViewTargetValue = false;
261
262 ui->sliderTorqueTorque->installEventFilter(this);
263 connect(ui->sliderTorqueTorque,SIGNAL(sliderPressed()),this,SLOT(onSliderTorquePressed()));
264 connect(ui->sliderTorqueTorque,SIGNAL(sliderReleased()),this,SLOT(onSliderTorqueReleased()));
265 ui->sliderTorqueTorque->disableClickOutOfHandle = true;
266 ui->sliderTorqueTorque->enableViewTargetBox = false;
267 ui->sliderTorqueTorque->enableViewTargetValue = false;
268
269 ui->sliderPWMOutput->installEventFilter(this);
270 connect(ui->sliderPWMOutput, SIGNAL(sliderPressed()), this, SLOT(onSliderPWMPressed()));
271 connect(ui->sliderPWMOutput, SIGNAL(sliderReleased()), this, SLOT(onSliderPWMReleased()));
272 ui->sliderPWMOutput->disableClickOutOfHandle = true;
273 ui->sliderPWMOutput->enableViewTargetBox = false;
274 ui->sliderPWMOutput->enableViewTargetValue = false;
275
276 ui->sliderCurrentOutput->installEventFilter(this);
277 connect(ui->sliderCurrentOutput, SIGNAL(sliderPressed()), this, SLOT(onSliderCurrentPressed()));
278 connect(ui->sliderCurrentOutput, SIGNAL(sliderReleased()), this, SLOT(onSliderCurrentReleased()));
279 ui->sliderCurrentOutput->disableClickOutOfHandle = true;
280 ui->sliderCurrentOutput->enableViewTargetBox = false;
281 ui->sliderCurrentOutput->enableViewTargetValue = false;
282
283 ui->sliderDirectPosition->installEventFilter(this);
284 connect(ui->sliderDirectPosition, SIGNAL(sliderPressed()), this, SLOT(onSliderDirectPositionPressed()));
285 connect(ui->sliderDirectPosition, SIGNAL(sliderReleased()), this, SLOT(onSliderDirectPositionReleased()));
286 ui->sliderDirectPosition->disableClickOutOfHandle = true;
287 ui->sliderDirectPosition->enableViewTargetBox = false;
288 ui->sliderDirectPosition->enableViewTargetValue = false;
289
290 ui->sliderMixedPosition->installEventFilter(this);
291 connect(ui->sliderMixedPosition, SIGNAL(sliderPressed()), this, SLOT(onSliderMixedPositionPressed()));
292 connect(ui->sliderMixedPosition, SIGNAL(sliderReleased()), this, SLOT(onSliderMixedPositionReleased()));
293 ui->sliderMixedPosition->disableClickOutOfHandle = true;
294 ui->sliderMixedPosition->enableViewTargetBox = true;
295 ui->sliderMixedPosition->enableViewTargetValue = false;
296
297 ui->sliderVelocityVelocity->installEventFilter(this);
298 connect(ui->sliderVelocityVelocity,SIGNAL(sliderPressed()),this,SLOT(onSliderVelocityPressed()));
299 connect(ui->sliderVelocityVelocity,SIGNAL(sliderReleased()),this,SLOT(onSliderVelocityReleased()));
300 ui->sliderVelocityVelocity->disableClickOutOfHandle = true;
301 ui->sliderVelocityVelocity->enableViewTargetBox = false;
302 ui->sliderVelocityVelocity->enableViewTargetValue = false;
303
304 ui->sliderTrajectoryVelocity->installEventFilter(this);
305 connect(ui->sliderTrajectoryVelocity, SIGNAL(sliderPressed()), this, SLOT(onSliderTrajectoryVelocityPressed()));
306 connect(ui->sliderTrajectoryVelocity, SIGNAL(sliderReleased()), this, SLOT(onSliderTrajectoryVelocityReleased()));
307 ui->sliderTrajectoryVelocity->disableClickOutOfHandle = true;
308 ui->sliderTrajectoryVelocity->enableViewTargetBox = false;
309 ui->sliderTrajectoryVelocity->enableViewTargetValue = false;
310
311 ui->sliderMixedVelocity->installEventFilter(this);
312 connect(ui->sliderMixedVelocity, SIGNAL(sliderPressed()), this, SLOT(onSliderMixedVelocityPressed()));
313 connect(ui->sliderMixedVelocity, SIGNAL(sliderReleased()), this, SLOT(onSliderMixedVelocityReleased()));
314 ui->sliderMixedVelocity->disableClickOutOfHandle = true;
315 ui->sliderMixedVelocity->enableViewTargetBox = false;
316 ui->sliderMixedVelocity->enableViewTargetValue = false;
317
318 connect(ui->buttonHome,SIGNAL(clicked()),this,SLOT(onHomeClicked()));
319 connect(ui->buttonIdle,SIGNAL(clicked()),this,SLOT(onIdleClicked()));
320 connect(ui->buttonRun,SIGNAL(clicked()),this,SLOT(onRunClicked()));
321 connect(ui->buttonPid,SIGNAL(clicked()),this,SLOT(onPidClicked()));
322 connect(ui->buttonCalib,SIGNAL(clicked()),this,SLOT(onCalibClicked()));
323
324 ui->groupBox->setTitle(QString("JOINT %1 (%2)").arg(index).arg(jointName));
325 // ui->groupBox->setAlignment(Qt::AlignHCenter);
326
327
328
329
330 comboStyle1 = "QComboBox {"
331 "border: 1px solid gray;"
332 "border-radius: 3px;"
333 "padding: 1px 18px 1px 3px;"
334 "min-width: 6em;}"
335 "QComboBox:editable {"
336 "background: white;"
337 "foreground: rgb(35, 38, 41);}"
338 "QComboBox::down-arrow {"
339 "image: url(:/images/downArrow.png);}";
340
341
342 comboStyle2 = "QComboBox:on { "
343 "padding-top: 3px;"
344 "padding-left: 4px;}"
345 "QComboBox::drop-down {"
346 "subcontrol-origin: padding;"
347 "subcontrol-position: top right;"
348 "width: 15px;"
349 "border-left-width: 1px;"
350 "border-left-color: darkgray;"
351 "border-left-style: solid; "
352 "border-top-right-radius: 3px; "
353 "border-bottom-right-radius: 3px;"
354 "background-color: darkgray;}";
355
356
357
358 installFilter();
359
360 ui->comboInteraction->setItemData(0,QColor(Qt::darkGray), Qt::BackgroundRole);
361 ui->comboInteraction->setItemData(1,QColor(0,80,255), Qt::BackgroundRole);
362 ui->comboInteraction->setItemData(1,QColor(35, 38, 41), Qt::ForegroundRole);
363
364 ui->comboMode->setItemData( IDLE, idleColor, Qt::BackgroundRole );
365 ui->comboMode->setItemData( POSITION, positionColor, Qt::BackgroundRole );
366 ui->comboMode->setItemData( POSITION_DIR, positionDirectColor, Qt::BackgroundRole );
367 ui->comboMode->setItemData( MIXED, mixedColor, Qt::BackgroundRole );
368 ui->comboMode->setItemData( VELOCITY, velocityColor, Qt::BackgroundRole );
369 ui->comboMode->setItemData( TORQUE, torqueColor, Qt::BackgroundRole );
370 ui->comboMode->setItemData( PWM, pwmColor, Qt::BackgroundRole );
371 ui->comboMode->setItemData( CURRENT, currentColor, Qt::BackgroundRole);
372
373 ui->comboMode->setItemData( IDLE, QColor(35, 38, 41), Qt::ForegroundRole );
374 ui->comboMode->setItemData( POSITION, QColor(35, 38, 41), Qt::ForegroundRole );
375 ui->comboMode->setItemData( POSITION_DIR, QColor(35, 38, 41), Qt::ForegroundRole );
376 ui->comboMode->setItemData( MIXED, QColor(35, 38, 41), Qt::ForegroundRole );
377 ui->comboMode->setItemData( VELOCITY, QColor(35, 38, 41), Qt::ForegroundRole );
378 ui->comboMode->setItemData( TORQUE, QColor(35, 38, 41), Qt::ForegroundRole );
379 ui->comboMode->setItemData( PWM, QColor(35, 38, 41), Qt::ForegroundRole );
380 ui->comboMode->setItemData( CURRENT, QColor(35, 38, 41), Qt::ForegroundRole );
381
382 ui->comboMode->setItemData( IDLE, Idle, Qt::UserRole);
383 ui->comboMode->setItemData( POSITION, Position, Qt::UserRole );
384 ui->comboMode->setItemData( POSITION_DIR, PositionDirect, Qt::UserRole );
385 ui->comboMode->setItemData( MIXED, Mixed, Qt::UserRole );
386 ui->comboMode->setItemData( VELOCITY, Velocity, Qt::UserRole );
387 ui->comboMode->setItemData( TORQUE, Torque, Qt::UserRole );
388 ui->comboMode->setItemData( PWM, Pwm, Qt::UserRole);
389 ui->comboMode->setItemData( CURRENT, Current, Qt::UserRole);
390
391 setJointInternalState(IDLE);
392
393 ui->stackedWidget->widget(VELOCITY)->setEnabled(false);
394 velocityTimer.setInterval(50);
395 velocityTimer.setSingleShot(false);
396 connect(&velocityTimer,SIGNAL(timeout()),this,SLOT(onVelocityTimer()));
397}
398
399bool JointItem::eventFilter(QObject *obj, QEvent *event)
400{
401 if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
402 auto* keyEvent = static_cast<QKeyEvent *>(event);
403 int key = keyEvent->key();
404 if(key == Qt::Key_Left || key == Qt::Key_Right || key == Qt::Key_Up ||
405 key == Qt::Key_Down || key == Qt::Key_PageUp || key == Qt::Key_PageDown){
406
407 //SliderWithTarget *slider=0;
408 QSlider* slider = nullptr;
409
410 if(obj == ui->sliderTrajectoryPosition){
411 slider = ui->sliderTrajectoryPosition;
412 if(keyEvent->type() == QEvent::KeyPress){
413 onSliderTrajectoryPositionPressed();
414 }
415 if(keyEvent->type() == QEvent::KeyRelease){
416 onSliderTrajectoryPositionReleased();
417 }
418 }
419 if(obj == ui->sliderTrajectoryVelocity){
420 slider = ui->sliderTrajectoryVelocity;
421 if (keyEvent->type() == QEvent::KeyPress){
422 onSliderTrajectoryVelocityPressed();
423 }
424 if (keyEvent->type() == QEvent::KeyRelease){
425 onSliderTrajectoryVelocityReleased();
426 }
427 }
428 if(obj == ui->sliderDirectPosition){
429 slider = ui->sliderDirectPosition;
430 if(keyEvent->type() == QEvent::KeyPress){
431 onSliderDirectPositionPressed();
432 }
433 if(keyEvent->type() == QEvent::KeyRelease){
434 onSliderDirectPositionReleased();
435 }
436 }
437 if(obj == ui->sliderMixedPosition){
438 slider = ui->sliderMixedPosition;
439 if(keyEvent->type() == QEvent::KeyPress){
440 onSliderMixedPositionPressed();
441 }
442 if(keyEvent->type() == QEvent::KeyRelease){
443 onSliderMixedPositionReleased();
444 }
445 }
446 if(obj == ui->sliderMixedVelocity){
447 slider = ui->sliderMixedVelocity;
448 }
449 if(obj == ui->sliderTorqueTorque){
450 slider = ui->sliderTorqueTorque;
451 if(keyEvent->type() == QEvent::KeyPress){
452 onSliderTorquePressed();
453 }
454 if(keyEvent->type() == QEvent::KeyRelease){
455 onSliderTorqueReleased();
456 }
457 }
458 if (obj == ui->sliderPWMOutput){
459 slider = ui->sliderPWMOutput;
460 if(keyEvent->type() == QEvent::KeyPress){
461 onSliderPWMPressed();
462 }
463 if(keyEvent->type() == QEvent::KeyRelease){
464 onSliderPWMReleased();
465 }
466 }
467 if (obj == ui->sliderCurrentOutput){
468 slider = ui->sliderCurrentOutput;
469 if (keyEvent->type() == QEvent::KeyPress){
470 onSliderCurrentPressed();
471 }
472 if (keyEvent->type() == QEvent::KeyRelease){
473 onSliderCurrentReleased();
474 }
475 }
476 if(obj == ui->sliderVelocityVelocity){
477 slider = ui->sliderVelocityVelocity;
478 if(keyEvent->type() == QEvent::KeyPress){
479 onSliderVelocityPressed();
480 }
481 if(keyEvent->type() == QEvent::KeyRelease){
482 onSliderVelocityReleased();
483 }
484 }
485
486 if (slider == nullptr) {
487 return false;
488 }
489
490
491 if(keyEvent->type() == QEvent::KeyPress){
492 if(key == Qt::Key_Left || key == Qt::Key_Down){
493 slider->setValue(slider->value() - 1);
494 }
495 if(key == Qt::Key_Right || key == Qt::Key_Up){
496 slider->setValue(slider->value() + 1);
497 }
498 if(key == Qt::Key_PageUp){
499 slider->setValue(slider->value() + 10);
500 }
501 if(key == Qt::Key_PageDown){
502 slider->setValue(slider->value() - 10);
503 }
504 }
505
506
507 return true;
508 }
509 return QObject::eventFilter(obj, event);
510
511 } else {
512 // standard event processing
513 return QObject::eventFilter(obj, event);
514 }
515}
516
518{
519 velocityModeEnabled = control;
520 ui->stackedWidget->widget(VELOCITY)->setEnabled(velocityModeEnabled);
521 if(ui->stackedWidget->currentIndex() == VELOCITY && velocityModeEnabled){
522 velocityTimer.start();
523 }
524}
525
527{
528 ui->stackedWidget->widget(MIXED)->setEnabled(control);
529}
530
532{
533 ui->stackedWidget->widget(POSITION_DIR)->setEnabled(control);
534}
535
537{
538 ui->stackedWidget->widget(PWM)->setEnabled(control);
539}
540
542{
543 ui->stackedWidget->widget(CURRENT)->setEnabled(control);
544}
545
547{
548 ui->sliderTrajectoryPosition->enableViewTargetBox = visible;
549 ui->sliderMixedPosition->enableViewTargetBox = visible;
550}
551
553{
554 ui->sliderTrajectoryPosition->enableViewTargetValue = visible;
555 ui->sliderMixedPosition->enableViewTargetValue = visible;
556}
557
559{
560 QString pos_metric_revolute("deg");
561 QString trq_metric_revolute("Nm");
562 QString trq_metric_revolute_title("Torque:");
563 QString vel_metric_revolute("deg/s");
564 QString pos_metric_prism("m");
565 QString trq_metric_prism("N");
566 QString trq_metric_prism_title("Force:");
567 QString vel_metric_prism("m/s");
568
570 {
571 ui->labelIdlevelUnits->setText(vel_metric_revolute);
572 ui->labelPositionvelUnits->setText(vel_metric_revolute);
573 ui->labelPositionDirvelUnits->setText(vel_metric_revolute);
574 ui->labelMixedvelUnits->setText(vel_metric_revolute);
575 ui->labelTorquevelUnits->setText(vel_metric_revolute);
576 ui->labelPWMvelUnits->setText(vel_metric_revolute);
577 ui->labelCurrentvelUnits->setText(vel_metric_revolute);
578 ui->labelVelocityvelUnits->setText(vel_metric_revolute);
579
580 ui->labelIdleTorque->setText(trq_metric_revolute_title);
581 ui->labelPositionTorque->setText(trq_metric_revolute_title);
582 ui->labelPositionDirTorque->setText(trq_metric_revolute_title);
583 ui->labelMixedTorque->setText(trq_metric_revolute_title);
584 ui->labelTorqueTorque->setText(trq_metric_revolute_title);
585 ui->labelPWMTorque->setText(trq_metric_revolute_title);
586 ui->labelCurrentTorque->setText(trq_metric_revolute_title);
587 ui->labelVelocityTorque->setText(trq_metric_revolute_title);
588
589 ui->labelIdleposUnits->setText(pos_metric_revolute);
590 ui->labelPositionposUnits->setText(pos_metric_revolute);
591 ui->labelPositionDirposUnits->setText(pos_metric_revolute);
592 ui->labelMixedposUnits->setText(pos_metric_revolute);
593 ui->labelTorqueposUnits->setText(pos_metric_revolute);
594 ui->labelPWMposUnits->setText(pos_metric_revolute);
595 ui->labelCurrentposUnits->setText(pos_metric_revolute);
596 ui->labelVelocityposUnits->setText(pos_metric_revolute);
597 ui->labelFaultposUnits->setText(pos_metric_revolute);
598
599 //ui->labelIdleMotorPosUnits->setText(pos_metric_revolute);
600 //ui->labelFaultMotorPosUnits->setText(pos_metric_revolute);
601
602 ui->labelIdletrqUnits->setText(trq_metric_revolute);
603 ui->labelPositiontrqUnits->setText(trq_metric_revolute);
604 ui->labelPositionDirtrqUnits->setText(trq_metric_revolute);
605 ui->labelMixedtrqUnits->setText(trq_metric_revolute);
606 ui->labelTorquetrqUnits->setText(trq_metric_revolute);
607 ui->labelPWMtrqUnits->setText(trq_metric_revolute);
608 ui->labelCurrenttrqUnits->setText(pos_metric_revolute);
609 ui->labelVelocitytrqUnits->setText(trq_metric_revolute);
610 }
612 {
613 ui->labelIdlevelUnits->setText(vel_metric_prism);
614 ui->labelPositionvelUnits->setText(vel_metric_prism);
615 ui->labelPositionDirvelUnits->setText(vel_metric_prism);
616 ui->labelMixedvelUnits->setText(vel_metric_prism);
617 ui->labelTorquevelUnits->setText(vel_metric_prism);
618 ui->labelPWMvelUnits->setText(vel_metric_prism);
619 ui->labelCurrentvelUnits->setText(vel_metric_prism);
620 ui->labelVelocityvelUnits->setText(vel_metric_prism);
621
622 ui->labelIdleTorque->setText(trq_metric_prism_title);
623 ui->labelPositionTorque->setText(trq_metric_prism_title);
624 ui->labelPositionDirTorque->setText(trq_metric_prism_title);
625 ui->labelMixedTorque->setText(trq_metric_prism_title);
626 ui->labelTorqueTorque->setText(trq_metric_prism_title);
627 ui->labelPWMTorque->setText(trq_metric_prism_title);
628 ui->labelCurrentTorque->setText(trq_metric_prism_title);
629 ui->labelVelocityTorque->setText(trq_metric_prism_title);
630
631 ui->labelIdleposUnits->setText(pos_metric_prism);
632 ui->labelPositionposUnits->setText(pos_metric_prism);
633 ui->labelPositionDirposUnits->setText(pos_metric_prism);
634 ui->labelMixedposUnits->setText(pos_metric_prism);
635 ui->labelTorqueposUnits->setText(pos_metric_prism);
636 ui->labelPWMposUnits->setText(pos_metric_prism);
637 ui->labelCurrentposUnits->setText(pos_metric_prism);
638 ui->labelVelocityposUnits->setText(pos_metric_prism);
639 ui->labelFaultposUnits->setText(pos_metric_prism);
640
641 //ui->labelIdleMotorPosUnits->setText(pos_metric_prism);
642 //ui->labelFaultMotorPosUnits->setText(pos_metric_prism);
643
644 ui->labelIdletrqUnits->setText(trq_metric_prism);
645 ui->labelPositiontrqUnits->setText(trq_metric_prism);
646 ui->labelPositionDirtrqUnits->setText(trq_metric_prism);
647 ui->labelMixedtrqUnits->setText(trq_metric_prism);
648 ui->labelTorquetrqUnits->setText(trq_metric_prism);
649 ui->labelPWMtrqUnits->setText(trq_metric_prism);
650 ui->labelCurrenttrqUnits->setText(trq_metric_prism);
651 ui->labelVelocitytrqUnits->setText(trq_metric_prism);
652 }
653 else
654 {
655 yFatal("Unspecified joint type");
656 }
657}
658
660{
661 joint_motorPositionVisible = visible;
662 ui->editIdleMotorPos->setVisible(visible);
663 ui->editPositionMotorPos->setVisible(visible);
664 ui->editPositionDirMotorPos->setVisible(visible);
665 ui->editMixedMotorPos->setVisible(visible);
666 ui->editTorqueMotorPos->setVisible(visible);
667 ui->editPWMMotorPos->setVisible(visible);
668 ui->editCurrentMotorPos->setVisible(visible);
669 ui->editVelocityMotorPos->setVisible(visible);
670 ui->editFaultMotorPos->setVisible(visible);
671
672 ui->labelIdleMotorPos->setVisible(visible);
673 ui->labelPositionMotorPos->setVisible(visible);
674 ui->labelPositionDirMotorPos->setVisible(visible);
675 ui->labelMixedMotorPos->setVisible(visible);
676 ui->labelTorqueMotorPos->setVisible(visible);
677 ui->labelPWMMotorPos->setVisible(visible);
678 ui->labelCurrentMotorPos->setVisible(visible);
679 ui->labelVelocityMotorPos->setVisible(visible);
680 ui->labelFaultMotorPos->setVisible(visible);
681
682 ui->labelIdleMotorPosUnits->setVisible(visible);
683 ui->labelPositionMotorPosUnits->setVisible(visible);
684 ui->labelPositionDirMotorPosUnits->setVisible(visible);
685 ui->labelMixedMotorPosUnits->setVisible(visible);
686 ui->labelTorqueMotorPosUnits->setVisible(visible);
687 ui->labelPWMMotorPosUnits->setVisible(visible);
688 ui->labelCurrentMotorPosUnits->setVisible(visible);
689 ui->labelVelocityMotorPosUnits->setVisible(visible);
690 ui->labelFaultMotorPosUnits->setVisible(visible);
691
692 if (!visible) {
693 ui->editIdleMotorPos->setMinimumHeight(0);
694 ui->editPositionMotorPos->setMinimumHeight(0);
695 ui->editPositionDirMotorPos->setMinimumHeight(0);
696 ui->editMixedMotorPos->setMinimumHeight(0);
697 ui->editTorqueMotorPos->setMinimumHeight(0);
698 ui->editPWMMotorPos->setMinimumHeight(0);
699 ui->editCurrentMotorPos->setMinimumHeight(0);
700 ui->editVelocityMotorPos->setMinimumHeight(0);
701 ui->editFaultMotorPos->setMinimumHeight(0);
702
703 ui->labelPositionMotorPos->setMinimumHeight(0);
704 ui->labelPositionMotorPosUnits->setMinimumHeight(0);
705 ui->labelPositionDirMotorPos->setMinimumHeight(0);
706 ui->labelPositionDirMotorPosUnits->setMinimumHeight(0);
707 ui->labelMixedMotorPos->setMinimumHeight(0);
708 ui->labelMixedMotorPosUnits->setMinimumHeight(0);
709 ui->labelTorqueMotorPos->setMinimumHeight(0);
710 ui->labelTorqueMotorPosUnits->setMinimumHeight(0);
711 ui->labelPWMMotorPos->setMinimumHeight(0);
712 ui->labelPWMMotorPosUnits->setMinimumHeight(0);
713 ui->labelCurrentMotorPos->setMinimumHeight(0);
714 ui->labelCurrentMotorPosUnits->setMinimumHeight(0);
715 ui->labelVelocityMotorPos->setMinimumHeight(0);
716 ui->labelVelocityMotorPosUnits->setMinimumHeight(0);
717 ui->labelIdleMotorPos->setMinimumHeight(0);
718 ui->labelIdleMotorPosUnits->setMinimumHeight(0);
719 ui->labelFaultMotorPos->setMinimumHeight(0);
720 ui->labelFaultMotorPosUnits->setMinimumHeight(0);
721 }
722 else {
723 ui->editIdleMotorPos->setMinimumHeight(20);
724 ui->editPositionMotorPos->setMinimumHeight(20);
725 ui->editPositionDirMotorPos->setMinimumHeight(20);
726 ui->editMixedMotorPos->setMinimumHeight(20);
727 ui->editTorqueMotorPos->setMinimumHeight(20);
728 ui->editPWMMotorPos->setMinimumHeight(20);
729 ui->editCurrentMotorPos->setMinimumHeight(20);
730 ui->editVelocityMotorPos->setMinimumHeight(20);
731 ui->editFaultMotorPos->setMinimumHeight(20);
732
733 ui->labelPositionMotorPos->setMinimumHeight(20);
734 ui->labelPositionMotorPosUnits->setMinimumHeight(20);
735 ui->labelPositionDirMotorPos->setMinimumHeight(20);
736 ui->labelPositionDirMotorPosUnits->setMinimumHeight(20);
737 ui->labelMixedMotorPos->setMinimumHeight(20);
738 ui->labelMixedMotorPosUnits->setMinimumHeight(20);
739 ui->labelTorqueMotorPos->setMinimumHeight(20);
740 ui->labelTorqueMotorPosUnits->setMinimumHeight(20);
741 ui->labelPWMMotorPos->setMinimumHeight(20);
742 ui->labelPWMMotorPosUnits->setMinimumHeight(20);
743 ui->labelCurrentMotorPos->setMinimumHeight(20);
744 ui->labelCurrentMotorPosUnits->setMinimumHeight(20);
745 ui->labelVelocityMotorPos->setMinimumHeight(20);
746 ui->labelVelocityMotorPosUnits->setMinimumHeight(20);
747 ui->labelIdleMotorPos->setMinimumHeight(20);
748 ui->labelIdleMotorPosUnits->setMinimumHeight(20);
749 ui->labelFaultMotorPos->setMinimumHeight(20);
750 ui->labelFaultMotorPosUnits->setMinimumHeight(20);
751 }
752}
753
755{
756 joint_dutyVisible = visible;
757 //ui->editIdleDuty->setVisible(visible);
758 //ui->editPositionDuty->setVisible(visible);
759 //ui->editPositionDirDuty->setVisible(visible);
760 // ui->editMixedDuty->setVisible(visible);
761 ui->editTorqueDuty->setVisible(visible);
762 ui->editCurrentDuty->setVisible(visible);
763 //ui->editPWMDuty->setVisible(visible);
764 //ui->editDutyDuty->setVisible(visible);
765 //ui->editVelocityDuty->setVisible(visible);
766
767 //ui->labelIdleDuty->setVisible(visible);
768 //ui->labelIdleDutyUnits->setVisible(visible);
769 //ui->labelPositionDuty->setVisible(visible);
770 //ui->labelPositionDutyUnits->setVisible(visible);
771 //ui->labelPositionDirDuty->setVisible(visible);
772 //ui->labelPositionDirDutyUnits->setVisible(visible);
773 //ui->labelMixedDuty->setVisible(visible);
774 //ui->labelMixedDutyUnits->setVisible(visible);
775 ui->labelTorqueDuty->setVisible(visible);
776 ui->labelTorqueDutyUnits->setVisible(visible);
777 //ui->labelPWMDuty->setVisible(visible);
778 ui->labelCurrentDuty->setVisible(visible);
779 //ui->labelPWMDutyUnits->setVisible(visible);
780 ui->labelCurrentDutyUnits->setVisible(visible);
781 //ui->labelVelocityDuty->setVisible(visible);
782 //ui->labelVelocityDutyUnits->setVisible(visible);
783
784
785 if (!visible) {
786 //ui->editIdleDuty->setMinimumHeight(0);
787 //ui->editPositionDuty->setMinimumHeight(0);
788 //ui->editPositionDirDuty->setMinimumHeight(0);
789 //ui->editMixedDuty->setMinimumHeight(0);
790 //ui->editTorqueDuty->setMinimumHeight(0);
791 //ui->editPWMDuty->setMinimumHeight(0);
792 //ui->editDutyDuty->setMinimumHeight(0);
793 //ui->editVelocityDuty->setMinimumHeight(0);
794
795 //ui->labelPositionDuty->setMinimumHeight(0);
796 //ui->labelPositionDutyUnits->setMinimumHeight(0);
797 //ui->labelPositionDirDuty->setMinimumHeight(0);
798 //ui->labelPositionDirDutyUnits->setMinimumHeight(0);
799 //ui->labelMixedDuty->setMinimumHeight(0);
800 //ui->labelMixedDutyUnits->setMinimumHeight(0);
801 ui->labelTorqueDuty->setMinimumHeight(0);
802 ui->labelTorqueDutyUnits->setMinimumHeight(0);
803 //ui->labelPWMDuty->setMinimumHeight(0);
804 //ui->labelPWMDutyUnits->setMinimumHeight(0);
805 ui->labelCurrentDuty->setMinimumHeight(0);
806 ui->labelCurrentDutyUnits->setMinimumHeight(0);
807 //ui->labelVelocityDuty->setMinimumHeight(0);
808 //ui->labelVelocityDutyUnits->setMinimumHeight(0);
809 //ui->labelIdleDuty->setMinimumHeight(0);
810 //ui->labelIdleDutyUnits->setMinimumHeight(0);
811 }
812 else {
813 //ui->editIdleDuty->setMinimumHeight(20);
814 //ui->editPositionDuty->setMinimumHeight(20);
815 //ui->editPositionDirDuty->setMinimumHeight(20);
816 //ui->editMixedDuty->setMinimumHeight(20);
817 ui->editTorqueDuty->setMinimumHeight(20);
818 //ui->editPWMDuty->setMinimumHeight(20);
819 ui->editCurrentDuty->setMinimumHeight(20);
820 //ui->editVelocityDuty->setMinimumHeight(20);
821
822 //ui->labelPositionDuty->setMinimumHeight(20);
823 //ui->labelPositionDutyUnits->setMinimumHeight(20);
824 //ui->labelPositionDirDuty->setMinimumHeight(20);
825 //ui->labelPositionDirDutyUnits->setMinimumHeight(20);
826 //ui->labelMixedDuty->setMinimumHeight(20);
827 //ui->labelMixedDutyUnits->setMinimumHeight(20);
828 ui->labelTorqueDuty->setMinimumHeight(20);
829 ui->labelTorqueDutyUnits->setMinimumHeight(20);
830 //ui->labelPWMDuty->setMinimumHeight(20);
831 //ui->labelPWMDutyUnits->setMinimumHeight(20);
832 ui->labelCurrentDuty->setMinimumHeight(20);
833 ui->labelCurrentDutyUnits->setMinimumHeight(20);
834 //ui->labelVelocityDuty->setMinimumHeight(20);
835 //ui->labelVelocityDutyUnits->setMinimumHeight(20);
836 //ui->labelIdleDuty->setMinimumHeight(20);
837 //ui->labelIdleDutyUnits->setMinimumHeight(20);
838 }
839}
840
842{
843 joint_currentVisible = visible;
844 ui->editIdleCurrent->setVisible(visible);
845 ui->editPositionCurrent->setVisible(visible);
846 ui->editPositionDirCurrent->setVisible(visible);
847 ui->editMixedCurrent->setVisible(visible);
848 ui->editTorqueCurrent->setVisible(visible);
849 ui->editPWMCurrent->setVisible(visible);
850 //ui->editCurrentCurrent->setVisible(visible);
851 ui->editVelocityCurrent->setVisible(visible);
852
853 ui->labelIdleCurrent->setVisible(visible);
854 ui->labelIdleCurrentUnits->setVisible(visible);
855 ui->labelPositionCurrent->setVisible(visible);
856 ui->labelPositionCurrentUnits->setVisible(visible);
857 ui->labelPositionDirCurrent->setVisible(visible);
858 ui->labelPositionDirCurrentUnits->setVisible(visible);
859 ui->labelMixedCurrent->setVisible(visible);
860 ui->labelMixedCurrentUnits->setVisible(visible);
861 ui->labelTorqueCurrent->setVisible(visible);
862 ui->labelTorqueCurrentUnits->setVisible(visible);
863 ui->labelPWMCurrent->setVisible(visible);
864 //ui->labelCurrentCurrent->setVisible(visible);
865 ui->labelPWMCurrentUnits->setVisible(visible);
866 //ui->labelCurrentCurrentUnits->setVisible(visible);
867 ui->labelVelocityCurrent->setVisible(visible);
868 ui->labelVelocityCurrentUnits->setVisible(visible);
869
870
871 if (!visible) {
872 ui->editIdleCurrent->setMinimumHeight(0);
873 ui->editPositionCurrent->setMinimumHeight(0);
874 ui->editPositionDirCurrent->setMinimumHeight(0);
875 ui->editMixedCurrent->setMinimumHeight(0);
876 ui->editTorqueCurrent->setMinimumHeight(0);
877 ui->editPWMCurrent->setMinimumHeight(0);
878 //ui->editCurrentCurrent->setMinimumHeight(0);
879 ui->editVelocityCurrent->setMinimumHeight(0);
880
881 ui->labelPositionCurrent->setMinimumHeight(0);
882 ui->labelPositionCurrentUnits->setMinimumHeight(0);
883 ui->labelPositionDirCurrent->setMinimumHeight(0);
884 ui->labelPositionDirCurrentUnits->setMinimumHeight(0);
885 ui->labelMixedCurrent->setMinimumHeight(0);
886 ui->labelMixedCurrentUnits->setMinimumHeight(0);
887 ui->labelTorqueCurrent->setMinimumHeight(0);
888 ui->labelTorqueCurrentUnits->setMinimumHeight(0);
889 ui->labelPWMCurrent->setMinimumHeight(0);
890 ui->labelPWMCurrentUnits->setMinimumHeight(0);
891 //ui->labelCurrentCurrent->setMinimumHeight(0);
892 //ui->labelCurrentCurrentUnits->setMinimumHeight(0);
893 ui->labelVelocityCurrent->setMinimumHeight(0);
894 ui->labelVelocityCurrentUnits->setMinimumHeight(0);
895 ui->labelIdleCurrent->setMinimumHeight(0);
896 ui->labelIdleCurrentUnits->setMinimumHeight(0);
897 }
898 else {
899 ui->editIdleCurrent->setMinimumHeight(20);
900 ui->editPositionCurrent->setMinimumHeight(20);
901 ui->editPositionDirCurrent->setMinimumHeight(20);
902 ui->editMixedCurrent->setMinimumHeight(20);
903 ui->editTorqueCurrent->setMinimumHeight(20);
904 ui->editPWMCurrent->setMinimumHeight(20);
905 //ui->editCurrentCurrent->setMinimumHeight(20);
906 ui->editVelocityCurrent->setMinimumHeight(20);
907
908 ui->labelPositionCurrent->setMinimumHeight(20);
909 ui->labelPositionCurrentUnits->setMinimumHeight(20);
910 ui->labelPositionDirCurrent->setMinimumHeight(20);
911 ui->labelPositionDirCurrentUnits->setMinimumHeight(20);
912 ui->labelMixedCurrent->setMinimumHeight(20);
913 ui->labelMixedCurrentUnits->setMinimumHeight(20);
914 ui->labelTorqueCurrent->setMinimumHeight(20);
915 ui->labelTorqueCurrentUnits->setMinimumHeight(20);
916 ui->labelPWMCurrent->setMinimumHeight(20);
917 ui->labelPWMCurrentUnits->setMinimumHeight(20);
918 //ui->labelCurrentCurrent->setMinimumHeight(20);
919 //ui->labelCurrentCurrentUnits->setMinimumHeight(20);
920 ui->labelVelocityCurrent->setMinimumHeight(20);
921 ui->labelVelocityCurrentUnits->setMinimumHeight(20);
922 ui->labelIdleCurrent->setMinimumHeight(20);
923 ui->labelIdleCurrentUnits->setMinimumHeight(20);
924 }
925}
926
928{
929 joint_speedVisible = visible;
930 ui->editIdleSpeed->setVisible(visible);
931 ui->editPositionSpeed->setVisible(visible);
932 ui->editPositionDirSpeed->setVisible(visible);
933 ui->editMixedSpeed->setVisible(visible);
934 ui->editTorqueSpeed->setVisible(visible);
935 ui->editPWMSpeed->setVisible(visible);
936 ui->editCurrentSpeed->setVisible(visible);
937 ui->editVelocitySpeed->setVisible(visible);
938
939 ui->labelIdleSpeed->setVisible(visible);
940 ui->labelIdlevelUnits->setVisible(visible);
941 ui->labelPositionSpeed->setVisible(visible);
942 ui->labelPositionvelUnits->setVisible(visible);
943 ui->labelPositionDirSpeed->setVisible(visible);
944 ui->labelPositionDirvelUnits->setVisible(visible);
945 ui->labelMixedSpeed->setVisible(visible);
946 ui->labelMixedvelUnits->setVisible(visible);
947 ui->labelTorqueSpeed->setVisible(visible);
948 ui->labelTorquevelUnits->setVisible(visible);
949 ui->labelPWMSpeed->setVisible(visible);
950 ui->labelCurrentSpeed->setVisible(visible);
951 ui->labelPWMvelUnits->setVisible(visible);
952 ui->labelCurrentvelUnits->setVisible(visible);
953 ui->labelVelocitySpeed->setVisible(visible);
954 ui->labelVelocityvelUnits->setVisible(visible);
955
956
957 if(!visible){
958 ui->editIdleSpeed->setMinimumHeight(0);
959 ui->editPositionSpeed->setMinimumHeight(0);
960 ui->editPositionDirSpeed->setMinimumHeight(0);
961 ui->editMixedSpeed->setMinimumHeight(0);
962 ui->editTorqueSpeed->setMinimumHeight(0);
963 ui->editPWMSpeed->setMinimumHeight(0);
964 ui->editCurrentSpeed->setMinimumHeight(0);
965 ui->editVelocitySpeed->setMinimumHeight(0);
966
967 ui->labelPositionSpeed->setMinimumHeight(0);
968 ui->labelPositionvelUnits->setMinimumHeight(0);
969 ui->labelPositionDirSpeed->setMinimumHeight(0);
970 ui->labelPositionDirvelUnits->setMinimumHeight(0);
971 ui->labelMixedSpeed->setMinimumHeight(0);
972 ui->labelMixedvelUnits->setMinimumHeight(0);
973 ui->labelTorqueSpeed->setMinimumHeight(0);
974 ui->labelTorquevelUnits->setMinimumHeight(0);
975 ui->labelPWMSpeed->setMinimumHeight(0);
976 ui->labelPWMvelUnits->setMinimumHeight(0);
977 ui->labelCurrentSpeed->setMinimumHeight(0);
978 ui->labelCurrentvelUnits->setMinimumHeight(0);
979 ui->labelVelocitySpeed->setMinimumHeight(0);
980 ui->labelVelocityvelUnits->setMinimumHeight(0);
981 ui->labelIdleSpeed->setMinimumHeight(0);
982 ui->labelIdlevelUnits->setMinimumHeight(0);
983 }else{
984 ui->editIdleSpeed->setMinimumHeight(20);
985 ui->editPositionSpeed->setMinimumHeight(20);
986 ui->editPositionDirSpeed->setMinimumHeight(20);
987 ui->editMixedSpeed->setMinimumHeight(20);
988 ui->editTorqueSpeed->setMinimumHeight(20);
989 ui->editPWMSpeed->setMinimumHeight(20);
990 ui->editCurrentSpeed->setMinimumHeight(20);
991 ui->editVelocitySpeed->setMinimumHeight(20);
992
993 ui->labelPositionSpeed->setMinimumHeight(20);
994 ui->labelPositionvelUnits->setMinimumHeight(20);
995 ui->labelPositionDirSpeed->setMinimumHeight(20);
996 ui->labelPositionDirvelUnits->setMinimumHeight(20);
997 ui->labelMixedSpeed->setMinimumHeight(20);
998 ui->labelMixedvelUnits->setMinimumHeight(20);
999 ui->labelTorqueSpeed->setMinimumHeight(20);
1000 ui->labelTorquevelUnits->setMinimumHeight(20);
1001 ui->labelPWMSpeed->setMinimumHeight(20);
1002 ui->labelPWMvelUnits->setMinimumHeight(20);
1003 ui->labelCurrentSpeed->setMinimumHeight(20);
1004 ui->labelCurrentvelUnits->setMinimumHeight(20);
1005 ui->labelVelocitySpeed->setMinimumHeight(20);
1006 ui->labelVelocityvelUnits->setMinimumHeight(20);
1007 ui->labelIdleSpeed->setMinimumHeight(20);
1008 ui->labelIdlevelUnits->setMinimumHeight(20);
1009 }
1010}
1011
1013{
1014 double positionSliderStep = 1 / (fabs(min_position - max_position) / 100.0);
1015 ui->sliderMixedPosition->setSliderStep(positionSliderStep);
1016 ui->sliderTrajectoryPosition->setSliderStep(positionSliderStep);
1017 ui->sliderDirectPosition->setSliderStep(positionSliderStep);
1018 ui->sliderMixedPosition->setIsDouble(true);
1019 ui->sliderTrajectoryPosition->setIsDouble(true);
1020 ui->sliderDirectPosition->setIsDouble(true);
1021 int sliderMin = min_position*positionSliderStep;
1022 int sliderMax = max_position*positionSliderStep;
1023 ui->sliderMixedPosition->setRange(sliderMin, sliderMax);
1024 ui->sliderTrajectoryPosition->setRange(sliderMin, sliderMax);
1025 ui->sliderDirectPosition->setRange(sliderMin, sliderMax);
1026 ui->sliderMixedPosition->resetTarget();
1027 ui->sliderTrajectoryPosition->resetTarget();
1028 ui->sliderDirectPosition->resetTarget();
1029}
1030
1032{
1033 double positionSliderStep = 1 / value;
1034 ui->sliderMixedPosition->setSliderStep(positionSliderStep);
1035 ui->sliderTrajectoryPosition->setSliderStep(positionSliderStep);
1036 ui->sliderDirectPosition->setSliderStep(positionSliderStep);
1037 ui->sliderMixedPosition->setIsDouble(true);
1038 ui->sliderTrajectoryPosition->setIsDouble(true);
1039 ui->sliderDirectPosition->setIsDouble(true);
1040 int sliderMin = min_position*positionSliderStep;
1041 int sliderMax = max_position*positionSliderStep;
1042 ui->sliderMixedPosition->setRange(sliderMin, sliderMax);
1043 ui->sliderTrajectoryPosition->setRange(sliderMin, sliderMax);
1044 ui->sliderDirectPosition->setRange(sliderMin, sliderMax);
1045 ui->sliderMixedPosition->resetTarget();
1046 ui->sliderTrajectoryPosition->resetTarget();
1047 ui->sliderDirectPosition->resetTarget();
1048}
1049
1051{
1052 ui->sliderMixedPosition->number_of_decimals=num;
1053 ui->sliderTrajectoryPosition->number_of_decimals = num;
1054 ui->sliderDirectPosition->number_of_decimals = num;
1055 ui->sliderMixedPosition->number_of_decimals = num;
1056 ui->sliderTrajectoryPosition->number_of_decimals = num;
1057 ui->sliderDirectPosition->number_of_decimals = num;
1058}
1059
1061{
1062 if (fabs(max_position - min_position) < 1.0)
1063 {
1064 yError("Unable to set integer position slider");
1065 return;
1066 }
1067 double positionSliderStep = 1;
1068 ui->sliderMixedPosition->setSliderStep(positionSliderStep);
1069 ui->sliderTrajectoryPosition->setSliderStep(positionSliderStep);
1070 ui->sliderDirectPosition->setSliderStep(positionSliderStep);
1071 ui->sliderMixedPosition->setIsDouble(false);
1072 ui->sliderTrajectoryPosition->setIsDouble(false);
1073 ui->sliderDirectPosition->setIsDouble(false);
1074 int sliderMin = min_position;
1075 int sliderMax = max_position;
1076 ui->sliderMixedPosition->setRange(sliderMin, sliderMax);
1077 ui->sliderTrajectoryPosition->setRange(sliderMin, sliderMax);
1078 ui->sliderDirectPosition->setRange(sliderMin, sliderMax);
1079 ui->sliderMixedPosition->resetTarget();
1080 ui->sliderTrajectoryPosition->resetTarget();
1081 ui->sliderDirectPosition->resetTarget();
1082}
1083
1085{
1086 double velocitySliderStep = 1 / (fabs(-max_velocity - max_velocity) / 100.0); //note that we are using -max_velocity
1087 ui->sliderVelocityVelocity->setSliderStep(velocitySliderStep);
1088 ui->sliderVelocityVelocity->setIsDouble(true);
1089 int sliderMin = -max_velocity*velocitySliderStep; //note that we are using -max_velocity
1090 int sliderMax = max_velocity*velocitySliderStep;
1091 ui->sliderVelocityVelocity->setRange(sliderMin, sliderMax);
1092 int v = ui->sliderVelocityVelocity->value();
1093 if (v > sliderMax) {}
1094 if (v < sliderMin) {}
1095 setRefVelocitySpeed(ref_speed);
1096}
1097
1099{
1100 double velocitySliderStep = 1 / value;
1101 ui->sliderVelocityVelocity->setSliderStep(velocitySliderStep);
1102 ui->sliderVelocityVelocity->setIsDouble(true);
1103 int sliderMin = -max_velocity*velocitySliderStep; //note that we are using -max_velocity
1104 int sliderMax = max_velocity*velocitySliderStep;
1105 ui->sliderVelocityVelocity->setRange(sliderMin, sliderMax);
1106 int v = ui->sliderVelocityVelocity->value();
1107 if (v > sliderMax) {}
1108 if (v < sliderMin) {}
1109 setRefVelocitySpeed(ref_speed);
1110}
1111
1113{
1114 if (fabs(max_velocity) < 1.0)
1115 {
1116 yError("Unable to set integer velocity slider");
1117 return;
1118 }
1119 double velocitySliderStep = 1;
1120 ui->sliderVelocityVelocity->setSliderStep(velocitySliderStep);
1121 ui->sliderVelocityVelocity->setIsDouble(false);
1122 int sliderMin = -max_velocity; //note that we are using -max_velocity
1123 int sliderMax = max_velocity;
1124 ui->sliderVelocityVelocity->setRange(sliderMin, sliderMax);
1125 int v = ui->sliderVelocityVelocity->value();
1126 if (v > sliderMax) {}
1127 if (v < sliderMin) {}
1128 setRefVelocitySpeed(ref_speed);
1129}
1130
1132{
1133 double torqueSliderStep = 1 / (fabs(-max_torque - max_torque) / 100.0); //note that we are using -max_velocity
1134 ui->sliderTorqueTorque->setSliderStep(torqueSliderStep);
1135 ui->sliderTorqueTorque->setIsDouble(true);
1136 int sliderMin = -max_torque*torqueSliderStep; //note that we are using -max_torque
1137 int sliderMax = max_torque*torqueSliderStep;
1138 ui->sliderTorqueTorque->setRange(sliderMin, sliderMax);
1139 int v = ui->sliderTorqueTorque->value();
1140 if (v > sliderMax) {}
1141 if (v < sliderMin) {}
1142 setRefTorque(ref_torque);
1143}
1144
1146{
1147 double torqueSliderStep = 1 / value;
1148 ui->sliderTorqueTorque->setSliderStep(torqueSliderStep);
1149 ui->sliderTorqueTorque->setIsDouble(true);
1150 int sliderMin = -max_torque*torqueSliderStep; //note that we are using -max_torque
1151 int sliderMax = max_torque*torqueSliderStep;
1152 ui->sliderTorqueTorque->setRange(sliderMin, sliderMax);
1153 int v = ui->sliderTorqueTorque->value();
1154 if (v > sliderMax) {}
1155 if (v < sliderMin) {}
1156 setRefTorque(ref_torque);
1157}
1158
1160{
1161 if (fabs(max_torque) < 1.0)
1162 {
1163 yError("Unable to set integer torque slider");
1164 return;
1165 }
1166 double torqueSliderStep = 1;
1167 ui->sliderTorqueTorque->setSliderStep(torqueSliderStep);
1168 ui->sliderTorqueTorque->setIsDouble(false);
1169 int sliderMin = -max_torque; //note that we are using -max_torque
1170 int sliderMax = max_torque;
1171 ui->sliderTorqueTorque->setRange(sliderMin, sliderMax);
1172 int v = ui->sliderTorqueTorque->value();
1173 if (v > sliderMax) {}
1174 if (v < sliderMin) {}
1175 setRefTorque(ref_torque);
1176}
1177
1179{
1180 double currentSliderStep = 1 / (fabs(-max_current - max_current) / 100.0); //note that we are using -max_velocity
1181 ui->sliderCurrentOutput->setSliderStep(currentSliderStep);
1182 ui->sliderCurrentOutput->setIsDouble(true);
1183 int sliderMin = -max_current*currentSliderStep; //note that we are using -max_current
1184 int sliderMax = max_current*currentSliderStep;
1185 ui->sliderCurrentOutput->setRange(sliderMin, sliderMax);
1186 int v = ui->sliderCurrentOutput->value();
1187 if (v > sliderMax) {}
1188 if (v < sliderMin) {}
1189 setRefCurrent(ref_current);
1190}
1191
1193{
1194 double currentSliderStep = 1 / value;
1195 ui->sliderCurrentOutput->setSliderStep(currentSliderStep);
1196 ui->sliderCurrentOutput->setIsDouble(true);
1197 int sliderMin = -max_current*currentSliderStep; //note that we are using -max_current
1198 int sliderMax = max_current*currentSliderStep;
1199 ui->sliderCurrentOutput->setRange(sliderMin, sliderMax);
1200 int v = ui->sliderCurrentOutput->value();
1201 if (v > sliderMax) {}
1202 if (v < sliderMin) {}
1203 setRefCurrent(ref_current);
1204}
1205
1207{
1208 if (fabs(max_velocity) < 1.0)
1209 {
1210 yError("Unable to set integer velocity slider");
1211 return;
1212 }
1213 double currentSliderStep = 1;
1214 ui->sliderCurrentOutput->setSliderStep(currentSliderStep);
1215 ui->sliderCurrentOutput->setIsDouble(false);
1216 int sliderMin = -max_current; //note that we are using -max_current
1217 int sliderMax = max_current;
1218 ui->sliderCurrentOutput->setRange(sliderMin, sliderMax);
1219 int v = ui->sliderCurrentOutput->value();
1220 if (v > sliderMax) {}
1221 if (v < sliderMin) {}
1222 setRefCurrent(ref_current);
1223}
1224
1226{
1227 double trajectoryVelocitySliderStep = 1 / (fabs(0 - max_trajectory_velocity) / 100.0); //note that we are using 0
1228 ui->sliderTrajectoryVelocity->setSliderStep(trajectoryVelocitySliderStep);
1229 ui->sliderTrajectoryVelocity->setIsDouble(true);
1230 int sliderMin = 0 * trajectoryVelocitySliderStep; //note that we are using 0
1231 int sliderMax = max_trajectory_velocity*trajectoryVelocitySliderStep;
1232 ui->sliderTrajectoryVelocity->setRange(sliderMin, sliderMax);
1233 int v = ui->sliderTrajectoryVelocity->value();
1234 if (v > sliderMax) {}
1235 if (v < sliderMin) {}
1236 setRefTrajectorySpeed(ref_trajectory_velocity);
1237}
1238
1240{
1241 double trajectoryVelocitySliderStep = 1 / value;
1242 ui->sliderTrajectoryVelocity->setSliderStep(trajectoryVelocitySliderStep);
1243 ui->sliderTrajectoryVelocity->setIsDouble(true);
1244 int sliderMin = 0 * trajectoryVelocitySliderStep; //note that we are using 0
1245 int sliderMax = max_trajectory_velocity*trajectoryVelocitySliderStep;
1246 ui->sliderTrajectoryVelocity->setRange(sliderMin, sliderMax);
1247 int v = ui->sliderTrajectoryVelocity->value();
1248 if (v > sliderMax) {}
1249 if (v < sliderMin) {}
1250 setRefTrajectorySpeed(ref_trajectory_velocity);
1251}
1252
1254{
1255 int sliderMin = 0; //note that we are using 0
1256 int sliderMax = max_trajectory_velocity;
1257 double trajectoryVelocitySliderStep = 1;
1258 ui->sliderTrajectoryVelocity->setSliderStep(trajectoryVelocitySliderStep);
1259 ui->sliderTrajectoryVelocity->setRange(sliderMin, sliderMax);
1260 ui->sliderTrajectoryVelocity->setIsDouble(false);
1261 int v = ui->sliderTrajectoryVelocity->value();
1262 if (v > sliderMax) {}
1263 if (v < sliderMin) {}
1264 setRefTrajectorySpeed(ref_trajectory_velocity);
1265}
1266
1269 bool enable_calib_all)
1270{
1271 Q_UNUSED(debug_param_enabled);
1272 Q_UNUSED(speedview_param_enabled);
1273
1274 enableCalib = enable_calib_all;
1275 if (!enable_calib_all){
1276 ui->buttonCalib->setEnabled(false);
1277 }
1278
1279 connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(onStackedWidgetChanged(int)));
1280}
1281
1283{
1284 disconnect(ui->comboMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onModeChanged(int)));
1285 disconnect(ui->comboInteraction,SIGNAL(currentIndexChanged(int)),this,SLOT(onInteractionChanged(int)));
1286
1287 disconnect(ui->sliderTrajectoryPosition,SIGNAL(sliderPressed()),this,SLOT(onSliderTrajectoryPositionPressed()));
1288 disconnect(ui->sliderTrajectoryPosition,SIGNAL(sliderReleased()),this,SLOT(onSliderTrajectoryPositionReleased()));
1289
1290 disconnect(ui->sliderTorqueTorque,SIGNAL(sliderPressed()),this,SLOT(onSliderTorquePressed()));
1291 disconnect(ui->sliderTorqueTorque,SIGNAL(sliderReleased()),this,SLOT(onSliderTorqueReleased()));
1292
1293 disconnect(ui->sliderPWMOutput, SIGNAL(sliderPressed()), this, SLOT(onSliderPWMPressed()));
1294 disconnect(ui->sliderPWMOutput, SIGNAL(sliderReleased()), this, SLOT(onSliderPWMReleased()));
1295
1296 disconnect(ui->sliderCurrentOutput, SIGNAL(sliderPressed()), this, SLOT(onSliderCurrentPressed()));
1297 disconnect(ui->sliderCurrentOutput, SIGNAL(sliderReleased()), this, SLOT(onSliderCurrentPressed()));
1298
1299 disconnect(ui->sliderDirectPosition, SIGNAL(sliderPressed()), this, SLOT(onSliderDirectPositionPressed()));
1300 disconnect(ui->sliderDirectPosition, SIGNAL(sliderReleased()), this, SLOT(onSliderDirectPositionReleased()));
1301
1302 disconnect(ui->sliderMixedPosition,SIGNAL(sliderPressed()),this,SLOT(onSliderMixedPositionPressed()));
1303 disconnect(ui->sliderMixedPosition,SIGNAL(sliderReleased()),this,SLOT(onSliderMixedPositionReleased()));
1304
1305 disconnect(ui->sliderTrajectoryVelocity, SIGNAL(sliderPressed()), this, SLOT(onSliderTrajectoryVelocityPressed()));
1306 disconnect(ui->sliderMixedVelocity, SIGNAL(sliderReleased()), this, SLOT(onSliderMixedVelocityReleased()));
1307
1308 disconnect(ui->buttonHome,SIGNAL(clicked()),this,SLOT(onHomeClicked()));
1309 disconnect(ui->buttonIdle,SIGNAL(clicked()),this,SLOT(onIdleClicked()));
1310 disconnect(ui->buttonRun,SIGNAL(clicked()),this,SLOT(onRunClicked()));
1311 disconnect(ui->buttonPid,SIGNAL(clicked()),this,SLOT(onPidClicked()));
1312 disconnect(ui->buttonCalib,SIGNAL(clicked()),this,SLOT(onCalibClicked()));
1313 delete ui;
1314}
1315
1317{
1318 return jointIndex;
1319}
1320
1321void JointItem::installFilter()
1322{
1323 auto* filter = new WheelEventFilter();
1324 filter->setParent(this);
1325 ui->comboMode->installEventFilter(filter);
1326 ui->comboInteraction->installEventFilter(filter);
1327
1328 ui->sliderMixedPosition->installEventFilter(filter);
1329 ui->sliderMixedVelocity->installEventFilter(filter);
1330 ui->sliderDirectPosition->installEventFilter(filter);
1331 ui->sliderTrajectoryPosition->installEventFilter(filter);
1332 ui->sliderTrajectoryVelocity->installEventFilter(filter);
1333 ui->sliderTorqueTorque->installEventFilter(filter);
1334}
1335
1336
1337void JointItem::onStackedWidgetChanged(int index)
1338{
1339 if(index == VELOCITY){
1340 if(velocityModeEnabled){
1341 velocityTimer.start();
1342 }
1343 }else{
1344 if(velocityModeEnabled)
1345 {
1346 velocityTimer.stop();
1347 lastVelocity = 0;
1348 updateSliderVelocity(0);
1349 }
1350 }
1351}
1352
1353void JointItem::onModeChanged(int index)
1354{
1355 if (this->internalState == Velocity){
1356 velocityTimer.stop();
1357 }
1358 Q_UNUSED(index);
1359 int mode = ui->comboMode->currentData(Qt::UserRole).toInt();
1360 emit changeMode(mode,this);
1361}
1362
1363
1364void JointItem::onInteractionChanged(int index)
1365{
1366 emit changeInteraction(index,this);
1367}
1368
1369void JointItem::setJointName(QString name)
1370{
1371 jointName = name;
1372}
1373
1375{
1376 return jointName;
1377}
1378
1379void JointItem::onSliderVelocityPressed()
1380{
1381 sliderVelocityPressed = true;
1382}
1383
1384void JointItem::onSliderVelocityReleased()
1385{
1386 lastVelocity = (double)ui->sliderVelocityVelocity->value() / ui->sliderVelocityVelocity->getSliderStep();
1387 sliderVelocityPressed = false;
1388}
1389
1390void JointItem::onSliderMixedVelocityPressed()
1391{
1392 sliderMixedVelocityPressed = true;
1393}
1394
1395void JointItem::onSliderMixedVelocityReleased()
1396{
1397 lastVelocity = ui->sliderMixedVelocity->value();
1398
1399 if (ui->sliderMixedVelocity->getIsDouble())
1400 {
1401 double val = ui->sliderMixedVelocity->value();
1402 emit sliderMixedVelocityCommand(val / ui->sliderMixedVelocity->getSliderStep(), jointIndex);
1403 }
1404 else
1405 {
1406 emit sliderMixedVelocityCommand(ui->sliderMixedVelocity->value(), jointIndex);
1407 }
1408
1409 sliderMixedVelocityPressed = false;
1410}
1411
1412
1413void JointItem::onVelocityTimer()
1414{
1415 if(velocityModeEnabled)
1416 {
1417 emit sliderVelocityCommand(lastVelocity,jointIndex);
1418 }
1419}
1420
1421void JointItem::onSliderTrajectoryPositionPressed()
1422{
1423 sliderTrajectoryPositionPressed = true;
1424}
1425
1426void JointItem::onSliderTrajectoryPositionReleased()
1427{
1428 if (ui->sliderTrajectoryPosition->getIsDouble())
1429 {
1430 double val = ui->sliderTrajectoryPosition->value();
1431 emit sliderTrajectoryPositionCommand(val / ui->sliderTrajectoryPosition->getSliderStep(), jointIndex);
1432 updateTrajectoryPositionTarget(val / ui->sliderTrajectoryPosition->getSliderStep());
1433 }
1434 else
1435 {
1436 double val = ui->sliderTrajectoryPosition->value();
1437 emit sliderTrajectoryPositionCommand(val, jointIndex);
1438 updateTrajectoryPositionTarget(val);
1439 }
1440 sliderTrajectoryPositionPressed = false;
1441 motionDone = false;
1442}
1443
1444void JointItem::onSliderMixedPositionPressed()
1445{
1446 sliderMixedPositionPressed = true;
1447}
1448
1449void JointItem::onSliderMixedPositionReleased()
1450{
1451 if (ui->sliderMixedPosition->getIsDouble())
1452 {
1453 double val = ui->sliderMixedPosition->value();
1454 emit sliderMixedPositionCommand(val / ui->sliderMixedPosition->getSliderStep(), jointIndex);
1455 updateMixedPositionTarget(val / ui->sliderMixedPosition->getSliderStep());
1456 }
1457 else
1458 {
1459 double val = ui->sliderMixedPosition->value();
1460 emit sliderMixedPositionCommand(val, jointIndex);
1461 updateMixedPositionTarget(val);
1462 }
1463
1464 sliderMixedPositionPressed = false;
1465 motionDone = false;
1466}
1467
1468void JointItem::onSliderDirectPositionPressed()
1469{
1470 sliderDirectPositionPressed = true;
1471}
1472
1473void JointItem::onSliderDirectPositionReleased()
1474{
1475 double ref_direct_position = (double)ui->sliderDirectPosition->value() / ui->sliderDirectPosition->getSliderStep();
1476 emit sliderDirectPositionCommand(ref_direct_position, jointIndex);
1477 sliderDirectPositionPressed = false;
1478 motionDone = false;
1479}
1480
1481void JointItem::onSliderTrajectoryVelocityPressed()
1482{
1483 sliderTrajectoryVelocityPressed = true;
1484}
1485
1486void JointItem::onSliderTrajectoryVelocityReleased()
1487{
1488 ref_trajectory_velocity = (double)ui->sliderTrajectoryVelocity->value() / ui->sliderTrajectoryVelocity->getSliderStep();
1489 emit sliderTrajectoryVelocityCommand(ref_trajectory_velocity, jointIndex);
1490 sliderTrajectoryVelocityPressed = false;
1491}
1492
1493void JointItem::onSliderPWMPressed()
1494{
1495 sliderPWMPressed = true;
1496}
1497
1498void JointItem::onSliderPWMReleased()
1499{
1500 ref_pwm = (double)ui->sliderPWMOutput->value() / ui->sliderPWMOutput->getSliderStep();
1501 emit sliderPWMCommand(ref_pwm, jointIndex);
1502 sliderPWMPressed = false;
1503}
1504
1505void JointItem::onSliderCurrentPressed()
1506{
1507 sliderCurrentPressed = true;
1508}
1509
1510void JointItem::onSliderCurrentReleased()
1511{
1512 ref_current = (double)ui->sliderCurrentOutput->value() / ui->sliderCurrentOutput->getSliderStep();
1513 emit sliderCurrentCommand(ref_current, jointIndex);
1514 sliderCurrentPressed = false;
1515}
1516
1517void JointItem::onSliderTorquePressed()
1518{
1519 sliderTorquePressed = true;
1520}
1521
1522void JointItem::onSliderTorqueReleased()
1523{
1524 ref_torque = (double)ui->sliderTorqueTorque->value() / ui->sliderTorqueTorque->getSliderStep();
1525 emit sliderTorqueCommand(ref_torque, jointIndex);
1526 sliderTorquePressed = false;
1527}
1528
1529
1531{
1532 //this function is mainly used used by the sequencer
1533 double pos = (double)ui->sliderTrajectoryPosition->value() / ui->sliderTrajectoryPosition->getSliderStep();
1534 if (fabs(pos) < 1e-6) {
1535 pos = 0;
1536 }
1537 return pos;
1538}
1539
1541{
1542 //this function is mainly used used by the sequencer
1543 double vel = (double)ui->sliderTrajectoryVelocity->value() / ui->sliderTrajectoryVelocity->getSliderStep();
1544 if (fabs(vel) < 1e-6) {
1545 vel = 0;
1546 }
1547 return vel;
1548}
1549
1551{
1552 motionDone = done;
1553 int index = ui->stackedWidget->currentIndex();
1554 if (index == POSITION) {
1555 if(!done){
1556 ui->editPositionJointPos->setStyleSheet("background-color: rgb(255, 38, 41); color: rgb(35, 38, 41);");
1557 }else{
1558 ui->editPositionJointPos->setStyleSheet("background-color: rgb(255, 255, 255); color: rgb(35, 38, 41);");
1559 }
1560 } else if (index == POSITION_DIR) {
1561 if(!done){
1562 ui->editPositionDirJointPos->setStyleSheet("background-color: rgb(255, 38, 41); color: rgb(35, 38, 41);");
1563 }else{
1564 ui->editPositionDirJointPos->setStyleSheet("background-color: rgb(255, 255, 255); color: rgb(35, 38, 41);");
1565 }
1566 } else if (index == MIXED) {
1567 if(!done){
1568 ui->editMixedJointPos->setStyleSheet("background-color: rgb(255, 38, 41); color: rgb(35, 38, 41);");
1569 }else{
1570 ui->editMixedJointPos->setStyleSheet("background-color: rgb(255, 255, 255); color: rgb(35, 38, 41);");
1571 }
1572 }
1573}
1574
1575void JointItem::updateSliderPosition(SliderWithTarget *slider, double val)
1576{
1577 if(sliderTrajectoryPositionPressed ||
1578 sliderMixedPositionPressed ||
1579 sliderDirectPositionPressed)
1580 {
1581 return;
1582 }
1583
1584 /*
1585 //@@@checkme
1586 if (motionDone == false)
1587 {
1588 return;
1589 }*/
1590 slider->setValue(val);
1591}
1592
1593void JointItem::updateSliderVelocity(double val)
1594{
1595 if (sliderVelocityPressed)
1596 {
1597 return;
1598 }
1599 ui->sliderVelocityVelocity->setValue(val);
1600}
1601
1602void JointItem::updateSliderPWM(double val)
1603{
1604 if (sliderPWMPressed) {
1605 return;
1606 }
1607 ui->sliderPWMOutput->setValue(val);
1608}
1609
1610void JointItem::updateSliderCurrent(double val)
1611{
1612 if (sliderCurrentPressed) {
1613 return;
1614 }
1615 ui->sliderCurrentOutput->setValue(val);
1616}
1617
1618void JointItem::updateJointFault(int i, std::string message)
1619{
1620 ui->labelFaultCodeEntry->setText(QString::fromStdString(std::to_string(i)));
1621 ui->labelFaultMessageEntry->setText(QString::fromStdString(message));
1622}
1623
1624void JointItem::updateSliderTorque(double val)
1625{
1626 if(sliderTorquePressed){
1627 return;
1628 }
1629 ui->sliderTorqueTorque->setValue(val);
1630}
1631
1632void JointItem::updateSliderTrajectoryVelocity(double val)
1633{
1634 if (sliderTrajectoryVelocityPressed){
1635 return;
1636 }
1637 ui->sliderTrajectoryVelocity->setValue(val);
1638}
1639
1640void JointItem::setRefPWM(double pwmValue)
1641{
1642 if(sliderPWMPressed){
1643 return;
1644 }
1645 if(ui->stackedWidget->currentIndex() == PWM){
1646 updateSliderPWM(pwmValue);
1647 QString sVal;
1648 sVal = QString("%L1").arg(pwmValue, 0, 'f', 3);
1649 ui->editPWMDuty->setText(sVal);
1650 }
1651}
1652
1653void JointItem::setRefCurrent(double currentValue)
1654{
1655 if (sliderCurrentPressed){
1656 return;
1657 }
1658 if (ui->stackedWidget->currentIndex() == CURRENT){
1659 updateSliderCurrent(currentValue);
1660 QString sVal;
1661 sVal = QString("%L1").arg(currentValue, 0, 'f', 3);
1662 ui->editCurrentCurrent->setText(sVal);
1663 }
1664}
1665
1667{
1668 QString sVal;
1669 if (ui->sliderTrajectoryPosition->getIsDouble())
1670 {
1671 double pos = val;
1672 sVal = QString("%L1").arg(pos, 0, 'f', 3);
1673 }
1674 else
1675 {
1676 double pos = floor(val * 10) / 10;
1677 sVal = QString("%1").arg(pos);
1678 }
1679
1680 if(ui->stackedWidget->currentIndex() == IDLE){
1681 ui->editIdleJointPos->setText(sVal);
1682 }
1683
1684 if (ui->stackedWidget->currentIndex() == HW_FAULT) {
1685 ui->editFaultJointPos->setText(sVal);
1686 }
1687
1688 if(ui->stackedWidget->currentIndex() == POSITION){
1689 ui->editPositionJointPos->setText(sVal);
1690 updateSliderPosition(ui->sliderTrajectoryPosition, val);
1691 }
1692
1693 if(ui->stackedWidget->currentIndex() == POSITION_DIR){
1694 ui->editPositionDirJointPos->setText(sVal);
1695 updateSliderPosition(ui->sliderDirectPosition, val);
1696 }
1697
1698 if(ui->stackedWidget->currentIndex() == MIXED){
1699 ui->editMixedJointPos->setText(sVal);
1700 updateSliderPosition(ui->sliderMixedPosition, val);
1701 }
1702
1703 if(ui->stackedWidget->currentIndex() == VELOCITY){
1704 ui->editVelocityJointPos->setText(sVal);
1705
1706 }
1707 if(ui->stackedWidget->currentIndex() == TORQUE){
1708 ui->editTorqueJointPos->setText(sVal);
1709 }
1710 if(ui->stackedWidget->currentIndex() == PWM){
1711 ui->editPWMJointPos->setText(sVal);
1712 }
1713 if (ui->stackedWidget->currentIndex() == CURRENT){
1714 ui->editCurrentJointPos->setText(sVal);
1715 }
1716
1717}
1718
1720{
1721 if(ui->stackedWidget->currentIndex() == TORQUE){
1722 updateSliderTorque(val);
1723 ref_torque = val;
1724 }
1725}
1726
1728{
1729 if (ui->stackedWidget->currentIndex() == VELOCITY){
1730 updateSliderVelocity(val);
1731 ref_speed = val;
1732 }
1733}
1734
1736{
1737 if (ui->stackedWidget->currentIndex() == POSITION){
1738 updateSliderTrajectoryVelocity(val);
1739 ref_trajectory_velocity = val;
1740
1741 if (val < 0.001)
1742 {
1743 ui->groupBox_12->setStyleSheet("background-color:orange; color: rgb(35, 38, 41);");
1744 ui->groupBox_12->setTitle("Velocity is ZERO!");
1745 }
1746 else
1747 {
1748 ui->groupBox_12->setStyleSheet("background-color:transparent; color: rgb(35, 38, 41);");
1749 ui->groupBox_12->setTitle("Velocity");
1750 }
1751 }
1752}
1753
1755{
1756 if (ui->stackedWidget->currentIndex() == POSITION){
1757 updateTrajectoryPositionTarget(val);
1758 }
1759}
1760
1761void JointItem::setTorque(double val)
1762{
1763 QString sVal = QString("%L1").arg(val,0,'f',3);
1764
1765 if(ui->stackedWidget->currentIndex() == IDLE){
1766 ui->editIdleTorque->setText(sVal);
1767 }
1768
1769 if(ui->stackedWidget->currentIndex() == POSITION){
1770 ui->editPositionTorque->setText(sVal);
1771 }
1772
1773 if(ui->stackedWidget->currentIndex() == POSITION_DIR){
1774 ui->editPositionDirTorque->setText(sVal);
1775 }
1776
1777 if(ui->stackedWidget->currentIndex() == MIXED){
1778 ui->editMixedTorque->setText(sVal);
1779 }
1780
1781 if(ui->stackedWidget->currentIndex() == VELOCITY){
1782 ui->editVelocityTorque->setText(sVal);
1783 }
1784 if(ui->stackedWidget->currentIndex() == TORQUE){
1785 ui->editTorqueTorque->setText(sVal);
1786 }
1787 if(ui->stackedWidget->currentIndex() == PWM){
1788 ui->editPWMTorque->setText(sVal);
1789 }
1790 if (ui->stackedWidget->currentIndex() == CURRENT){
1791 ui->editCurrentTorque->setText(sVal);
1792 }
1793}
1794
1796{
1797 if (!joint_motorPositionVisible){
1798 return;
1799 }
1800
1801 double mot = val;
1802 QString sVal = QString("%1").arg(mot, 0, 'f', 1);
1803
1804 if (ui->stackedWidget->currentIndex() == HW_FAULT) {
1805 ui->editFaultMotorPos->setText(sVal);
1806 }
1807
1808 if (ui->stackedWidget->currentIndex() == IDLE){
1809 ui->editIdleMotorPos->setText(sVal);
1810 }
1811
1812 if (ui->stackedWidget->currentIndex() == POSITION){
1813 ui->editPositionMotorPos->setText(sVal);
1814 }
1815
1816 if (ui->stackedWidget->currentIndex() == POSITION_DIR) {
1817 ui->editPositionDirMotorPos->setText(sVal);
1818 }
1819
1820 if (ui->stackedWidget->currentIndex() == MIXED) {
1821 ui->editMixedMotorPos->setText(sVal);
1822 }
1823
1824 if (ui->stackedWidget->currentIndex() == VELOCITY) {
1825 ui->editVelocityMotorPos->setText(sVal);
1826 }
1827
1828 if (ui->stackedWidget->currentIndex() == TORQUE) {
1829 ui->editTorqueMotorPos->setText(sVal);
1830 }
1831
1832 if (ui->stackedWidget->currentIndex() == PWM) {
1833 ui->editPWMMotorPos->setText(sVal);
1834 }
1835
1836 if (ui->stackedWidget->currentIndex() == CURRENT) {
1837 ui->editCurrentMotorPos->setText(sVal);
1838 }
1839}
1840
1842{
1843 if (!joint_dutyVisible) {
1844 return;
1845 }
1846
1847 double mot = val;
1848 QString sVal = QString("%1").arg(mot, 0, 'f', 1);
1849
1850 //if (ui->stackedWidget->currentIndex() == IDLE) {
1851 // ui->editIdleDuty->setText(sVal);
1852 //}
1853
1854 //if (ui->stackedWidget->currentIndex() == POSITION) {
1855 // ui->editPositionDuty->setText(sVal);
1856 //}
1857
1858 //if (ui->stackedWidget->currentIndex() == POSITION_DIR) {
1859 // ui->editPositionDirDuty->setText(sVal);
1860 //}
1861
1862 //if (ui->stackedWidget->currentIndex() == MIXED) {
1863 // ui->editMixedDuty->setText(sVal);
1864 //}
1865
1866 //if (ui->stackedWidget->currentIndex() == VELOCITY) {
1867 // ui->editVelocityDuty->setText(sVal);
1868 //}
1869
1870 if (ui->stackedWidget->currentIndex() == TORQUE) {
1871 ui->editTorqueDuty->setText(sVal);
1872 }
1873
1874 if (ui->stackedWidget->currentIndex() == PWM) {
1875 ui->editPWMDuty->setText(sVal);
1876 }
1877
1878 if (ui->stackedWidget->currentIndex() == CURRENT) {
1879 ui->editCurrentDuty->setText(sVal);
1880 }
1881}
1882
1883void JointItem::setSpeed(double meas)
1884{
1885 if (!joint_speedVisible){
1886 return;
1887 }
1888 //TODO
1889
1890 double speed = meas;
1891 QString sVal = QString("%1").arg(speed,0,'f',1);
1892
1893 if(ui->stackedWidget->currentIndex() == IDLE){
1894 ui->editIdleSpeed->setText(sVal);
1895 }
1896
1897 if(ui->stackedWidget->currentIndex() == POSITION){
1898 ui->editPositionSpeed->setText(sVal);
1899 }
1900
1901 if(ui->stackedWidget->currentIndex() == POSITION_DIR){
1902 ui->editPositionDirSpeed->setText(sVal);
1903 }
1904
1905 if(ui->stackedWidget->currentIndex() == MIXED){
1906 ui->editMixedSpeed->setText(sVal);
1907 }
1908
1909 if(ui->stackedWidget->currentIndex() == VELOCITY){
1910 if(!sliderVelocityPressed){
1911 ui->editVelocitySpeed->setText(sVal);
1912 //updateSlider(ui->sliderVelocityVelocity,ui->labelVelocityVelocity,val);
1913 }
1914 }
1915 if(ui->stackedWidget->currentIndex() == TORQUE){
1916 ui->editTorqueSpeed->setText(sVal);
1917 //updateSliderTorque(val);
1918 }
1919 if(ui->stackedWidget->currentIndex() == PWM){
1920 ui->editPWMSpeed->setText(sVal);
1921 }
1922 if (ui->stackedWidget->currentIndex() == CURRENT){
1923 ui->editCurrentSpeed->setText(sVal);
1924 }
1925
1926}
1927
1928void JointItem::setCurrent(double meas)
1929{
1930 if (!joint_currentVisible) {
1931 return;
1932 }
1933 //TODO
1934
1935 double current = meas;
1936 QString sVal = QString("%1").arg(current, 0, 'f', 3);
1937
1938 if (ui->stackedWidget->currentIndex() == IDLE) {
1939 ui->editIdleCurrent->setText(sVal);
1940 }
1941
1942 if (ui->stackedWidget->currentIndex() == POSITION) {
1943 ui->editPositionCurrent->setText(sVal);
1944 }
1945
1946 if (ui->stackedWidget->currentIndex() == POSITION_DIR) {
1947 ui->editPositionDirCurrent->setText(sVal);
1948 }
1949
1950 if (ui->stackedWidget->currentIndex() == MIXED) {
1951 ui->editMixedCurrent->setText(sVal);
1952 }
1953
1954 if (ui->stackedWidget->currentIndex() == VELOCITY) {
1955 ui->editVelocityCurrent->setText(sVal);
1956 }
1957 if (ui->stackedWidget->currentIndex() == TORQUE) {
1958 ui->editTorqueCurrent->setText(sVal);
1959 }
1960 if (ui->stackedWidget->currentIndex() == PWM) {
1961 ui->editPWMCurrent->setText(sVal);
1962 }
1963 if (ui->stackedWidget->currentIndex() == CURRENT) {
1964 ui->editCurrentCurrent->setText(sVal);
1965 }
1966
1967}
1968
1969
1970
1971
1972void JointItem::setJointInternalInteraction(int interaction)
1973{
1974 disconnect(ui->comboInteraction,SIGNAL(currentIndexChanged(int)),this,SLOT(onInteractionChanged(int)));
1975 ui->comboInteraction->setCurrentIndex(interaction);
1976 connect(ui->comboInteraction,SIGNAL(currentIndexChanged(int)),this,SLOT(onInteractionChanged(int)));
1977}
1978
1979void JointItem::setJointInternalState(int mode)
1980{
1981 disconnect(ui->comboMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onModeChanged(int)));
1982 ui->comboMode->setCurrentIndex(mode);
1983 connect(ui->comboMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onModeChanged(int)));
1984
1985 ui->stackedWidget->setCurrentIndex(mode);
1986 if(ui->stackedWidget->widget(mode)){
1987 QVariant variant = ui->comboMode->itemData(mode,Qt::BackgroundRole);
1988 QColor c;
1989 switch(internalState)
1990 {
1991 case Disconnected:
1992 c = disconnectColor;
1993 break;
1994 case HwFault:
1995 ui->groupBox->setTitle(QString("JOINT %1 (%2) - HARDWARE FAULT").arg(jointIndex).arg(jointName));
1996 ui->stackedWidget->setEnabled(false);
1997 //ui->buttonsContainer->setEnabled(false);
1998 ui->buttonHome->setEnabled(false);
1999 ui->buttonCalib->setEnabled(false);
2000 ui->buttonRun->setEnabled(false);
2001 ui->comboMode->setEnabled(false);
2002 ui->comboInteraction->setEnabled(false);
2003 ui->buttonIdle->setEnabled(true);
2004 ui->buttonPid->setEnabled(true);
2005 c = hwFaultColor;
2006 break;
2007 case Unknown:
2008 case NotConfigured:
2009 case Configured:
2010 case CalibDone:
2011 case Calibrating:
2012 c = calibratingColor;
2013 break;
2014
2015 default:{
2016 enableAll();
2017 c = variant.value<QColor>();
2018 if(ui->groupBox->title() != QString("JOINT %1 (%2)").arg(jointIndex).arg(jointName))
2019 {
2020 ui->groupBox->setTitle(QString("JOINT %1 (%2)").arg(jointIndex).arg(jointName));
2021 }
2022 ui->stackedWidget->setEnabled(true);
2023 ui->buttonsContainer->setEnabled(true);
2024 break;
2025 }
2026 }
2027
2028 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2029 }
2030}
2031
2033{
2034 if(internalInteraction == interaction){
2035 return;
2036 }
2037
2038 internalInteraction = interaction;
2039
2040 switch (internalInteraction) {
2041 case Stiff:
2042 setJointInternalInteraction(STIFF);
2043 break;
2044 case COMPLIANT:
2045 setJointInternalInteraction(COMPLIANT);
2046 break;
2047 default:
2048 break;
2049 }
2050}
2051
2052
2054{
2055 if(internalState == newState){
2056 return;
2057 }
2058
2059 internalState = newState;
2060
2061 switch (internalState) {
2062 case Unknown:{
2063 ui->groupBox->setTitle(QString("JOINT %1 (%2) - UNKNOWN").arg(jointIndex).arg(jointName));
2064 ui->stackedWidget->setEnabled(false);
2065 ui->buttonsContainer->setEnabled(false);
2066
2067 int index = ui->stackedWidget->currentIndex();
2068 if(ui->stackedWidget->widget(index)){
2069 QColor c = calibratingColor;
2070 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2071 }
2072 break;
2073 }
2074 case Configured:{
2075 ui->groupBox->setTitle(QString("JOINT %1 (%2) - CONFIGURED").arg(jointIndex).arg(jointName));
2076 ui->stackedWidget->setEnabled(true);
2077 ui->buttonsContainer->setEnabled(true);
2078
2079 int index = ui->stackedWidget->currentIndex();
2080 if(ui->stackedWidget->widget(index)){
2081 QColor c = calibratingColor;
2082 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2083 }
2084 break;
2085 }
2086
2087 case NotConfigured:{
2088 ui->groupBox->setTitle(QString("JOINT %1 (%2) - NOT CONFIGURED").arg(jointIndex).arg(jointName));
2089 ui->stackedWidget->setEnabled(false);
2090 //activating only calib button
2091 if(enableCalib)
2092 {
2093
2094 ui->buttonsContainer->setEnabled(true);
2095 ui->buttonIdle->setEnabled(false);
2096 ui->buttonPid->setEnabled(true);
2097 ui->buttonHome->setEnabled(false);
2098 ui->buttonCalib->setEnabled(true);
2099 ui->buttonRun->setEnabled(false);
2100 ui->comboMode->setEnabled(false);
2101 ui->comboInteraction->setEnabled(false);
2102 }
2103 //nothing must be activated
2104 else
2105 {
2106 ui->buttonsContainer->setEnabled(false);
2107 }
2108
2109 int index = ui->stackedWidget->currentIndex();
2110 if(ui->stackedWidget->widget(index)){
2111 QColor c = calibratingColor;
2112 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2113 }
2114 break;
2115 }
2116
2117 case CalibDone:{
2118 ui->groupBox->setTitle(QString("JOINT %1 (%2) - CALIBRATING DONE").arg(jointIndex).arg(jointName));
2119 ui->stackedWidget->setEnabled(true);
2120 ui->buttonsContainer->setEnabled(true);
2121
2122 int index = ui->stackedWidget->currentIndex();
2123 if(ui->stackedWidget->widget(index)){
2124 QColor c = calibratingColor;
2125 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2126 }
2127 break;
2128 }
2129 case Calibrating:{
2130 ui->groupBox->setTitle(QString("JOINT %1 (%2) - CALIBRATING").arg(jointIndex).arg(jointName));
2131 ui->stackedWidget->setEnabled(false);
2132 ui->buttonsContainer->setEnabled(false);
2133
2134 int index = ui->stackedWidget->currentIndex();
2135 if(ui->stackedWidget->widget(index)){
2136 QColor c = calibratingColor;
2137 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2138 }
2139 break;
2140 }
2141 case HwFault:{
2142 setJointInternalState(HW_FAULT);
2143 break;
2144 }
2145 case Disconnected:{
2146 ui->groupBox->setTitle(QString("JOINT %1 (%2) - DISCONNECTED").arg(jointIndex).arg(jointName));
2147 ui->stackedWidget->setEnabled(false);
2148 ui->buttonsContainer->setEnabled(false);
2149
2150 int index = ui->stackedWidget->currentIndex();
2151 if(ui->stackedWidget->widget(index)){
2152 QColor c = disconnectColor;
2153 setStyleSheet(QString("font: 8pt; background-color: rgb(%1,%2,%3); color: rgb(35, 38, 41);").arg(c.red()).arg(c.green()).arg(c.blue()));
2154 }
2155 break;
2156 }
2157 case Idle:{
2158 setJointInternalState(IDLE);
2159 break;
2160 }
2161 case Position:{
2162 setJointInternalState(POSITION);
2163 break;
2164 }
2165 case PositionDirect:{
2166 setJointInternalState(POSITION_DIR);
2167 break;
2168 }
2169 case Mixed:{
2170 setJointInternalState(MIXED);
2171 break;
2172 }
2173 case Velocity:{
2174 setJointInternalState(VELOCITY);
2175 break;
2176 }
2177 case Torque:{
2178 setJointInternalState(TORQUE);
2179 break;
2180 }
2181 case Pwm:{
2182 setJointInternalState(PWM);
2183 break;
2184 }
2185 case Current:{
2186 setJointInternalState(CURRENT);
2187 break;
2188 }
2189 default:
2190 break;
2191 }
2192
2193}
2194
2195void JointItem::enableAll()
2196{
2197 ui->stackedWidget->setEnabled(true);
2198 ui->buttonsContainer->setEnabled(true);
2199 ui->buttonIdle->setEnabled(true);
2200 ui->buttonPid->setEnabled(true);
2201 ui->buttonHome->setEnabled(true);
2202 if(enableCalib){
2203 ui->buttonCalib->setEnabled(true);
2204 }
2205 ui->buttonRun->setEnabled(true);
2206 ui->comboMode->setEnabled(true);
2207 ui->comboInteraction->setEnabled(true);
2208
2209}
2210
2211void JointItem::setPWMRange(double min, double max)
2212{
2213 ui->sliderPWMOutput->setRange(min,max);
2214}
2215
2216void JointItem::setCurrentRange(double min, double max)
2217{
2218 if (min < max)
2219 {
2220 min_current = min;
2221 max_current = max;
2222 }
2223 else
2224 {
2225 //Error
2226 }
2227 ui->sliderCurrentOutput->setRange(min, max);
2228}
2229
2230void JointItem::setPositionRange(double min, double max)
2231{
2232 min_position = 1;
2233 max_position = 2;
2234 if(min < max)
2235 {
2236 min_position = min;
2237 max_position = max;
2238 }
2239 else
2240 {
2241 //Error
2242 }
2243}
2244
2245void JointItem::setVelocityRange(double min, double max)
2246{
2247 min_velocity = -100;
2248 max_velocity = 100;
2249 if (min < max)
2250 {
2251 min_velocity = min;
2252 max_velocity = max;
2253 }
2254 else
2255 {
2256 //Error
2257 }
2258}
2259
2261{
2262 max_trajectory_velocity = 100;
2263 if (max >= 0)
2264 {
2265 max_trajectory_velocity = max;
2266 }
2267 else
2268 {
2269 //Error
2270 }
2271}
2272
2274{
2275 max_torque = 5;
2276 if (max >= 0)
2277 {
2278 max_torque = max;
2279 }
2280 else
2281 {
2282 //Error
2283 }
2284}
2285
2286void JointItem::onCalibClicked()
2287{
2288 if (this->internalState == Velocity)
2289 {
2290 velocityTimer.stop();
2291 }
2292 emit calibClicked(this);
2293}
2294
2295void JointItem::onHomeClicked()
2296{
2297 home();
2298}
2299
2300void JointItem::onIdleClicked()
2301{
2302 idle();
2303}
2304
2305void JointItem::onRunClicked()
2306{
2307 run();
2308}
2309
2310void JointItem::onPidClicked()
2311{
2312 showPID();
2313}
2314
2316{
2317 ui->sliderMixedPosition->setEnabled(false);
2318 ui->sliderMixedVelocity->setEnabled(false);
2319 ui->sliderPWMOutput->setEnabled(false);
2320 ui->sliderCurrentOutput->setEnabled(false);
2321 ui->sliderDirectPosition->setEnabled(false);
2322 ui->sliderTrajectoryPosition->setEnabled(false);
2323 ui->sliderTrajectoryVelocity->setEnabled(false);
2324 ui->sliderTorqueTorque->setEnabled(false);
2325
2326}
2327
2329{
2330 ui->sliderMixedPosition->setEnabled(true);
2331 ui->sliderMixedVelocity->setEnabled(true);
2332 ui->sliderPWMOutput->setEnabled(true);
2333 ui->sliderCurrentOutput->setEnabled(true);
2334 ui->sliderDirectPosition->setEnabled(true);
2335 ui->sliderTrajectoryPosition->setEnabled(true);
2336 ui->sliderTrajectoryVelocity->setEnabled(true);
2337 ui->sliderTorqueTorque->setEnabled(true);
2338}
2339
2340
2341bool WheelEventFilter::eventFilter(QObject *obj, QEvent *event)
2342{
2343 if (event->type() == QEvent::Wheel) {
2344 return true;
2345 } else {
2346 // standard event processing
2347 return QObject::eventFilter(obj, event);
2348 }
2349}
#define yError(...)
Definition Log.h:361
#define yFatal(...)
Definition Log.h:382
int SIGNAL(int pid, int signum)
void setMotorPosition(double meas)
void viewPositionTargetValue(bool)
void setVelocityRange(double min, double max)
void setDutyVisible(bool)
void sequenceActivated()
void enableTrajectoryVelocitySliderDoubleAuto()
void updateJointFault(int i, std::string message)
void enableControlPositionDirect(bool control)
void enableVelocitySliderDoubleAuto()
void setCurrentsVisible(bool)
void setUnits(yarp::dev::JointTypeEnum t)
static QColor GetModeColor(JointState mode)
Definition jointitem.cpp:57
void setPositionRange(double min, double max)
void enableControlMixed(bool control)
void setRefTrajectoryPosition(double ref)
void sliderVelocityCommand(double val, int jointIndex)
void resetTarget()
Definition jointitem.cpp:19
void enablePositionSliderDoubleValue(double value)
void sliderCurrentCommand(double val, int jointIndex)
void enableCurrentSliderDoubleValue(double value)
void viewPositionTargetBox(bool)
void setJointState(JointState)
void enableControlPWM(bool control)
void disablePositionSliderDouble()
void disableCurrentSliderDouble()
void enableTorqueSliderDoubleValue(double value)
void homeClicked(JointItem *joint)
void setPosition(double val)
void sliderPWMCommand(double val, int jointIndex)
void setRefVelocitySpeed(double ref)
static QString GetModeString(JointState mode)
void sliderTrajectoryPositionCommand(double val, int jointIndex)
void setCurrentRange(double min, double max)
void setJointName(QString name)
void pidClicked(JointItem *joint)
QString getJointName()
void setPWMRange(double min, double max)
void updateMotionDone(bool done)
void setRefCurrent(double ref)
@ InteractionStarting
Definition jointitem.h:35
double getTrajectoryVelocityValue()
void setTrajectoryVelocityRange(double max)
void setSpeed(double val)
void enableCurrentSliderDoubleAuto()
bool eventFilter(QObject *obj, QEvent *event) override
int getJointIndex()
void sliderMixedPositionCommand(double val, int jointIndex)
void sliderDirectPositionCommand(double val, int jointIndex)
void disableTrajectoryVelocitySliderDouble()
void setJointInteraction(JointInteraction interaction)
void calibClicked(JointItem *joint)
void runClicked(JointItem *joint)
void setMotorPositionVisible(bool)
void enableControlVelocity(bool control)
void setDutyCycles(double duty)
double getTrajectoryPositionValue()
void setCurrent(double meas)
void setRefTrajectorySpeed(double ref)
void idle()
Definition jointitem.cpp:43
void disableVelocitySliderDouble()
void sliderTrajectoryVelocityCommand(double val, int jointIndex)
void setRefPWM(double ref)
void run()
Definition jointitem.cpp:34
void sliderTorqueCommand(double val, int jointIndex)
void enableControlCurrent(bool control)
void enableTrajectoryVelocitySliderDoubleValue(double value)
void setEnabledOptions(bool debug_param_enabled, bool speedview_param_enabled, bool enable_calib_all)
void sequenceStopped()
void changeMode(int mode, JointItem *joint)
void enableTorqueSliderDoubleAuto()
void setSpeedVisible(bool)
void showPID()
Definition jointitem.cpp:52
void home()
Definition jointitem.cpp:25
JointItem(int index, QWidget *parent=0)
void setNumberOfPositionSliderDecimals(size_t num)
@ PositionDirect
Definition jointitem.h:33
@ Disconnected
Definition jointitem.h:34
@ StateStarting
Definition jointitem.h:34
@ Calibrating
Definition jointitem.h:34
@ NotConfigured
Definition jointitem.h:34
void enableVelocitySliderDoubleValue(double value)
void enablePositionSliderDoubleAuto()
void disableTorqueSliderDouble()
void setTorque(double meas)
void sliderMixedVelocityCommand(double val, int jointIndex)
void idleClicked(JointItem *joint)
void setTorqueRange(double max)
void setRefTorque(double ref)
void changeInteraction(int interaction, JointItem *joint)
void setValue(double val)
bool eventFilter(QObject *obj, QEvent *event) override
bool speedview_param_enabled
Definition main.cpp:35
bool debug_param_enabled
Definition main.cpp:34
bool enable_calib_all
Definition main.cpp:36
#define STIFF
Definition jointitem.h:25
#define COMPLIANT
Definition jointitem.h:26
Definition aboutdlg.h:11
@ VOCAB_JOINTTYPE_REVOLUTE
Definition IAxisInfo.h:24
@ VOCAB_JOINTTYPE_PRISMATIC
Definition IAxisInfo.h:25
const QColor idleColor
const QColor disconnectColor
const QColor hwFaultColor
const QColor torqueColor
const QColor positionColor
const QColor pwmColor
const QColor positionDirectColor
const QColor mixedColor
const QColor velocityColor
const QColor calibratingColor
const QColor currentColor