STONE TFT LCD Module STM32 Service Robot Motion Status Monitoring

Lorin1987

Üye
Katılım
8 Tem 2021
Mesajlar
23
Puanları
1
Yaş
37

Introduction Of Service Robot

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring

Fundamentals Of Service Robot

As a kind of semi-autonomous or fully self-help robot, service robots are able to perform useful service work for human beings, such as carrying, cleaning, and rescue. As service robots gradually enter the social life of people, they are now widely used in public places such as exhibition halls, restaurants, and hotels, which have a profound impact on improving the quality of human life and the service industry.
Usually, service robots are equipped with high-precision LIDAR, voice acquisition module, motion module, display screen, wireless connection module, and other major equipment. The robot uses LIDAR to build a high-precision indoor map, a voice module to receive voice commands, a motion module to move the robot to the target location, and a wireless module to receive remote commands from the controller to achieve remote intelligent control.
The movement process of the service robot needs to go through functions such as map construction, path planning, speed planning, and roadblock avoidance, as shown in the figure below.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


In this paper, a mobile robot demo is built, using an omnidirectional mobile chassis, so that the robot can complete steering, translation, and other actions in a small range.
Remote monitoring module: stm32F407 + wifi mode + STONE STVC043WT-01 display
Robot Host control center: stm32F707 expansion board (ported freer to the system)
Motion control module: stm32f407 + motor driver
Voice acquisition module: Xunfei Six Pulse Voice Array
Lidar: Silan Technology LPR Lidar
Mobile Chassis: ROTACASTER 125mm *3

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Here we take a single-story scenario of a high-end office building as an example. The robot needs to serve the office workers in the building at regular intervals, and the task requires the robot to sense the environment and its own motion state through intrinsic or extrinsic sensors and perform collision-free motion from the robot’s current location to the target location according to the principles of optimal time, shortest path, or lowest energy consumption.
To perform this task successfully, the floor environment is first scanned by using LIDAR to construct an indoor map and indicating the location of the task point with coordinates:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


As the robot is performing its task, the operator cannot know the real-time status of the robot and give commands in time.
In order to enable the controller to remotely access the robot status and give control commands from the control center, I used the STM32F407 mainboard to interact with the robot through an external network card and the stone STVC043WT-01 display for UI design in the demo to improve the efficiency of the operator’s use, the schematic diagram of the design is as follows:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


This article will focus on how to use the stone STVC043WT-01 to design a UI to display the status of the service robot in real-time. Before working on the stone display, we need to write a simple test demo to ensure that the remote control module receives the robot’s current status (robot ID, destination, x/y/z motor speed, coordinates of robot’s current position, etc.) over the wireless network in a timely manner.
The following figure shows the robot state data generated when the robot is rotating at the origin, from the data it is clear that the x, y, and z motor speeds should be consistent when the robot is in rotation:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


The Procedure Of Stone STVC043WT-01 Display

Stone provides a set of display design tools that are easy to use, and we can complete the development of display demos in a very short time through the company’s STV series displays. Therefore, the Stone STVC043WT-01 display was chosen to monitor the status of the remote machine in real-time. The development of the display is divided into three main steps:
1. Design the display UI
2. Develop the corresponding embedded host program, mainly designing the UART communication
Debugging of the display and the embedded host.

UI Design

1. Create A New Project

First, download the latest version of the TOOL-2019 tool from the stone official website.
According to the display parameters, create the corresponding project, here is the example of STVC043WT-01. (480*272).
Select File -> New, set the project screen pixels to 480*272:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


2. Insert Images And Design UI

Right-click project file -> add to insert a picture drawn with other tools, note that the size of the picture must be consistent with the display, the size of the pictures used in this article are 480×272.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Set the jump link in the current state of the home page:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Then we use the stone tool to add a challenge link to the home page at the return button: Toolbar -> Hardware parameter configuration0, insert a window at the return button and modify the name definition and page switch to enable it to jump to the home page via the return button.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Insert the text variable in Robot ID and Destination, and insert the data variable in Motor speed and current location, as shown in the figure below. It should be noted that a Variable memory address represents the address where data or text is stored, and word Length represents the maximum length of displayable bytes.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


3. Compile And Download

After completing the above steps, check the screen configuration, make sure the baud rate is 115200 and the command handler is 0xA5 0x5A. After the check is completed, click the compile option and download the file to the display.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


4. Debug

When the system starts, the display shows the Home Page, which contains six options. The system will establish a wireless connection between the remote console and the robot when we click on the connect option; conversely, the disconnect will disconnect the wireless connection. The show map option will display a map of the indoor environment which is created by the robot; the clear state option will initialize the system and send a command to interrupt the robot’s task execution to make it return to the starting point; the current state option displays and changes the robot’s state; and the return origin option will prompt the robot to return to the starting point.

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Select the current state to check the current robot state. When the robot is at the starting point, the display shows the initial value of the robot state:

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


After setting the robot’s target, the robot starts its task, at which time the display will show the robot’s ID, destination, speed, and coordinates in real-time, as shown in the figure below, where the robot rotates at coordinates (174,269):

STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring


Select the return option and the display will return to the Home page.
Check that whether the UART data sent from the remote console to the display matches the screen display:

A5 5A 0b 82 01 20 53 48 2D 4B 4C 2D 30 31 //Robot ID: SH-KL_01
A5 5A 09 82 01 9B 6F 66 66 69 63 65 //Destination: office
A5 5A 05 82 01 14 0f 09 //motor x speed 3849 r/min
A5 5A 05 82 01 18 0f 09 //motor y speed 3849 r/min
A5 5A 05 82 01 1a 0f 09 //motor z speed 3849 r/min
A5 5A 05 82 01 1c 00 ae //coordinate-axis X :174
A5 5A 05 82 01 1e 01 0d //coordinate-axis X :269

5. Part of the code sharing

Serial_debug.CPP:​

#include
#include "serial_debug.h"
using namespace std;
int debug_wait() {
#if DEBUG
cout << "press any key to contine" << endl;
getchar();
#endif
return 0;
}
bool creat_serial(HANDLE &hComm,string strPort) {
//Second, for the serial port number greater than 9 (for example, COM12), the serial port name in the CreateFile() function should be written "\. \COM12"。
// hComm = CreateFile(TEXT("com6"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hComm = CreateFile(strPort.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hComm == INVALID_HANDLE_VALUE) {
cout << "Fail to open Serial Port.!!!" << endl;
debug_wait();
return FALSE;
}
else {
cout << "Success to open Serial Port. " << endl;
debug_wait();
return TRUE;
}
}
bool close_serial(HANDLE &hComm) {
CloseHandle(hComm);
return TRUE;
}
bool set_serial(HANDLE &hComm)
{
DCB dcb;
GetCommState(hComm, &dcb);
dcb.BaudRate = CBR_115200;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT;
SetCommState(hComm, &dcb);
return TRUE;
}
bool WriteSerial(char* btData, ULONG ulSize, HANDLE hSerial)
{
DWORD dwNumBytes, dwRet;
dwRet = WriteFile(hSerial, //Handle
btData, //Data buffer
ulSize, //Buffer size
&dwNumBytes, //written bytes
NULL); //don't support
return (dwRet != 0);
};
int serial_process()
{
HANDLE hComm;
string portname = "com6";
bool ret = FALSE;
string buff = "serial opened";
char c[20]="";//A5 5A 03 81 00 01
// strcpy_s(c, buff.c_str());
ret=creat_serial(hComm, portname);
if (!ret)
return 0;
set_serial(hComm);
if (!WriteSerial(c, 7, hComm))//Send data hello to com1
printf("ERROR!!");
wait_for_end();// pending until uart is not need.
close_serial(hComm);
return 0;
}
 

Yeni mesajlar

Forum istatistikleri

Konular
129,686
Mesajlar
929,004
Kullanıcılar
452,387
Son üye
fevzican

Yeni konular

Geri
Üst