EN

STONE TFT LCD MODULE + STM32 + SERVICE ROBOT MOTION STATUS MONITORING

 

 

Introduction of Service Robot

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (1)

 

 

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.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (2)

 

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

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (3)

 

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:

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (4)

 

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:

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (5)

 

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:

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (6)

 

 

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 design 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.

 

https://www.stoneitech.com/support/download/software

 

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:

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (7)

 

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 480x272.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (8)

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (9)

 

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

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (10)

 

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.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (11)

 

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.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (12)

 

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.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (13)

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (14)

 

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 clicking 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.

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (15)

 

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:

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (16)

 

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):

 

16-STONE-TFT-LCD-Module-STM32-Service-Robot-Motion-Status-Monitoring (17)

 

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;

}

 

Article from: https://mechatronicsblog.com/service-robot-motion-status-monitoring/