Disclosure of Invention
The application provides a barrier data processing method, device, equipment and storage medium, which are used for solving the problems that the data fusion time is long and the fusion rate is slow in the existing data fusion mode because data points in each frame of data of each laser radar are sequentially processed.
In a first aspect, the present application provides an obstacle data processing method, including:
acquiring current frame obstacle data acquired by each laser radar, wherein the current frame obstacle data comprises a plurality of data points;
grouping data points in the obstacle data of the current frame aiming at each obstacle data of the current frame to generate at least one data point group;
all data points in each data point group are processed in parallel to generate a converted data set.
Optionally, for each current frame of obstacle data, grouping data points in the current frame of obstacle data specifically includes: and grouping the data points in the obstacle data of the current frame according to the total number of the parallel threads to generate at least one data point group.
Optionally, the data points in the obstacle data of the current frame are grouped according to the total number of parallel threads, so as to generate at least one data point group, which specifically includes: judging whether the total number of data points in the barrier data of the current frame is an integral multiple of the total number of parallel threads, if so, equally dividing the barrier data of the current frame according to the total number of parallel threads so that the number of data points in each data point group is the total number of parallel threads; if not, grouping the obstacle data of the current frame according to the total number of parallel threads, so that the number of data points in one data point group is smaller than the total number of parallel threads, and the number of data points in each remaining data point group is the total number of parallel threads.
The embodiment has the following specific beneficial effects: the data points are grouped according to the total number of the parallel threads, so that the parallel threads can be fully utilized, idle threads caused by mismatching of the total number of the data points of the data point group and the total number of the parallel threads are avoided, and the processing efficiency can be further improved.
Optionally, all data points in each data point group are processed in parallel to generate a converted data set, specifically including: n parallel threads process N data points in each data point group to generate N conversion data points, wherein each thread is used for carrying the processing process of one data point, and N is the number of the data points in the data point group.
Optionally, the N parallel threads process N data points in each data point group to generate N converted data points, specifically including: the N parallel threads call the same conversion parameter and process N data points in each data point group.
Optionally, the N parallel threads call the same conversion parameter, and process N data points in each data point group, which specifically includes: the N parallel threads call rotation parameters, and the N data points are subjected to rotation transformation to generate N intermediate data points; the N parallel threads call translation parameters, and translate and convert the N data points to generate N converted data points.
Optionally, before the N parallel threads invoke the rotation parameter and perform rotation transformation on the N data points to generate N intermediate data points, the method further includes:
the N parallel threads call the same coordinate conversion function to convert the laser emission angle and the distance of the obstacle into the position coordinates of the obstacle, wherein the data points comprise: the laser firing angle and the distance of the obstruction.
Optionally, the rotation parameters are:
the translation parameters are:
wherein alpha is the mounting angle of the laser radar, (t) x ,t y ) Is the mounting position of the laser radar.
Optionally, the mounting angle and the mounting position of the lidar are both in the robot coordinate system.
The embodiment has the following specific beneficial effects: the same rotation parameter and the same translation parameter are called by N threads, so that the processing of N data points is completed, the memory usage amount can be reduced, and the processing efficiency is further improved.
Optionally, after parallel processing of the data points in each data point group to generate the transformed data set, the method further comprises: extracting a distance of at least one obstacle from the transformed data set; if the distance between any obstacle reaches a preset threshold value, generating a command for controlling the running of the robot.
The embodiment has the following specific beneficial effects: the processing speed can be increased by processing each frame of data through a plurality of parallel threads, so that the robot can determine the distance between the robot and the obstacle data, the robot is controlled to run according to the distance, the response speed of the robot is increased, the collision between the robot and the obstacle is avoided,
in a second aspect, the present application provides an obstacle data processing device comprising:
the acquisition module is used for acquiring current frame obstacle data acquired by each laser radar, wherein the current frame obstacle data comprises a plurality of data points;
the grouping module is used for grouping data points in the obstacle data of the current frame aiming at each obstacle data of the current frame to generate at least one data point group;
and the processing module is used for carrying out parallel processing on all data points in each data point group so as to generate a conversion data set.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing a program;
an image processor GPU for executing a program stored in a memory, the GPU being configured to execute the obstacle data processing method according to the first aspect and the alternative when the program is executed.
In a fourth aspect, the present application provides a robot comprising:
the laser radars are used for collecting obstacle data of the current frame;
an image processor GPU for executing the obstacle data processing method according to the first aspect and the optional aspects.
In a fifth aspect, the present application provides a computer readable storage medium comprising instructions which, when run on a computer, cause the computer to perform the obstacle data processing method of the first aspect and alternatives.
The application provides an obstacle data processing method, device, equipment and storage medium, wherein data points collected by each laser radar are grouped to obtain data point groups, and then the data points in the data point groups are processed in parallel, so that the data processing efficiency can be improved, the robot control part can extract the distance of an obstacle after receiving a conversion data set, and the path planning is performed, so that the response rate of the robot is improved, and the robot is prevented from colliding with the obstacle.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is apparent that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
Fig. 1 is a schematic diagram of a robot system provided in the present application, as shown in fig. 1, where the robot system is composed of a mechanical part, a sensing part and a control part, the sensing part is used for sensing an environment, and the task of the control system is to control the mechanical part of the robot to complete a specified motion and a specified function according to a working instruction of the robot and environmental information fed back from the sensing part.
Wherein, single line laser radar is common sensing part among the robot system, according to laser radar's quantity, and robot system can divide into many laser radar robots and single laser radar robot, and fig. 2 is the outward appearance schematic diagram of many laser radar robots that this application provided, as shown in fig. 2, is equipped with a plurality of mounting points in the robot belly, installs a single line laser radar on every mounting point. Each laser radar collects barrier data in one direction, and then fusion processing is carried out on the barrier data in multiple directions to obtain all-around barrier data. The control part of the robot generates corresponding control instructions according to the omnibearing barrier data so as to control the robot to run.
The principle of data acquisition of each single-line laser radar is as follows: the method comprises the steps of changing the emitting angle gamma of laser emitted each time through 360-degree rotation of an internal structure, determining the distance d between an obstacle and the laser radar when the emitting angle gamma is detected by detecting the time difference between laser emission and laser receiving, taking the distance d between the obstacle and the laser radar when the emitting angle gamma is the emitting angle gamma as a data point, and acquiring a plurality of data points as a frame data for output after one rotation of the internal structure. After each laser radar acquires a single-frame obstacle data point, the data points in the single-frame obstacle data are required to be processed and fused one by one so as to generate all-dimensional obstacle data. Based on the principle, the number of data points in obstacle data of each frame is huge, and the prior art adopts one-by-one processing, so that the data fusion time is long and the fusion rate is slow.
The application aims to provide an obstacle data processing method for solving the problems in the prior art. The invention idea of the application is as follows: aiming at a data set acquired by a laser radar, wherein the processing modes of all data points are the same, the conversion parameters are the same, the data set is grouped to generate at least one data point group, the same conversion parameters are called for each data point group to carry out parallel processing, and the parallel processing of a plurality of data points can be completed.
Fig. 3 is a diagram illustrating a method for processing obstacle data according to an embodiment of the present application, where, as shown in fig. 3, the method for processing obstacle according to the embodiment of the present application includes:
s101, acquiring obstacle data of a current frame acquired by each laser radar.
When the laser radars are required to sense the external environment, each laser radar scans the external environment to obtain current frame obstacle data, wherein the current frame obstacle data comprises a plurality of data points, and the data points are specifically a laser emission angle gamma and a distance d between the obstacle and the laser radars when the angle is gamma.
S102, data points in the obstacle data of each current frame are grouped according to the obstacle data of each current frame, and at least one data point group is generated.
Wherein after obtaining the current frame of obstacle data, all data points in the current frame of obstacle data are grouped to generate at least one data point group. The number of data points in each data point set is not limited.
S103, all data points in each data point group are processed in parallel to generate a conversion data set.
Wherein after obtaining at least one data point group, at least one data point group is processed in batches, that is, one data point group is processed first, and then the next data point group is processed until all data point groups are processed. For each data point group, all data points in the data point group are processed at the same time to obtain a conversion data point group. And combining the plurality of conversion data point groups to generate a conversion data set, so that the data point fusion of the plurality of laser radars can be completed.
In the obstacle data processing method provided in the first embodiment of the present application, by grouping all data points in the obstacle data set of the current frame to perform parallel processing on all data points in each data point group, compared with the scheme in the prior art, the processing rate can be improved by grouping all data points in the data point group at the same time.
The following focuses on describing a method for processing obstacle data according to a second embodiment of the present application, where the method for processing obstacle data according to the second embodiment of the present application includes the following steps:
s201, acquiring obstacle data of the current frame acquired by each laser radar.
Here, this step is already described in detail in S101, and the repetition is not described here again.
S202, data points in the obstacle data of each current frame are grouped according to the obstacle data of each current frame, and at least one data point group is generated.
As shown in fig. 4, because the processing procedure and the processing parameters of the data points collected by the same laser radar are the same, at least one data point group is generated by grouping the obstacle data of the current frame according to the total number of parallel threads, specifically:
and judging whether the total number of data points in the barrier data of the current frame is an integral multiple of the total number of parallel threads, if so, equally dividing the barrier data of the current frame according to the total number of parallel threads, so that the number of data points in each data point group is the total number of parallel threads. If not, grouping the obstacle data of the current frame according to the total number of parallel threads, so that the number of data points in one data point group is smaller than the total number of parallel threads, and the number of data points in each remaining data point group is the total number of parallel threads.
S203, all data points in each data point group are processed in parallel to generate a conversion data set.
Wherein, for each data point group, a thread is allocated to each data point in the data point group, and all data points of the data point group are processed by using N parallel threads to generate N converted data points, wherein N is the number of data points in the data point group. If the total number of data points in the data point group is the same, the number of parallel threads of the data point group is the same, and if the total number of data points in the data point group is different, the number of parallel threads of the data point group is different.
If the data points in the data point group are collected by the same laser radar, the parallel threads can call the same processing parameters when the parallel threads process all the data in the data point group, so that the processing speed is further improved.
In the obstacle data processing method provided in the second embodiment, the obstacle data of each current frame is grouped according to the total number of parallel threads, so that the parallel threads can be used for processing data points, and the parallel threads can call the same processing parameters, so that the processing rate is further improved.
The following illustrates an obstacle data processing method provided in the third embodiment of the present application, where the obstacle data processing method provided in the third embodiment of the present application includes the following steps:
s301, acquiring obstacle data of a current frame acquired by each laser radar.
The robot is provided with 2 laser radars, and two types of data points exist in the current frame obstacle data set, wherein one type of data points are data points collected by a first laser radar, and the other type of data points are data points collected by a second laser radar. The data points are specifically a laser emission angle gamma and a distance d of the obstacle from the laser radar when the angle gamma is the angle gamma.
S302, data points in the obstacle data of each current frame are grouped according to the obstacle data of each current frame, and at least one data point group is generated.
Wherein each frame of barrier data is grouped according to the total number of parallel threads, for example: the total number of parallel threads is 32, and the total number of data points in all data point groups is 32 by grouping obstacle data of each frame, or the total number of data points in only one data point group is kept to be smaller than 32, and the total number of data points in the rest all data point groups is 32.
S303, carrying out parallel processing on all data points in each data point group to generate a conversion data set.
All data points in the data point group are processed in parallel by using 32 parallel threads to generate a conversion data point group, and then the conversion data point groups are combined to generate a conversion data set.
The data points in each data point group are collected by the same laser radar, and the parallel threads can call the same conversion parameter when processing the data points. Wherein the conversion parameters include: rotation parameters and translation parameters. The 32 parallel threads call the rotation parameters, and the rotation transformation is performed on the 32 data points to generate 32 intermediate data points. The 32 parallel threads call the translation parameters, and translate the 32 data points to generate 32 converted data points.
In order to facilitate the parallel threads to process a plurality of data points, the 32 parallel threads call the same coordinate conversion function to convert the laser emission angle and the distance of the obstacle into the position coordinates of the obstacle. The coordinate conversion function specifically includes:
x=dcosγ
y=dsinγ
where (x, y) represents the position coordinates of the obstacle and d represents the distance of the obstacle when the emission angle is γ.
When converting the emission angle and the obstacle distance into obstacle coordinate positions, the following rotation parameters and translation parameters are invoked by 32 threads, generating converted data points.
Wherein, the rotation parameters are:
the translation parameters are:
wherein alpha is the mounting angle of the laser radar, (t) x ,t y ) The installation angle and the installation position of the laser radar are both in a robot coordinate system, so that conversion data points generated by calling the rotation and translation parameters are data points in the robot coordinate system.
The process of obtaining the above-described rotation parameters and translation parameters is emphasized below. In order to convert the data points in the laser coordinate system to the robot coordinate system, the conversion process is divided into a rotation process and a translation process.
As shown in fig. 5, the intermediate coordinate system is obtained by rotating the laser coordinate system by an angle α, and the coordinates of the same point P on the two coordinate systems are as follows:
x=OEcosα
=(x”-y”tanα)cosα
=x”cosα-y”sinα
y=EH+PE
=xtanα+y”/cosα
=(x”cosα-y”sinα)tanα+y”/cosα
=x”sinα+y”cosα
as shown in fig. 6, the laser coordinate system is translated by a distance (t x ,t y ) The relationship of the same point P on two coordinate systems is as follows:
x=x”+t x
y=y”+t y
after the translation conversion and the rotation conversion are overlapped, the following conversion relation can be obtained:
the CudaMat tool is locally loaded in the robot control chip to process each data point group and generate conversion data points.
S304, extracting the distance of at least one obstacle from the conversion data set.
The conversion data points in the conversion data set can reflect obstacle information in two directions of the robot, and the distance from at least one obstacle to the robot is extracted by carrying out semantic extraction on the conversion data points.
S305, if the distance of any obstacle reaches a preset threshold value, generating a command for controlling the running of the robot.
The control part of the robot judges whether the distance from the obstacle reaches a preset threshold after receiving the distance from the obstacle to the robot, and if the distance reaches the preset threshold, the control part of the robot generates an instruction for controlling the running of the robot so as to prevent the robot from colliding with the obstacle. If the preset threshold is not reached, no instruction is required to be generated.
In the obstacle data processing method provided in the third embodiment, data points collected by the same laser radar are grouped, so that the parallel threads call the same conversion parameter to process all data in the data point group, the data processing efficiency is improved, and after receiving the obstacle data, a control module of the robot can quickly generate an instruction to avoid collision between the robot and the obstacle.
Fig. 7 is a schematic structural diagram of an early warning device provided in a fourth embodiment of the present application, and as shown in fig. 7, the present application provides an obstacle data processing apparatus, where the obstacle data processing apparatus 400 includes:
an acquisition module 401, configured to acquire current frame obstacle data acquired by each lidar, where the current frame obstacle data includes a plurality of data points;
a grouping module 402, configured to group data points in the obstacle data of the current frame for each current frame obstacle data, and generate at least one data point group;
a processing module 403, configured to process all data points in each data point group in parallel to generate a converted data set.
Optionally, the grouping module 402 is specifically configured to: and grouping the data points in the obstacle data of the current frame according to the total number of the parallel threads to generate at least one data point group.
Optionally, the grouping module 402 is specifically configured to: judging whether the total number of data points in the barrier data of the current frame is an integral multiple of the total number of parallel threads, if so, equally dividing the barrier data of the current frame according to the total number of parallel threads so that the number of data points in each data point group is the total number of parallel threads; if not, grouping the obstacle data of the current frame according to the total number of parallel threads, so that the number of data points in one data point group is smaller than the total number of parallel threads, and the number of data points in each remaining data point group is the total number of parallel threads.
Optionally, the processing module 403 is specifically configured to: n parallel threads process N data points in each data point group to generate N conversion data points, wherein each thread is used for carrying the processing process of one data point, and N is the number of the data points in the data point group.
Optionally, the processing module 403 is specifically configured to: the N parallel threads call the same conversion parameter and process N data points in each data point group.
Optionally, the processing module 403 is specifically configured to: the N parallel threads call rotation parameters, and the N data points are subjected to rotation transformation to generate N intermediate data points; the N parallel threads call translation parameters, and translate and convert the N data points to generate N converted data points.
Optionally, the apparatus further comprises a preprocessing module 404, where the preprocessing module 404 is configured to: before N parallel threads call rotation parameters and perform rotation transformation on N data points to generate N intermediate data points, the N parallel threads call the same coordinate conversion function to convert the laser emission angle and the distance of the obstacle into the position coordinates of the obstacle, wherein the data points comprise: the laser firing angle and the distance of the obstruction.
Optionally, the rotation parameters are:
the translation parameters are:
wherein alpha is the mounting angle of the laser radar, (t) x ,t y ) Is the mounting position of the laser radar.
Optionally, the mounting angle and the mounting position of the lidar are both in the robot coordinate system.
Optionally, the apparatus further comprises a control module 405, where the control module 405 is configured to, after parallel processing the data points in each data point group to generate the converted data set, further comprise: extracting a distance of at least one obstacle from the transformed data set; for each obstacle, if the distance of the obstacle reaches a preset threshold value, a command for controlling the running of the robot is generated.
Fig. 8 is a schematic structural diagram of an electronic device in a fifth embodiment of the present application. As shown in fig. 8, the electronic device 500 provided in this embodiment includes: a transmitter 501, a receiver 502, a memory 503, and an image processor 504.
A transmitter 501 for transmitting instructions and data;
a receiver 502 for receiving instructions and data;
a memory 503 for storing computer-executable instructions;
an image processor (Graphics Processing Unit, GPU) for executing computer-executable instructions stored in the memory to implement the steps executed by the obstacle data processing method in the above embodiment. Reference may be made in particular to the description of the embodiments of the obstacle data processing method described above.
Alternatively, the memory 503 may be separate or integrated with the processor 504.
When the memory 503 is provided separately, the electronic device further comprises a bus for connecting the memory 503 and the processor 504.
The embodiment of the application also provides a robot, which comprises:
a plurality of lidars for acquiring obstacle data;
and the image processor GPU is used for executing computer-executed instructions stored in the memory to realize the steps executed by the obstacle data processing method in the embodiment. Reference may be made in particular to the description of the embodiments of the obstacle data processing method described above.
The embodiment of the application also provides a computer readable storage medium, wherein computer execution instructions are stored in the computer readable storage medium, and when a processor executes the computer execution instructions, the obstacle data processing method executed by the electronic equipment is realized.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.