<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>examples_widget</class>
<widget class="QWidget" name="examples_widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>RQT Example</string>
</property>
<widget class="QGroupBox" name="group_box_ur">
<property name="geometry">
<rect>
<x>330</x>
<y>30</y>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="title">
<string>Topic Subscriber Example</string>
</property>
<widget class="QSlider" name="slider_x">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>31</width>
<height>211</height>
</rect>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QDial" name="dial_yaw">
<property name="geometry">
<rect>
<x>130</x>
<y>40</y>
<width>151</width>
<height>181</height>
</rect>
</property>
<property name="tabletTracking">
<bool>false</bool>
</property>
<property name="minimum">
<number>-50</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="wrapping">
<bool>false</bool>
</property>
<property name="notchTarget">
<double>10.000000000000000</double>
</property>
<property name="notchesVisible">
<bool>true</bool>
</property>
</widget>
<widget class="QLCDNumber" name="lcd_number_x">
<property name="geometry">
<rect>
<x>10</x>
<y>250</y>
<width>101</width>
<height>41</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_x">
<property name="geometry">
<rect>
<x>115</x>
<y>273</y>
<width>30</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>m/s</string>
</property>
</widget>
<widget class="QLCDNumber" name="lcd_number_yaw">
<property name="geometry">
<rect>
<x>150</x>
<y>250</y>
<width>101</width>
<height>41</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_yaw">
<property name="geometry">
<rect>
<x>255</x>
<y>273</y>
<width>50</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>rad/s</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_box_dr">
<property name="geometry">
<rect>
<x>330</x>
<y>350</y>
<width>300</width>
<height>120</height>
</rect>
</property>
<property name="title">
<string>Service Server Example</string>
</property>
<widget class="QLabel" name="label_led_status">
<property name="geometry">
<rect>
<x>100</x>
<y>30</y>
<width>91</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>LED Status</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="push_button_led_status">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>On/Off</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_box_dl">
<property name="geometry">
<rect>
<x>10</x>
<y>350</y>
<width>300</width>
<height>120</height>
</rect>
</property>
<property name="title">
<string>Service Client Example</string>
</property>
<widget class="QRadioButton" name="radio_button_led_on">
<property name="geometry">
<rect>
<x>60</x>
<y>50</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED ON</string>
</property>
</widget>
<widget class="QRadioButton" name="radio_button_led_off">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED OFF</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_shortcut_key_2">
<property name="geometry">
<rect>
<x>52</x>
<y>80</y>
<width>190</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>( o key: LED On / f key: LED Off )</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="group_box_ul">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="title">
<string>Topic Publisher Example</string>
</property>
<widget class="QWidget" name="grid_layout_widget">
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>299</width>
<height>191</height>
</rect>
</property>
<layout class="QGridLayout" name="grid_layout">
<item row="1" column="2">
<widget class="QPushButton" name="push_button_d">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>d</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="push_button_w">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>w</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="push_button_s">
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>s</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="push_button_x">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="push_button_a">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>a</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label_shortcut_key_1">
<property name="geometry">
<rect>
<x>20</x>
<y>237</y>
<width>250</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string>w/x key: increase/decrease linear velocity
a/d key: increase/decrease angular velocity
space key, s key: force stop</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
위 파일은 RQt 플러그인 인터페이스를 정의하는 ui파일로 XML 태그를 이용합니다.
1) main widget - examples_widget : 창의 크기와 제목 지정
2) group_box_ur
| name | type | position/size | title |
|---|---|---|---|
group_box_ur | QgroupBox | (330,30), 300x300 | Topic Subscriber Example |
2-1) Child widegets
| name | type | position/size | setting |
|---|---|---|---|
| slider_x | QSlider | (50,30), 31x211 | Orientation: 세로 (Qt::Vertical) Range: -1000 ~ 1000, 단위 스텝: 10 |
| dial_yaw | QDial | (130, 40), 151x181 | Range: -50 ~ 50, 초기값은 0 Notch Visibility: true (눈금 표시) |
| lcd_number_x | QLCDNumber | (10, 250), 101x41 | 슬라이더(slider_x)의 값을 표시하는 LCD 디스플레이. |
| label_x | QLabel | (115, 273), 30x17 | Text: "m/s" (속도 단위) Font: 크기 12, 굵게, 기울임. |
| lcd_number_yaw | QLCDNumber | (150, 250), 101x41 | Role: 다이얼(dial_yaw)의 값을 표시하는 LCD 디스플레이. |
| label_yaw | QLabel | Position/Size: (255, 273), 50x17 | Text: "rad/s" (각속도 단위)Font: 크기 12, 굵게, 기울임. |
이 코드는 RQT(ROS Qt) 플러그인 인터페이스를 정의하는 XML 파일입니다. RQT는 ROS(로봇 운영 시스템)에서 시각적인 사용자 인터페이스를 제공하는 도구입니다. 이 XML 파일은 Qt Designer에서 만든 UI 레이아웃을 표현하며, 위젯과 레이아웃의 위치, 크기, 속성 등을 지정합니다. QWidget, QGroupBox, QSlider, QDial 등 여러 위젯들을 포함하며, 각 위젯은 다음과 같은 역할을 합니다:
examples_widgetQWidget640x480이고, 제목은 "RQT Example"입니다.group_box_ur (Topic Subscriber Example)QGroupBox300x300slider_x: QSlider31x211Qt::Vertical)dial_yaw: QDial151x181lcd_number_x: QLCDNumber101x41slider_x)의 값을 표시하는 LCD 디스플레이.label_x:QLabel30x17lcd_number_yaw: QLCDNumber101x41dial_yaw)의 값을 표시하는 LCD 디스플레이.label_yaw:QLabel50x17group_box_dr (Service Server Example)QGroupBox300x120label_led_status:QLabel91x30push_button_led_status:QPushButton91x41group_box_dl (Service Client Example)QGroupBox300x120radio_button_led_on:QRadioButton100x22radio_button_led_off:QRadioButton100x22label_shortcut_key_2:QLabel190x21group_box_ul (Topic Publisher Example)QGroupBox300x300grid_layout_widget:QWidget with QGridLayout299x191QGridLayout 사용하여 아래의 버튼 배치:push_button_w: 위쪽 (w 키, 전진)push_button_s: 아래쪽 (s 키, 정지)push_button_a: 왼쪽 (a 키, 좌회전)push_button_d: 오른쪽 (d 키, 우회전)push_button_x: 아래 (x 키, 후진)label_shortcut_key_1:QLabel250x50w/x key: increase/decrease linear velocity
a/d key: increase/decrease angular velocity
space key, s key: force stop이 XML 파일을 통해 만든 UI는 RQT 플러그인으로, 토픽을 구독하고 퍼블리싱하며, 서비스 서버와 클라이언트를 다루는 인터페이스를 제공합니다. 각 위젯은 로봇의 이동 속도 조절, 방향 제어, LED 상태 변경 등을 위한 인터페이스를 제공하며, 이를 통해 사용자는 쉽게 로봇의 동작을 제어할 수 있습니다.
group_box_ur는 Qt Designer에서 사용된 이름으로, 해당 위젯의 역할을 나타내기 위한 식별자입니다. 이름 자체는 사용자가 지정할 수 있으며, 구체적으로 어떤 의미를 가지는지는 코드 작성자의 의도에 따라 다릅니다. 여기서 ur는 "upper right"의 약자로, 위젯이 사용자 인터페이스의 오른쪽 위에 위치하고 있다는 것을 암시할 수 있습니다.
이 코드는 Qt Designer로 생성된 .ui 파일의 내용으로, XML 형식으로 작성되었습니다. XML은 데이터 구조를 정의하고 표현하기 위해 사용되는 마크업 언어입니다. 여기서 사용된 XML은 PyQt나 PySide 같은 라이브러리에서 사용할 수 있는 사용자 인터페이스를 정의합니다. 각 태그와 속성은 UI의 레이아웃, 위젯, 속성 등을 지정하는 데 사용됩니다.
루트 노드 (<ui>):
version="4.0": Qt 버전을 지정합니다.<class>:
examples_widget이라는 이름으로 정의되었습니다.<widget>:
class 속성은 위젯의 종류를 지정하고, name 속성은 해당 위젯의 식별자를 지정합니다. 예를 들어:class="QWidget"은 기본 위젯을 의미합니다.name="examples_widget"은 이 위젯의 이름입니다.<property>:
geometry는 위젯의 위치와 크기를 정의하며, <rect> 요소를 사용해 x, y, width, height를 지정합니다.windowTitle은 윈도우의 제목을 정의합니다.위젯 정의 (<widget> 태그 내):
geometry, text, title 등)을 포함하고 있으며, 위젯의 타입과 이름을 지정합니다.<widget> 내부에 다른 위젯을 포함할 수 있어, 그룹 박스나 레이아웃 구조를 정의할 때 사용됩니다.<layout>:
QGridLayout을 사용해 그리드 형식으로 위젯들을 배치하고 있습니다.<item> 요소로 레이아웃의 특정 위치에 위젯을 추가할 수 있습니다.group_box_ur 내부 위젯 설명QGroupBox (group_box_ur): QSlider (slider_x): QDial (dial_yaw): QLCDNumber (lcd_number_x와 lcd_number_yaw): slider_x와 dial_yaw의 값을 표시할 수 있는 LCD 스타일 디스플레이입니다.QLabel (label_x와 label_yaw): 이 XML 구조를 통해 .ui 파일을 Qt 기반 Python 코드로 변환하면, PyQt나 PySide에서 해당 UI를 활용할 수 있습니다. group_box_ur와 같은 이름은 UI 코드에서 해당 위젯을 참조할 때 사용됩니다.