Skip to content

Commit 849b786

Browse files
committed
added pan-tilt camera operations
1 parent 3b0b62c commit 849b786

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

robot_control_center/robotcontrol.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ void RobotControl::init()
8080
connect(ui->stopButton, SIGNAL(clicked(bool)), this, SLOT(stop()));
8181
ui->robotRadioButton->setChecked(true);
8282
ui->cameraRadioButton->setChecked(false);
83+
ui->cameraStep->setText("1");
8384

8485
// power level
8586
ui->maximumPower->setText("4095");
@@ -252,6 +253,14 @@ void RobotControl::forward()
252253
sendPowerToRobotIfModified();
253254
sendOneWay("M1,0#");
254255
}
256+
else if ( ui->cameraRadioButton->isChecked() )
257+
{
258+
QString message;
259+
message.append("Ty");
260+
message.append(ui->cameraStep->text());
261+
message.append("#");
262+
sendOneWay(message);
263+
}
255264
currentButton = ui->forwardButton;
256265
}
257266

@@ -267,6 +276,14 @@ void RobotControl::backward()
267276
sendPowerToRobotIfModified();
268277
sendOneWay("M-1,0#");
269278
}
279+
else if ( ui->cameraRadioButton->isChecked() )
280+
{
281+
QString message;
282+
message.append("Ty-");
283+
message.append(ui->cameraStep->text());
284+
message.append("#");
285+
sendOneWay(message);
286+
}
270287
currentButton = ui->backwardButton;
271288
}
272289

@@ -282,6 +299,14 @@ void RobotControl::left()
282299
sendPowerToRobotIfModified();
283300
sendOneWay("M0,-1#");
284301
}
302+
else if ( ui->cameraRadioButton->isChecked() )
303+
{
304+
QString message;
305+
message.append("Tx-");
306+
message.append(ui->cameraStep->text());
307+
message.append("#");
308+
sendOneWay(message);
309+
}
285310
currentButton = ui->leftButton;
286311
}
287312

@@ -297,6 +322,14 @@ void RobotControl::right()
297322
sendPowerToRobotIfModified();
298323
sendOneWay("M0,1#");
299324
}
325+
else if ( ui->cameraRadioButton->isChecked() )
326+
{
327+
QString message;
328+
message.append("Tx");
329+
message.append(ui->cameraStep->text());
330+
message.append("#");
331+
sendOneWay(message);
332+
}
300333
currentButton = ui->rightButton;
301334
}
302335

robot_control_center/robotcontrol.ui

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,48 @@
563563
</size>
564564
</property>
565565
</widget>
566+
<widget class="QLineEdit" name="cameraStep">
567+
<property name="geometry">
568+
<rect>
569+
<x>332</x>
570+
<y>546</y>
571+
<width>81</width>
572+
<height>32</height>
573+
</rect>
574+
</property>
575+
<property name="sizePolicy">
576+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
577+
<horstretch>0</horstretch>
578+
<verstretch>0</verstretch>
579+
</sizepolicy>
580+
</property>
581+
<property name="maxLength">
582+
<number>3</number>
583+
</property>
584+
</widget>
585+
<widget class="QLabel" name="label">
586+
<property name="geometry">
587+
<rect>
588+
<x>332</x>
589+
<y>522</y>
590+
<width>77</width>
591+
<height>18</height>
592+
</rect>
593+
</property>
594+
<property name="sizePolicy">
595+
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
596+
<horstretch>0</horstretch>
597+
<verstretch>0</verstretch>
598+
</sizepolicy>
599+
</property>
600+
<property name="text">
601+
<string>Camera step</string>
602+
</property>
603+
<property name="alignment">
604+
<set>Qt::AlignCenter</set>
605+
</property>
606+
</widget>
607+
<zorder>layoutWidget</zorder>
566608
<zorder>layoutWidget</zorder>
567609
<zorder>layoutWidget</zorder>
568610
<zorder>layoutWidget</zorder>

0 commit comments

Comments
 (0)