YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
display.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef DISPLAY_H
7#define DISPLAY_H
8
9#include <QMainWindow>
10#include <QTimer>
11
12#include <yarp/os/Os.h>
13#include <yarp/os/Network.h>
15#include <yarp/os/Stamp.h>
16#include <yarp/dev/IBattery.h>
17#include <yarp/dev/PolyDriver.h>
18#include <yarp/dev/Drivers.h>
20
21#include "ui_display.h"
22#include "joywidget.h"
23
24class MainWindow :public QMainWindow
25{
26 Q_OBJECT
27
28public:
29 explicit MainWindow(const yarp::os::ResourceFinder& rf, QWidget *parent = 0, double refresh_period=0.01);
31
32 private slots:
33 void updateMain();
34 void handleButton_Wp();
35 void handleButton_Wr();
36 void handleButton_Sp();
37 void handleButton_Sr();
38 void handleButton_Ap();
39 void handleButton_Ar();
40 void handleButton_Dp();
41 void handleButton_Dr();
42 void handleButton_Qp();
43 void handleButton_Qr();
44 void handleButton_Ep();
45 void handleButton_Er();
46
47 void handleButton_I();
48 void handleButton_K();
49 void handleButton_O();
50 void handleButton_L();
51protected:
52 void keyReleaseEvent(QKeyEvent* e) override;
53 void keyPressEvent(QKeyEvent* e) override;
54
55public:
57
58public:
59 //parametes
60 double max_vel_lin = 1; //ms/s
61 double max_vel_theta = 10; //deg/s
62 double cur_vel_lin_x = 0; //ms/s
63 double cur_vel_lin_y = 0; //ms/s
64 double cur_vel_theta = 0; //deg/s
65 double lin_vel_step = 0.05;//ms/s
66 double ang_vel_step = 5; //deg/s
67 std::string portname = "/yarpmobilebasegui:o";
68
69#define s_max_lin_vel "max linear velocity: %3.3f m/s"
70#define s_max_ang_vel "max angular velocity: %3.1f deg/s"
71#define s_cur_lin_vel_x "cur x linear velocity: %3.3f m/s"
72#define s_cur_lin_vel_y "cur y linear velocity: %3.3f m/s"
73#define s_cur_ang_vel "cur angular velocity: %3.1f deg/s"
74
75private:
76 Ui_MainWindow *ui;
77 QTimer* mainTimer;
78 Joywidget* joy;
79 char buff[100];
80 yarp::os::Stamp m_stamp;
81
82public:
84 bool pressed_left = false;
85 bool pressed_up = false;
86 bool pressed_down = false;
87 bool pressed_right = false;
88 bool pressed_turn_left = false;
89 bool pressed_turn_right = false;
91};
92
93#endif
MainWindow class.
Definition display.h:22
bool pressed_turn_left
Definition display.h:88
std::string portname
Definition display.h:67
yarp::os::Port outputport
Definition display.h:83
double max_vel_theta
Definition display.h:61
void keyPressEvent(QKeyEvent *e) override
Definition display.cpp:55
yarp::dev::MobileBaseVelocity output_data
Definition display.h:90
double max_vel_lin
Definition display.h:60
double ang_vel_step
Definition display.h:66
bool pressed_up
Definition display.h:85
bool pressed_left
Definition display.h:84
double cur_vel_theta
Definition display.h:64
double cur_vel_lin_x
Definition display.h:62
double cur_vel_lin_y
Definition display.h:63
bool pressed_turn_right
Definition display.h:89
double lin_vel_step
Definition display.h:65
bool pressed_down
Definition display.h:86
yarp::os::Network yarp
Definition display.h:34
bool pressed_right
Definition display.h:87
void keyReleaseEvent(QKeyEvent *e) override
Definition display.cpp:42
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:706
A mini-server for network communication.
Definition Port.h:46
Helper class for finding config files and other external resources.
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21