Aller au contenu


marcus

Inscrit(e) (le) 07 juil. 2021
Déconnecté Dernière activité avril 04 2022 02:52
-----

#115693 STONE TFT LCD Module STM32 Service Robot Motion Status Monitoring

Posté par marcus - 04 avril 2022 - 02:46

Introduction Of Service Robot

 

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.

 

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

 

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:

 

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:

 

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:

 

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:

 

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.

 

 

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

 

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.

 

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.

 

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.

 

 

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.

 

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:

 

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

 

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;
}




#114446 Bras robotique imprimé en 3D

Posté par marcus - 22 octobre 2021 - 08:46

Et voici la vidéo que j'ai enregistrée.

 




#114445 Bras robotique imprimé en 3D

Posté par marcus - 22 octobre 2021 - 08:41

Les gars, je suis ici pour mettre à jour l'avancement du projet, j'ai acheté un bras robotique 6 axes et j'utilise un écran tactile série et un Arduino uno pour mettre en œuvre sa saisie simple.

 

robot arm.jpg




#114311 fauteuil de massage basé sur ESP32 et LCD

Posté par marcus - 29 septembre 2021 - 09:09

Aperçu du projet
 
Il s'agit d'une application de fauteuil de massage domestique. Lorsque l'écran série LCD est mis sous tension, une interface de démarrage apparaît. Après un court séjour, il sautera à une interface spécifique. Cette interface est utilisée pour régler l'heure actuelle. Lors du réglage, un clavier s'affiche. Après le réglage, cliquez sur OK pour accéder à l'interface de sélection du mode de massage. Ici, j'ai défini trois modes : massage de la tête, massage du dos et mode complet. Dans le mode, l'intensité du massage peut être réglée, les vitesses haute, moyenne et basse peuvent être réglées, et la lumière LED correspondante sera utilisée pour l'indication de l'intensité ; les temps de massage peuvent également être réglés, après avoir atteint le nombre défini, il s'arrêtera automatiquement ; dans le modèle complet, la tête et le dos seront massés en même temps, et il peut être éteint quand il n'est pas nécessaire. Ces actions se font par l'intermédiaire de l'écran tactile STONE à port série pour réaliser la transmission des commandes.
 
Modules requis pour le projet
 
ESP32
③ Module et commande de moteur pas à pas ;
④ Module de matrice de LED ;

 

Conception de l'interface utilisateur graphique

 

c-12-STONE-Touch-Screen-ESP32-for-massage-chair(1).jpg

 

schéma de connexion

 

c-5-Control-WS2812B_RGB-lamp-by-STONE-display-module(23).jpg

 

partie du code

//HEAD

uint8_t   HeadGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x03};

uint8_t   HeadGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x02};

uint8_t   HeadGearLow[9]        = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x01};

 

uint8_t   HeadTiming[9]         = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x11, 0x01, 0x00, 0x09};

 

uint8_t   HeadModeStart[9]    = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x19, 0x01, 0x41, 0x61};

uint8_t   HeadModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x24, 0x01, 0x46, 0x66};

 

//BACK

uint8_t   BackGearHigh[9]       = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x01};

uint8_t   BackGearMiddle[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x02};

uint8_t   BackGearLow[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1A, 0x01, 0x00, 0x03};

 

uint8_t   BackModeStart[9]      = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0C, 0x01, 0x42, 0x62};

uint8_t   BackModeStop[9]     = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0D, 0x01, 0x43, 0x63};

 

//Integrated

uint8_t   IntegratedModeStart[9]= {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0F, 0x01, 0x44, 0x64};

uint8_t   IntegratedModeStop[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x1F, 0x01, 0x45, 0x65};

démonstration vidéo

 




#114269 Contrôle d'accès intelligent basé sur ESP32 et LCD

Posté par marcus - 15 septembre 2021 - 02:35

Brève introduction
 
La maison intelligente devient de plus en plus courante avec le développement de la technologie, cet article se concentrera sur les aspects de sécurité du projet de contrôle d'accès intelligent.
Cet article utilise l'écran tactile de STONE pour envoyer des commandes au MCU afin de contrôler le relais et le module MFRC522.
Le principe de la lecture de carte : en pilotant le module RFID-RC522, identifier la carte d'identité proche de la carte d'identité, puis déterminer si l'ID existe dans la base de données du mot type, l'ID est la valeur type du mot, si l'existence de la vérification à travers, et ensuite imprimer le nom correspondant, et ensuite piloter la serrure électromagnétique de la même manière.
 
Matériel nécessaire
 
 
Fonction réalisée
 
1. enregistrement de la carte.
2. enregistrement du nom d'utilisateur et du mot de passe.
3. glissement de la carte pour déverrouiller la serrure électronique.
4. Enregistrement du nom d'utilisateur et du mot de passe pour déverrouiller la serrure électronique.
 
Schéma de connexion
 
connection.jpg
 
Conception de l'interface utilisateur graphique
 
GUI design.png
 
code
 
import mfrc522
import time
import _thread
from os import uname
from machine import Pin, UART
#from pyb import UART
#import machine

suos = Pin(32,Pin.OUT)
uart2 = UART(2, baudrate=115200, rx=16,tx=17,timeout=10)

ESP32_HSPI_CLOCK = 14
ESP32_HSPI_SLAVE_SELECT = 15
ESP32_HSPI_MISO = 12
ESP32_HSPI_MOSI = 13
ESP32_MFRC522_RST = 5

rx3 = []
rx_name = []
user_id_flag = False
password_flag = False
temp_id = ''
temp_mima = ''
personnel_id = {'zbw':[236,230,169,47],'lbw':[19,165,93,4]}
personnel_ps = {'zbw':'zbw3366','lbw':'lbwnb'}
admin_password = ('yyds')
button_cmd = [16,1]
edit1_cmd = [16,112]
edit2_cmd = [16,113]
edit3_cmd = [16,114]

if uname()[0] == 'esp32':
	rdr = mfrc522.MFRC522(ESP32_HSPI_CLOCK, ESP32_HSPI_MOSI, ESP32_HSPI_MISO, ESP32_MFRC522_RST, ESP32_HSPI_SLAVE_SELECT)

def do_write():
	try:
		(stat, tag_type) = rdr.request(rdr.REQIDL)
		if stat == rdr.OK:
			(stat, raw_uid) = rdr.anticoll()
			if stat == rdr.OK:
				print("New card detected")
				print("  - tag type: 0x%02x" % tag_type)
				print("  - uid : 0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3]))
				print("")
				if rdr.select_tag(raw_uid) == rdr.OK:
					key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
					if rdr.auth(rdr.AUTHENT1A, 8, key, raw_uid) == rdr.OK:
						stat = rdr.write(8, b"\x00\x53\x00\x54\x00\x4F\x00\x4E\x00\x45\x0a\x0b\x0c\x0d\x0e\x0f")
						rdr.stop_crypto1()
						if stat == rdr.OK:
							print("Data written to card")
						else:
							print("Failed to write data to card")
					else:
						print("Authentication error")
				else:
					print("Failed to select tag")

	except KeyboardInterrupt:
		print("write error")


def do_read():
	while True:
		try:
			(stat, tag_type) = rdr.request(rdr.REQIDL)

			if stat == rdr.OK:
				(stat, raw_uid) = rdr.anticoll()
				if stat == rdr.OK:
					print("New card detected")
					print("  - tag type: 0x%02x" % tag_type)
					print("  - uid   : 0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3]))
					print (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3])
					print("")
					if rdr.select_tag(raw_uid) == rdr.OK: 
						key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
						if rdr.auth(rdr.AUTHENT1A, 8, key, raw_uid) == rdr.OK:
							print("Address 8 data: %s" % rdr.read(8))
							for ps in personnel_id:
								if raw_uid[0:4:1] == personnel_id.get(ps):
									suos.value(1)
									print(ps)
									uart_write(ps, *raw_uid[0:4:1])
									time.sleep(3)
									uart2.sendbreak()
									break
							rdr.stop_crypto1()
							time.sleep(3)
							suos.value(0)
						else:
							print("Authentication error")
					else:
						print("Failed to select tag")
			if uart2.any()>1:
				rx2 = []
				data_name2 = ''
				bin_data = uart2.read(40)
				uart2.sendbreak()
				rx1 = list(bin_data)
				for item in rx1:
					rx2.append(chr(item))
				print(rx2)
				if rx1[3:5:1] == button_cmd:
					data_name_len = rx1[6] - 1
					data_name = rx2[7:data_name_len+7:1]
					data_name2 = ''.join(data_name)
					print(data_name2)
					if data_name2 == 'back3':
						return
		except KeyboardInterrupt:
			print("read error")

def do_read2 (idd):
	print(idd)
	while True:
		try:
			(stat, tag_type) = rdr.request(rdr.REQIDL)

			if stat == rdr.OK:
				(stat, raw_uid) = rdr.anticoll()
				if stat == rdr.OK:
					print("New card detected")
					print("  - tag type: 0x%02x" % tag_type)
					print("  - uid   : 0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3]))
					print (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3])
					print("")
					if rdr.select_tag(raw_uid) == rdr.OK: 
						key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
						if rdr.auth(rdr.AUTHENT1A, 8, key, raw_uid) == rdr.OK:
							print("Address 8 data: %s" % rdr.read(8))
							personnel_id[idd] = raw_uid[0:4:1]
							uart_write3(*raw_uid[0:4:1])
							rdr.stop_crypto1()
						else:
							print("Authentication error")
					else:
						print("Failed to select tag")
			if uart2.any()>1:
				rx2 = []
				data_name2 = ''
				bin_data = uart2.read(40)
				uart2.sendbreak()
				rx1 = list(bin_data)
				for item in rx1:
					rx2.append(chr(item))
				if rx1[3:5:1] == button_cmd:
					data_name_len = rx1[6] - 1
					data_name = rx2[7:data_name_len+7:1]
					data_name2 = ''.join(data_name)
					print(data_name2)
				if data_name2 == 'back1':
					return

		except KeyboardInterrupt:
			print("read error")

def uart_write(text, *ids):
#	print(text, *ids)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardname1","text":"'+str(text)+'"}>ET')
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid1","text":"'+str(ids)+'"}>ET')
	uart2.write('ST<{"cmd_code":"set_visible","type":"widget","widget":"lock1","visible":true}>ET')
	time.sleep(3)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardname1","text":"''"}>ET')
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid1","text":"''"}>ET')
	uart2.write('ST<{"cmd_code":"set_visible","type":"widget","widget":"lock1","visible":false}>ET')

def uart_write2(text,text2):
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"'+text+'"}>ET')
	time.sleep(3)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"'+text2+'"}>ET')
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit2","text":"''"}>ET')

def uart_write3(*id2):
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"'+str(id2)+'"}>ET')
	time.sleep(3)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"''"}>ET')

def uart_write4(text,text2):
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"login","text":"'+text+'"}>ET')
	time.sleep(1)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"login","text":"'+text2+'"}>ET')
	time.sleep(1)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit3","text":"''"}>ET')
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit4","text":"''"}>ET')
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit7","text":"''"}>ET')

def uart_write5():
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"'+str(id2)+'"}>ET')
	time.sleep(3)
	uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"cardid","text":"''"}>ET')

def card_zhuce():
	while True:
		if uart2.any():
			user_id = ''
			password = ''
			rx2 = []
			rx_num = 0
			bin_data = uart2.read(40)
			uart2.sendbreak()
			rx1 = list(bin_data)
			for item in rx1:
				rx2.append(chr(item))
				rx_num += 1
			data_end = rx_num-5
			data_id_st = rx2[8:13:1]
			data_id_st2 = ''.join(data_id_st)
			print(data_id_st2)
			if data_id_st2 == 'edit1':
				data_id_st3 = rx2[15:data_end:1]
				data_id_st4 = ''.join(data_id_st3)
				print(data_id_st4)
				if data_id_st4 != '':
					name = True
			elif data_id_st2 == 'edit2':
				data_id_st5 = rx2[15:data_end:1]
				data_id_st6 = ''.join(data_id_st5)
				if data_id_st6 == admin_password:
					admin = True
					uart_write2('Verification passed!','Please place the card!')
					do_read2(data_id_st4)
					return

def mima_zuce():
	temp_id3 = ''
	temp_mima3 = ''
	while True:
		if uart2.any():
			user_id = ''
			password = ''
			rx2 = []
			rx_num = 0
#			data_end = 0
			bin_data = uart2.read(40)
			uart2.sendbreak()
			rx1 = list(bin_data)
			for item in rx1:
				rx2.append(chr(item))
				rx_num += 1
#				if (rx2[rx_num] == 'T') and (rx2[rx_num-1] == 'E') and (rx2[rx_num-2] == '>'):
#					break
			data_end = rx_num-5
			data_id_st = rx2[8:13:1]
			data_id_st2 = ''.join(data_id_st)
			print(data_id_st2)
			if rx1[3:5:1] == button_cmd:
				data_name_len = rx1[6] - 1
				data_name = rx2[7:data_name_len+7:1]
				data_name2 = ''.join(data_name)
				print(data_name2)
				if data_name2 == 'back2':
					return
			if data_id_st2 == 'edit3':
				data_id_st3 = rx2[15:data_end:1]
				data_id_st4 = ''.join(data_id_st3)
				print(data_id_st4)
				user_id_flag = True
				temp_id3 = data_id_st4
#				personnel_ps[temp_id] = raw_uid[0:4:1]
			elif data_id_st2 == 'edit4':
				data_id_st5 = rx2[15:data_end:1]
				data_id_st6 = ''.join(data_id_st5)
				print(data_id_st6)
#				if personnel_ps.get(temp_id) == data_id_st6:
				password_flag = True
				temp_mima3 = data_id_st6
#					personnel_ps[temp_id] = password_flag

#			print(rx2,user_id_flag,password_flag)

			elif data_id_st2 == 'edit7':
				data_id_st5 = rx2[15:data_end:1]
				data_id_st6 = ''.join(data_id_st5)
				if (data_id_st6 == admin_password) and (password_flag == True) and (user_id_flag == True):
					admin = True
					personnel_ps[temp_id3] = temp_mima3
					password_flag = False
					user_id_flag = False
					uart_write4('Verification passed!','login was successful!')


def password_loin():
	temp_id2 = ''
	temp_mima = ''
	while True:
		if uart2.any():
			user_id = ''
			password = ''
			rx2 = []
			rx_num = 0
#			data_end = 0
			bin_data = uart2.read(40)
			uart2.sendbreak()
			rx1 = list(bin_data)
			for item in rx1:
				rx2.append(chr(item))
				rx_num += 1
#				if (rx2[rx_num] == 'T') and (rx2[rx_num-1] == 'E') and (rx2[rx_num-2] == '>'):
#					break
			data_end = rx_num-5
			data_id_st = rx2[8:13:1]
			data_id_st2 = ''.join(data_id_st)
			print(data_id_st2)
			if rx1[3:5:1] == button_cmd:
				data_name_len = rx1[6] - 1
				data_name = rx2[7:data_name_len+7:1]
				data_name2 = ''.join(data_name)
				print(data_name2)
				if data_name2 == 'back4':
					return
			if data_id_st2 == 'edit5':
				data_id_st3 = rx2[15:data_end:1]
				data_id_st4 = ''.join(data_id_st3)
				print(data_id_st4)
				if data_id_st4 in personnel_ps:
					user_id_flag = True
					temp_id2 = data_id_st4
			elif data_id_st2 == 'edit6':
				data_id_st5 = rx2[15:data_end:1]
				data_id_st6 = ''.join(data_id_st5)
				print(data_id_st6)
				print(temp_id2)
				print(personnel_ps)
				if personnel_ps.get(temp_id2) == data_id_st6:
					password_flag = True

#			print(rx2,user_id_flag,password_flag)
					print(user_id_flag,password_flag)
					if (password_flag == True) and (user_id_flag == True):
						uart_write(temp_id2,temp_id2)
						password_flag = False
						user_id_flag = False
						suos.value(1)
						uart2.write('ST<{"cmd_code":"set_visible","type":"widget","widget":"lock2","visible":true}>ET')
						uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit5","text":"''"}>ET')
						uart2.write('ST<{"cmd_code":"set_text","type":"label","widget":"edit6","text":"''"}>ET')
						time.sleep(3)
#						uart_write('student','')
						suos.value(0)
						uart2.write('ST<{"cmd_code":"set_visible","type":"widget","widget":"lock2","visible":false}>ET')
						uart2.sendbreak()

while True:
	if uart2.any()>1:
		rx2 = []
		data_name2 = ''
		bin_data = uart2.read(40)
#		time.sleep(1)
		uart2.sendbreak()
#		time.sleep(1)
		rx1 = list(bin_data)
		for item in rx1:
			rx2.append(chr(item))
		print(rx2)
		if rx1[3:5:1] == button_cmd:
			data_name_len = rx1[6] - 1
			data_name = rx2[7:data_name_len+7:1]
			data_name2 = ''.join(data_name)
			print(data_name2)
			if data_name2 == 'card1':
				card_zhuce()
			elif data_name2 == 'password1':
				mima_zuce()
			elif data_name2 == 'card2':
				do_read()
			elif data_name2 == 'password2':
				password_loin()


 




#114220 Bras robotique imprimé en 3D

Posté par marcus - 09 septembre 2021 - 11:00

Bonjour à tous, je suis ici pour mettre à jour ce post.
J'ai récemment terminé la conception de l'interface utilisateur pour le bras du robot, peut-être que quelqu'un a des suggestions à me faire ?
 
机械臂界面1.jpg
 
机械臂界面3.jpg
 
机械臂界面2.jpg