MCGUI (monitor and control GUI) inherits from QT QWidget class. It is used as a terminal for users to observe the robot status and control the running of the task program.
The functions of the MCGUI class consists of three parts.
The first part is monitor functions (marked in green in Method Summary). This part reads the standard output which contains the feedback information from task process and represents the information on the GUI.
The second part is control functions (marked in blue in Method Summary). They are defined with keyword Slot, which mans it can be connect with GUI event “signal” in QT. This part accepts the GUI event command (button clicked) and send a standard input to the task process to control the task.
The third part is GUI routine function (marked in yellow in Method Summary).
The task program can run in console independently, user can connect the MCGUI with the task process with function checkGuiCommand() from Telerdobot class and QProcess, which a standard class from QT. To get more information about using MCGUI, please read Example I of tutorial.
You can find the head file of the MCGUI MCGUI.h
|
Function description |
slot void show_sensor(QChar Sensor1,QChar Sensor2, QChar Sensor3, QChar Sensor4, QChar Sensor5, QChar Sensor6, QChar Sensor7, QChar Sensor8)
If QChar value is ‘Y’, the corresponding number of the sensor will be shown on the GUI. If QChar value is ‘N’, the sensor field does not show the sensor number.
|
slot void show_motor(QChar p1d, QChar p1s, QChar p2d, QChar p2s, QChar d3d, QChar d4d)
This function shows the DC output on the GUI. We use two QSlider and four QLabel object to express the 2 DC output and 2 PWM output status.
P1d shows the rotation direction from the PWM1 output. P1d==’S’, PWM1 has no output, it stops. P1d==’P’, PWM1 rotates in positive direction. P1d==’N’, PWM rotates in negative direction.
P1s shows the velocity of the PWM1 output. The value range is from 0 to 99.
P2d shows the rotation direction from the PWM2 output. P2d==’S’, PWM2 has no output, it stops. P2d==’P’, PWM2 rotates in positive direction. P2d==’N’, PWM2 rotates in negative direction.
P2s shows the velocity of the PWM2 output. The value range is from 0 to 99.
P3d shows the rotation direction from the dc1 output. P3d==’S’, dc1 has no output, it stops. P3d==’P’, dc1 rotates in positive direction. P3d==’N’, dc1 rotates in negative direction.
P4d shows the rotation direction from the dc2 output. P4d==’S’, dc2 has no output, it stops. P4d==’P’, dc2 rotates in positive direction. P4d==’N’, dc2 rotates in negative direction.
|
slot void process_load()
This function is used to load the user’s program. User must write the execute file name and the path in the line edit. The process file will be added to the QProcess object through addArgument() function which defined in the QProcess class. This function connects the task program and the MCGUI object. |
slot void show_robotInfo(QChar alarminfo, QChar lastCommunicationInfo,QChar statusInfo)
This function shows the other robot status information on the GUI on the task information field and robot information field.
Alarminfo shows if there is an emergency alarm happens from the system. If alarminfo==‘Y’ then the status information field on the GUI shows “Alarm is ON” Else it shows “Alarm is OFF”.
lastCommunicationInfo shows if the communication in the last period is correct. If lastCommunicationInfo==‘Y’, the robot information field of the MCGUI shows “Last communication period has no failure”. Else it shows “Last communication period has an failure”.
statusInfo shows the robot status. The corresponding value from this QChar variable will be shown in the robot information field. statusInfo==‘F’: it shows “Telerobot is moving forward now” statusInfo==‘B’: it shows “Telerobot is moving back ward now” statusInfo==‘L’: it shows “Telerobot is turning left now” statusInfo==‘R’: it shows “Telerobot is turning right now” statusInfo==‘C’: it shows “Telerobot has been connected now” statusInfo==‘D’: it shows “Telerobot has been disconnected now” statusInfo==‘O’: it shows “Mission is over” statusInfo==‘W’: it shows “Communication checksum is wrong” statusInfo==‘A’: it shows “Telerobot is asking for sensor feedback, no active command” statusInfo==‘S’: it shows “Telerobot is stopped now” statusInfo==‘M’: it shows “Telerobot is using multi motor output mode now” statusInfo==‘r’: it shows “Telerobot is using relay DC output now” |
slot void process_start()
This function starts the task program and begins the communication between the task program and MCGUI. It checks the MCGUI program, if the condition for communication is ok, then it starts the task program. |
slot void process_pause()
This function sets the Pause_flag to true in the task program. So it can close all the dc motors output on the telerobot and hangs the task process up. It can just be released by process_continue() function. If this function is invoked, the “Pause” button will be set to disable, and Button “Continue” will be set to enable. |
slot void process_continue()
This function released the task process which is hung up by the void process_pause() function. It sets the Pause_flag of the task program to false. If this function is invoked, the “Continue” button will be set to disable, and Button “Pause” will be set to enable.
|
slot void process_cancel()
This function terminates the task program. In fact, this function sets the Stop_flag of the task program. All the hardware of the telerobot will be turned off before the task program terminated. |
void init()
This function initializes the MCGUI. All the button will be set disable except “Load” . The system period number will be set to null. The input and output buffer will be cleaned. As a system routine function, it will be automatic invoked by every “task program loading” event. |
void readFromStdout()
This routine function is invoked in every period. It accepts the standard input data from the task program and then explain it. The useful information will be shown on the MCGUI through void showRobotInfo(QChar, QChar, QChar,) , void show_sensor(QChar, QChar, QChar, QChar, QChar, QChar, QChar, QChar) and show_motor(QChar, QChar, QChar, QChar, QChar, QChar) . |
API Document : Class MCGUI |
Method Summary |
|
void |
show_sensor(QChar Sensor1,QChar Sensor2, QChar Sensor3, QChar Sensor4, QChar Sensor5, QChar Sensor6, QChar Sensor7, QChar Sensor8)
This function shows the sensor status on the GUI. More… |
void |
show_motor(QChar p1d, QChar p1s, QChar p2d, QChar p2s, QChar d3d, QChar d4d)
This function shows the status of 2 PWM motors and 2 relay motors on the GUI. |
void |
show_robot_info(QChar alarminfo, QChar lastCommunicationInfo,QChar statusInfo)
This function shows the alarm information, communication check information and robot status on the GUI. More...
|
slot void |
process_load()
This function loads the task process to the GUI. The process path have to be written in the line edit on the GUI. More... |
slot void |
process_start()
This function start the task process through a QProcess object. It builds the communication between the MCGUI and the task program. More... |
slot void |
process_pause()
This function hangs up the task program. The task program can be released by process_continue() function. More... |
slot void |
process_continue()
This function is used to release the task program which is hung up by process_pause() function. More... |
slot void |
process_cancel()
This function terminates the task program. More... |
void |
init()
The init() functions initializes the GUI. More... |
void |
readFromStdout()
This function gets the standard input from task program, which contains the useful feedback information. More... |
Constructor Summary |
MCGUI() Constructs a MCGUI object |
~MCGUI() Turn off the telerobot hardware and destructs the MCGUI object. |