CN112527929A - Grid map coding method and device and electronic equipment - Google Patents

Grid map coding method and device and electronic equipment Download PDF

Info

Publication number
CN112527929A
CN112527929A CN202011128781.4A CN202011128781A CN112527929A CN 112527929 A CN112527929 A CN 112527929A CN 202011128781 A CN202011128781 A CN 202011128781A CN 112527929 A CN112527929 A CN 112527929A
Authority
CN
China
Prior art keywords
code
grid
mapping
grids
coding mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011128781.4A
Other languages
Chinese (zh)
Other versions
CN112527929B (en
Inventor
高立虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Silver Star Intelligent Technology Co Ltd
Original Assignee
Shenzhen Silver Star Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Silver Star Intelligent Technology Co Ltd filed Critical Shenzhen Silver Star Intelligent Technology Co Ltd
Priority to CN202011128781.4A priority Critical patent/CN112527929B/en
Publication of CN112527929A publication Critical patent/CN112527929A/en
Application granted granted Critical
Publication of CN112527929B publication Critical patent/CN112527929B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Remote Sensing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to the technical field of map coding, and discloses a grid map coding method and device and electronic equipment. The grid map coding method comprises the following steps: acquiring a grid map, wherein the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state; sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes; and according to a preset mapping relation, mapping each combined code into a corresponding code character in sequence to obtain a code file. Therefore, each encoding character can simultaneously express the grid states of a plurality of grids under the condition of consuming less storage capacity, the original information of the grid map is not lost, and less storage capacity is occupied, so that the file size of the grid map is reduced, the grid map is transmitted only by less bandwidth and network flow, and the updating efficiency of the grid map is improved.

Description

Grid map coding method and device and electronic equipment
Technical Field
The invention relates to the technical field of map coding, in particular to a grid map coding method and device and electronic equipment.
Background
The grid map is used as a way for the sweeping robot to represent an indoor map, and internal logics of indoor navigation, path planning, obstacle avoidance or area division and the like of the sweeping robot are completed by directly depending on the grid map, so that the sweeping robot needs to continuously transmit and update the grid map.
Generally, a grid map comprises a plurality of grids, the number of the grids depends on the size of an area, the larger the area is, the more the number of the grids is, the larger the storage capacity is required for storing the grid map, and the larger the bandwidth and the network flow are required for transmitting the grid map, which is not beneficial to a sweeping robot to update the grid map in real time and rapidly.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a grid map encoding method, a device thereof, and an electronic device, which are capable of reducing the file size of a grid map.
In a first aspect, an embodiment of the present invention provides a grid map encoding method, including:
acquiring a grid map, wherein the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state;
sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes;
and according to a preset mapping relation, mapping each combined code into a corresponding code character in sequence to obtain a code file.
Optionally, the combination codes are expressed by an M-ary system, and sequentially mapping each combination code into a corresponding code character according to a preset mapping relationship includes:
sequentially converting each M-system combination code into a corresponding N-system conversion code;
and mapping each N-system conversion code into a corresponding code character in sequence according to a preset mapping relation.
Optionally, the mapping each combined code into a corresponding code character according to the preset mapping relationship further includes:
and when detecting that the number of the grids forming the current combined code is less than K, filling new grids to the current combined code according to a preset coding mode until the number of the filled grids of the current combined code is equal to K, and filling preset grid values into each new grid.
Optionally, the combined code consists of the grid values of 4 adjacent grids.
Optionally, the preset encoding mode is a horizontal encoding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that the width of the grid map is not divided by 4:
when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
Optionally, the preset encoding mode is a vertical encoding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that the height of the grid map is not divided by 4:
when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
Optionally, the preset encoding mode is a square encoding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that neither the height nor the width of the grid map is evenly divided by 2:
when the current combined code lacks two grids in the row direction, filling 2 new grids in the row direction of the current combined code according to a preset coding mode; when the current combined code lacks two grids in the column direction, filling 2 new grids in the column direction of the current combined code according to a preset coding mode; and when the current combined code lacks three grids in the row and column directions in total, filling 3 new grids in the row and column directions for the current combined code according to a preset coding mode.
Optionally, the number of types of the grid states is equal to M, the M types of grid states include an obstacle-free state, an obstacle-present state, and an unknown state, and the preset grid value is equal to the grid value of the unknown state.
Optionally, the preset mapping relationship includes a corresponding relationship between each mapping code and each encoding character in a mapping range, the mapping range is defined by a start point mapping code and an end point mapping code, and sequentially mapping each N-ary conversion code into the corresponding encoding character according to the preset mapping relationship includes:
adding each N-system conversion code and the starting point mapping code in sequence to obtain a plurality of target mapping codes;
and searching the code character corresponding to each target mapping code according to the preset mapping relation.
Optionally, the combined code is composed of grid values of K adjacent grids, and the number of mapping codes in the mapping range is K times of M.
Optionally, the encoded characters are ASCII codes.
Optionally, the mapping range is 0x2e-0x7 e.
Optionally, the preset encoding mode includes a horizontal encoding mode, a vertical encoding mode or a square encoding mode, and the obtaining of the plurality of combined codes by sequentially combining at least two adjacent grid values according to the preset encoding mode includes:
when the grid map is detected to be smaller than the height, sequentially combining at least two adjacent grid values according to the horizontal coding mode to obtain a plurality of combined codes;
and when the grid map is detected to be smaller than the grid map in height and width, sequentially combining at least two adjacent grid values according to the vertical coding mode to obtain a plurality of combined codes.
Optionally, each of the trellis may have M trellis states, the combined code may be composed of K adjacent trellis values, and the number of code characters is at least K times M, where M and N are integers greater than or equal to 2.
Optionally, M is 3, the 3 grid states include an obstacle-free state, an obstacle-present state, and an unknown state, and grid values corresponding to the 3 grid states are 0, 1, and 2.
In a second aspect, an embodiment of the present invention provides a grid map encoding apparatus, including:
the map acquisition module is used for acquiring a grid map, the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state;
the grid combination module is used for sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes;
and the code mapping module is used for sequentially mapping each combined code into corresponding code characters according to a preset mapping relation to obtain a code file.
In a third aspect, a non-transitory readable storage medium stores computer-executable instructions for causing an electronic device to perform any of the grid map encoding methods.
In a fourth aspect, the present invention provides a computer program product comprising a computer program stored on a non-volatile computer-readable storage medium, the computer program comprising program instructions that, when executed by an electronic device, cause the electronic device to perform the above grid map encoding method.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the grid map encoding method.
Compared with the prior art, the invention at least has the following beneficial effects: in the grid map encoding method provided by the embodiment of the invention, firstly, a grid map is obtained, the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state. And secondly, combining at least two adjacent grid values in sequence according to a preset coding mode to obtain a plurality of combined codes. And finally, according to a preset mapping relation, mapping each combined code into corresponding code characters in sequence to obtain a code file. Therefore, each encoding character can simultaneously express the grid states of a plurality of grids under the condition of consuming less storage capacity, the original information of the grid map is not lost, and less storage capacity is occupied, so that the file size of the grid map is reduced, the grid map is transmitted only by less bandwidth and network flow, and the updating efficiency of the grid map is improved.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
Fig. 1 is a schematic structural diagram of a robot according to an embodiment of the present invention;
fig. 2 is a schematic diagram of communication between a robot and an external terminal according to an embodiment of the present invention;
fig. 3a is a schematic flowchart of a grid map encoding method according to an embodiment of the present invention;
fig. 3b is a schematic diagram of combining 4 adjacent grid values by using a square encoding method, a horizontal encoding method and a vertical encoding method respectively according to an embodiment of the present invention;
fig. 4 is a grid map provided in an embodiment of the present invention, the grid map being not subjected to ASCII code conversion;
FIG. 5 is a map after ASCII code conversion on the grid map shown in FIG. 4;
FIG. 6a is a schematic flow chart of step S33 shown in FIG. 3 a;
FIG. 6b is a schematic flowchart of step S332 shown in FIG. 6 a;
FIG. 6c is another schematic flow chart of step 33 shown in FIG. 3 a;
fig. 7a is an encoded file encoded by using a horizontal encoding method according to an embodiment of the present invention;
FIG. 7b is a compressed file after compression on the encoded file shown in FIG. 7 a;
fig. 8 is a schematic structural diagram of a grid map encoding device according to an embodiment of the present invention;
fig. 9 is a schematic circuit structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, if not conflicted, the various features of the embodiments of the invention may be combined with each other within the scope of protection of the invention. Additionally, while functional block divisions are performed in apparatus schematics, with logical sequences shown in flowcharts, in some cases, steps shown or described may be performed in sequences other than block divisions in apparatus or flowcharts. The terms "first", "second", "third", and the like used in the present invention do not limit data and execution order, but distinguish the same items or similar items having substantially the same function and action.
The grid map coding method of the embodiment of the invention can be executed in any suitable type of electronic equipment with a processor with computing capability, such as a desktop computer, a smart phone, a tablet computer or a robot. The robot of the embodiment of the present invention may be configured in any suitable shape to implement a specific service function operation, for example, the robot of the embodiment of the present invention may be a cleaning robot, a pet robot, a handling robot, a nursing robot, and the like. The cleaning robot includes, but is not limited to, a sweeping robot, a dust collecting robot, a mopping robot, or a floor washing robot.
The grid map coding device of the embodiment of the invention can be used as one of software or hardware functional units and independently arranged in the electronic equipment, and also can be used as one of functional modules integrated in a processor to execute the grid map coding method of the embodiment of the invention.
Referring to fig. 1, in some embodiments, a robot 100 includes a control unit 11, a sensing unit 12, a wireless communication unit 13, a cleaning unit 14, and a driving unit 15.
The control unit 11 serves as a control core of the robot 100, and may employ various path planning algorithms to control the robot to perform traversal work.
In some embodiments, the control unit 11 employs SLAM (simultaneous localization and mapping) technology to construct maps and locations from environmental data. The control unit 11 instructs the robot to completely traverse an environmental space by means of a full coverage path planning algorithm based on the established map and the position of the robot.
In some embodiments, during the traversal of the robot 100, the sensing unit 12 obtains environment data of a traversal area, wherein the environment data of the traversal area may be image data or radar point cloud data of the entire traversal area, or image data or radar point cloud data of a local traversal area in the entire traversal area. The control unit 11 generates a map indicating an area that the robot 100 needs to traverse and a coordinate position where an obstacle located in the traversal area is located, from the environmental data of the traversal area. In other embodiments, the robot 100 may also perform positioning and map creation by a gyroscope.
After each location or area traversed by the robot 100, the robot 100 marks that the location or area has been traversed based on the map. In addition, as the obstacle is marked in a coordinate mode in the map, when the robot passes, the distance between the robot and the obstacle can be judged according to the coordinate point corresponding to the current position and the coordinate point related to the obstacle, and therefore the robot can pass around the obstacle. Similarly, after the position or the area is marked by traversal, when the next position of the robot 100 moves to the position or the area, the robot 100 makes a turn around or stop traversal strategy based on the map and the mark of the position or the area.
In some embodiments, the control unit 11 may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a single chip, an arm (acorn RISC machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Also, the control unit 11 may be any conventional processor, controller, microcontroller, or state machine. The control unit 11 may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The sensing unit 12 is configured to collect some motion parameters of the robot 100 and various types of data in an environmental space, and the sensing unit 12 includes various types of suitable sensors, such as one or more combinations of an Inertial Measurement Unit (IMU), a gyroscope, a magnetic field meter, an accelerometer or a speedometer, a laser radar, or a sonic radar.
Referring to fig. 2, in some embodiments, the robot 100 wirelessly communicates with an external terminal 200 through a wireless communication unit 13, and the wireless communication unit 13 is electrically connected with the control unit 11. During the traversal, the user sends a control instruction to the robot 100 through the external terminal 200, the wireless communication unit 13 receives the control instruction and sends the control instruction to the control unit 11, and the control unit 11 controls the robot 100 to complete the traversal work according to the control instruction. In some embodiments, the external terminal 200 includes, but is not limited to, a smartphone, a remote control, a smart tablet, and the like terminal.
In some embodiments, the wireless communication unit 13 includes a combination of one or more of a broadcast receiving module, a mobile communication module, a wireless internet module, a short-range communication module, and a location information module.
The cleaning unit 14 is used for cleaning the floor, and the cleaning unit 14 may be configured in any cleaning structure, for example, in some embodiments, the cleaning unit 14 includes a cleaning motor and a roller brush, the surface of the roller brush is provided with a cleaning portion, the roller brush is connected with the cleaning motor through a driving mechanism, the cleaning motor is connected with a control unit, and the control unit may send an instruction to the cleaning motor to control the cleaning motor to drive the roller brush to rotate, so that the cleaning portion thereof can effectively clean the floor.
The driving unit 15 is used for driving the robot 100 to move forward or backward, when cleaning, the control unit 11 sends a control instruction to the driving unit 15, and the driving unit 15 drives the cleaning unit 14 to complete cleaning according to the control instruction.
In some embodiments, the drive unit 15 includes a left wheel drive unit and a right wheel drive unit. Taking a left wheel driving unit as an example, the left wheel driving unit comprises a motor, a wheel driving mechanism and a left wheel, wherein a rotating shaft of the motor is connected with the wheel driving mechanism, the left wheel is connected with the wheel driving mechanism, the motor is connected with a control unit, the motor receives a control instruction sent by the control unit 11 to rotate the rotating shaft of the motor, and torque is transmitted to the left wheel through the wheel driving mechanism to realize rotation of the left wheel; and at the same time, a right driving unit is combined, thereby driving the robot 100 to travel or retreat.
The embodiment of the invention provides a grid map coding method. Referring to fig. 3a, the grid map encoding method S300 includes:
s31, acquiring a grid map, wherein the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state;
in the present embodiment, the grid map is generated from an environment image of the target area, for example, the robot controls the camera to capture the target area to obtain the environment image, and the grid map is generated based on the environment image, and the area of the target area is different and the size of the grid map is also different.
Each grid map is composed of a plurality of grids, and because the environment of the target area is complex, in order to express the characteristics of each local area in the target area, each grid can be configured with a corresponding grid state according to the condition of each object in the image.
The grid state is used to represent the condition of the pixel point in the image, and since the pixel point may belong to a pixel of a detected obstacle, a pixel of a detected obstacle-free state, or a pixel of a state not known yet, the grid state includes an obstacle-free state, an obstacle-present state, and an unknown state, and accordingly, each grid state may be represented in a quantized manner, for example, the grid value of the grid is 0, which represents the obstacle-free state. The grid value is 1, which indicates an obstacle state. The grid value is 2, which represents the unknown state. It is understood that one skilled in the art can define the grid states of the grid and configure any suitable grid value for each grid state according to the business rule, for example, the grid value is 3, which represents a low obstacle state.
S32, combining at least two adjacent grid values in sequence according to a preset coding mode to obtain a plurality of combined codes;
in this embodiment, any suitable encoding method may be selected as the preset encoding method. In some embodiments, the preset encoding mode includes a horizontal encoding mode, a vertical encoding mode or a square encoding mode, and herein, the preset encoding mode is defined as: in the horizontal coding mode, the leftmost column is the most significant bit MSB and the rightmost column is the least significant bit LSB. In the vertical coding mode, the most significant bit MSB is the most significant bit, and the least significant bit LSB is the least significant bit. In the square coding mode, the most upper row of the leftmost column is the most significant bit MSB, and the most lower row of the rightmost column is the least significant bit LSB.
In the horizontal encoding mode, each combined code is composed of N adjacent grid values in the same line of the grid map. In the vertical coding mode, each combined code is composed of N adjacent grid values in the same column of the grid map. In the square encoding mode, each combined code consists of grid map composed of N continuous rows and N continuous columns of grid values, wherein N is a positive integer greater than or equal to 2. In the present embodiment, N is 2, and in the present embodiment, N may be 3, 4, 5, or the like, and may be provided as needed. By adopting any one of the above coding modes, the grids in the grid map can be sequentially converted into a plurality of combined codes.
Referring to fig. 3b, each combination code G is composed of 4 adjacent trellis values. When the square coding mode is adopted, 2 grid values are taken as step lengths in each row of the grid map, and meanwhile, the 2 grid values are taken as step lengths in the corresponding column for combination to obtain a combined code G of {0,2,2,1 }. When the horizontal coding mode is adopted, 4 adjacent grid values are combined in each line of the grid map to obtain a combined code G of {0,2,2,1 }. When the vertical coding mode is adopted, 4 adjacent grid values are combined in each column of the grid map to obtain a combined code G of {0,2,2,1 }. It is understood that, in the above-mentioned respective encoding modes, the MSB and LSB may be self-defined by the user according to the business rules, and are not limited to those provided above, for example, in the horizontal encoding mode, the leftmost column is the least significant bit LSB, and the rightmost column is the most significant bit MSB. In the vertical coding mode, the most significant bit LSB is the highest row, and the most significant bit MSB is the lowest row. In the square coding mode, the most upper row of the leftmost column is the least significant bit LSB, and the most lower row of the rightmost column is the most significant bit MSB.
In this embodiment, the robot may combine two adjacent grid values, or may combine 3 adjacent grid values, 4 adjacent grid values … … P adjacent grid values. The robot may obtain a combination code by combining at least two adjacent grid values of each group, and then sequentially combine at least two adjacent grid values of the next group, for example, in row 1, the grid values of grid 1 to grid 12 are 001201120221, respectively. The robot firstly combines '0012' according to a horizontal coding mode to obtain a combined code. Then, "0112" is combined to obtain another combined code. Then, the "0221" is combined again to obtain another combined code.
And S33, mapping each combined code into a corresponding code character according to a preset mapping relation to obtain a code file.
In this embodiment, the preset mapping relationship is defined by the user according to the business rule, and under the preset mapping relationship, each combined code has corresponding code characters, for example, the combined code "0012" corresponds to the hexadecimal code character "3", the combined code "0112" corresponds to the hexadecimal code character "<", and the combined code "0221" corresponds to the hexadecimal code character "G".
In this embodiment, the code characters in this text may be code characters under any suitable code protocol, or may also be code characters under a custom protocol, for example, the code characters in this text support an ASCII code protocol, and the code characters are ASCII codes, and as shown above, in the code characters, the combination code "0012" is in an ASCII code table, and corresponds to 0x33 in hexadecimal and the code character corresponding to "0 x 33" is "3". The combination code "0112" corresponds to hexadecimal 0x3C, and the code word corresponding to "0 x 3C" is "<". The combined code "0221" corresponds to a hexadecimal value of 0x47, and the code word corresponding to "0 x 47" is "G".
It is understood that the encoding characters herein may also support suitable encoding protocols such as GB2312, GBK, Unicode or Utf-8, where the conditions allow, and therefore, modifications made by those skilled in the art using encoding characters of any suitable encoding protocol should fall within the scope of the present invention.
In some embodiments, each code word occupies one byte of storage capacity, and may also occupy two or more bytes of storage capacity, if so desired.
In some embodiments, each trellis may have M trellis states, the combination code may be composed of K adjacent trellis values, and the number of code words is at least K times M, where M and N are integers greater than or equal to 2, e.g., M is 3 and K is 4, the number of code words is 81. It is understood that, in order to make each combination code have corresponding code characters, considering that the number of the lattices in the combination code is also flexible and variable, and the type of the lattice state is also flexible and variable, therefore, in the design, a person skilled in the art may find a suitable code protocol or may define a corresponding number of code characters by himself according to the condition that "the number of the code characters is at least K times of M", for example, in the embodiment, the code characters are ASCII codes, the type of the lattice state is 3, and the number of the lattices in the combination code is 4, and a total of 81 code characters are required, however, the ASCII table may satisfy such a requirement, and therefore, an ASCII code protocol may be selected to map the code characters.
After the robot obtains each code character, the robot can write each code character into a file to obtain a code file. Referring to fig. 4 and fig. 5, fig. 4 is a grid map provided in an embodiment of the present invention, wherein the grid map is not subjected to ASCII code conversion. Fig. 5 is a map obtained by ASCII code conversion on the grid map shown in fig. 4. As can be seen from fig. 5, after transcoding, the file size of the grid map is greatly reduced, and the width and height of the grid map are both reduced.
Therefore, in this embodiment, the method makes full use of the information expression capability of each byte, each encoding character can simultaneously express the grid states of multiple grids while consuming less storage capacity, the original information of the grid map is not lost, less storage capacity is occupied, the information redundancy rate is reduced, the file size of the grid map is reduced, the grid map is transmitted with less bandwidth and network traffic, and the update efficiency of the grid map is improved.
In some embodiments, each trellis may have M trellis states and the combined code may be represented in M-ary, e.g., each trellis has 3 trellis states and the combined code may be represented in 3-ary. For another example, each trellis has 4 trellis states, the combined code can be represented in 4, and M is an integer greater than or equal to 2.
In some embodiments, the combination code can be represented by various types of binary systems, the combination code can be represented by the same or different types of binary systems, and when the combination code is represented by different types of binary systems, the robot can convert the combination code into a representation corresponding to the combination code, so that, in some embodiments, the combination code is represented by an M-ary system, please refer to fig. 6a, where step S33 includes:
s331, sequentially converting each M-system combined code into a corresponding N-system conversion code;
s332, according to the preset mapping relation, sequentially mapping each N-system conversion code into a corresponding code character.
It is understood that M is an integer greater than or equal to 2, N is an integer greater than or equal to 2, and N is greater than M.
For example, when M is 3 and N is 16, the robot converts each 3-ary combination code into a corresponding 16-ary translation code, or when M is 4 and N is 16, the robot converts each 4-ary combination code into a corresponding 16-ary translation code, or when M is 4 and N is 8, the robot converts each 4-ary combination code into a corresponding 8-ary translation code. The robot maps each 16-system conversion code into a corresponding code character in sequence according to a preset mapping relation, and the code character can be represented by a 16-system. It is understood that the system of the code word may be an N system, or may be other systems.
In some embodiments, the predetermined mapping relationship includes a mapping relationship between each code and each code character in a mapping range, the mapping range is defined by a start point mapping code and an end point mapping code, for example, the code characters are ASCII codes, the mapping range is 0x2e-0x7e, where 0x2e is the start point mapping code and 0x7e is the end point mapping code, and each mapping code corresponds to one code character in the mapping range. Therefore, in some embodiments, referring to fig. 6b, step S332 includes:
s3321, adding each N-ary conversion code and the starting point mapping code in sequence to obtain a plurality of target mapping codes;
s3322, searching for the code character corresponding to each target mapping code according to the preset mapping relation.
For example, the ternary combination code is 0000, converted into hexadecimal conversion code 0x00, and then 0x00+0x2e is 0x2e, and "0 x2 e" is the target mapping code, which corresponds to the code word "".
The ternary combination code is 0201, converted to hexadecimal conversion code 0x13, and then 0x13+0x2e is equal to 0x41, and "0 x 41" is the target mapping code, which corresponds to the code character "a".
The ternary combination code is 1101, converted into hexadecimal conversion code 0x25, and then 0x25+0x2e is 0x53, and "0 x 53" is the target mapping code, which corresponds to the code character "S".
The ternary combination code is 1220, converted into hexadecimal conversion code 0x33, and then 0x33+0x2e is 0x61, and "0 x 61" is the target mapping code, which corresponds to the code word "a".
The ternary combination code is 2222, converted into hexadecimal conversion code 0x50, and then 0x50+0x2e is 0x7e, and "0 x7 e" is the target mapping code, which corresponds to the code characters "-".
In some embodiments, the combined code consists of the lattice values of K adjacent lattices, e.g., K is 3 or 4 or 5 or 6, etc. In order to map all the combined codes, the number of mapping codes in the mapping range is K times of M, for example, K equals 4, M equals 3, and the number of mapping codes in the mapping range is 81.
Generally, considering that the number of line grids or the number of column grids of the grid map is not necessarily able to completely divide K, that is, the finally combined code does not necessarily contain K adjacent grid values, in order to reliably ensure that the operation of the combined code operates without dead angles and ensure that the grid map information is conveyed without distortion, in some embodiments, the combined code is composed of K adjacent grid values, please refer to fig. 6c, step S33 further includes step S333, in step S333, when it is detected that the number of grids constituting the current combined code is less than K, the robot complements the new grid to the current combined code according to the preset coding mode until the number of grids of the complemented current combined code is equal to K, and each new grid is complemented with the preset grid value. Wherein the preset grid value is equal to the grid value of the unknown state, for example, the preset grid value is 2.
When the preset coding mode is a horizontal coding mode and the number of the grids forming the current combined code is detected to be less than K, and when a new grid is supplemented to the current combined code according to the preset coding mode, on the premise that the width of the grid map is not divided by 4, the method comprises the following steps: when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
For example, the 1 st row grid values are 001202102120210, respectively. When the robot is combined to '210', and the number of the grids of the current combined code is detected to be less than 4, and the remainder is 3, according to the horizontal coding mode, the '2' is supplemented after the '0' in the '210', and the supplemented current combined code '2102' is obtained.
For example, the 1 st row grid values are 00120210212021, respectively. When the robot is combined to 21, and the number of the grids of the current combined code is detected to be less than 4 and the remainder is 2, according to the horizontal coding mode, 22 is supplemented after 1 in 21, and the supplemented current combined code 2122 is obtained.
For example, the 1 st row grid values are 0012021021202, respectively. When the robot is combined to be 2, and the number of the grids of the current combined code is detected to be less than 4, and the remainder is 1, the robot supplements 222 after 2 according to the horizontal coding mode, and obtains the supplemented current combined code 2222.
When the preset coding mode is a vertical coding mode and the number of the grids forming the current combined code is detected to be less than K, and when a new grid is supplemented to the current combined code according to the preset coding mode, under the premise that the height of the grid map is not divided by 4 in an integer way: when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode. For example, the 1 st column grid values are 001202102120210 respectively. When the robot is combined to '210', and the number of the grids of the current combined code is detected to be less than 4, and the remainder is 3, according to the horizontal coding mode, the '2' is supplemented after the '0' in the '210', and the supplemented current combined code '2102' is obtained. For example, the 1 st column grid values are 00120210212021 respectively. When the robot is combined to 21, and the number of the grids of the current combined code is detected to be less than 4 and the remainder is 2, according to the horizontal coding mode, 22 is supplemented after 1 in 21, and the supplemented current combined code 2122 is obtained. For example, the 1 st column grid values are 0012021021202 respectively. When the robot is combined to be 2, and the number of the grids of the current combined code is detected to be less than 4, and the remainder is 1, the robot supplements 222 after 2 according to the horizontal coding mode, and obtains the supplemented current combined code 2222.
And a horizontal coding mode or a vertical coding mode is adopted, and the method is ready for compressing the encoded file into a smaller file when the encoded file is continuously compressed at a later stage.
When the preset coding mode is a square coding mode and the number of the grids forming the current combined code is detected to be less than K, and when a new grid is supplemented to the current combined code according to the preset coding mode, on the premise that the height and the width of the grid map are not divided by 2, the method comprises the following steps: when the current combined code lacks two grids in the row direction, filling 2 new grids in the row direction of the current combined code according to a preset coding mode; when the current combined code lacks two grids in the column direction, filling 2 new grids in the column direction of the current combined code according to a preset coding mode; and when the current combined code lacks three grids in the row and column directions in total, filling 3 new grids in the row and column directions to the current combined code according to a preset coding mode.
For example, when the robot detects that the current combined code is {, 2,1}, i.e., two grids are missing in the row direction, the robot obtains the filled current combined code "2221" at the blank "2" in a square coding manner.
For example, when the robot detects that the current combination code is {1, 2 }, i.e., two grids are missing in the column direction, the robot gets the filled current combination code "1222" in a square coding manner at blank "2".
For example, when the robot detects that the current combination code is { 1', }, i.e., three grids are missing in the row and column directions in total, the robot obtains the filled current combination code "1222" at blank "2" in a square coding manner. Or, when the robot detects that the current combination code is {, 0, }, that is, three grids are absent in the row and column directions in total, the robot obtains the filled current combination code "2202" at the blank "2" according to the square coding method.
The width and the height of the coded file obtained by adopting the square coding mode are reduced in an equal proportion relative to the original grid map, so that the original appearance of the grid map can be visually expressed, and the coded file has wide application prospect in other business logics such as contour feature extraction and the like in the later period.
Generally, after the grid map is encoded into a smaller encoded file, in order to obtain the smaller file again and reduce the bandwidth consumption of network resources, the compression operation is continued to be performed on the generated encoded file at a later stage, which will be referred to as the compression operation hereinafter.
In some embodiments, in order to obtain a smaller file for the convenience of the post-compression operation, when the encoded file is generated and when it is detected that the width of the raster map is smaller than the height, at least two adjacent raster values are sequentially combined according to a horizontal encoding mode to obtain a plurality of combined codes. When the height of the grid map is smaller than the width, at least two adjacent grid values are combined in sequence according to a vertical coding mode to obtain a plurality of combined codes.
For example, the width w of the grid map is 100, the height h is 400, the method selects a horizontal encoding mode to sequentially combine 4 adjacent grid values, and the width w1 of the encoded file is 25, and the height h1 of the encoded file is 400. If the vertical encoding mode is selected in the grid map, the width w2 of the encoded file is 100, and the height h2 of the encoded file is 100, however, since the subsequent compression operation can compress the encoded characters which continuously appear, the encoded file with the size reduces the occurrence frequency of the continuous encoded characters, which is not beneficial to compressing the encoded file to a greater extent.
After the encoded file is obtained, the robot may further compress the encoded file. In some embodiments, first, the robot acquires a code file, which includes a number of code characters. Secondly, the robot searches the code characters of each column/line in the code file line by line/line according to the search direction, for example, the robot searches the code characters of each column in the code file line by line according to the line search direction until the last line of code characters is searched. Or the robot searches the code characters of each row in the code file column by column according to the column searching direction until the last column of code characters is searched.
And finally, when the specified code character is searched for the first time, the robot judges whether the continuous occurrence frequency of the specified code character meets the compression condition, if so, the specified code character which continuously appears is compressed, and the compressed file is obtained. If not, reserving the specified code characters in the compressed file, and returning to the step of searching the code characters of each column/row in the code file row by row/column according to the searching direction.
In some embodiments, when the specified code character is first searched, the robot starts to record the continuous occurrence number of the specified code character and judges whether the continuous occurrence number is greater than or equal to a preset number threshold. In some embodiments, when the number of consecutive occurrences of the specified code character is greater than or equal to a preset number threshold, the number of consecutive occurrences of the specified code character satisfies the compression condition, and when the number of consecutive occurrences of the specified code character is less than the preset number threshold, the number of consecutive occurrences of the specified code character does not satisfy the compression condition. It can be understood that the preset time threshold is defined by the user according to the service requirement.
Generally, since the number of the grid states is small, for example, the number of the grid states is 3, and for the indoor space, the grid state is not an obstacle-free state, but is an obstacle state or an unknown state, the number of the change states is small, and the obstacle in the indoor space is relatively fixed, therefore, in the code file, some code characters appear in the code file more frequently than other code characters, therefore, the inventor selects several code characters as the designated code characters according to engineering experience, wherein the designated code characters belong to high-frequency characters in the code file, for example, when the code characters are ASCII codes, in the code file, the 5 code characters such as "- (wavy line)," (decimal point), H, v, | (vertical line) "have the highest probability of occurrence, and therefore, the 5 code characters can be selected as the specified code character herein.
In this embodiment, in order to effectively compress the specified code characters that appear consecutively, and considering that there is more than one kind of the specified code characters, before compression, a mapping relationship between each specified code character and each flag character needs to be established, and a flag character is used to refer to a certain specified code character that appears consecutively in the compressed file, as shown in table 1:
TABLE 1
Figure BDA0002734417360000171
As can be seen from table 1, the predetermined number threshold is 3.
In general, the first target marker character is selected when the number of consecutive occurrences of the specified encoding character does not exceed an encoding quantity threshold that can be represented by one byte. The second target marker character is selected when the number of consecutive occurrences of the specified encoding exceeds the encoding number threshold. For example, in this embodiment, the threshold of the number of codes that can be represented by one byte is 81, and if the threshold exceeds 81, the current byte overflows and the number of consecutive occurrences cannot be accurately recorded, so that one more byte needs to be left for storage. As can be seen from Table 1, when the number of consecutive occurrences of the designated code character "is greater than or equal to 3 but less than 81, the selection of"! "as the first marker character. When the number of consecutive occurrences of the designated code character "" is greater than 81, then "" is selected as the second marker character, and so on.
In some embodiments, when the robot compresses the specified encoded characters that occur consecutively, the target marker character corresponding to the specified encoded character is first written to the first storage location where the specified encoded character occurs first. And secondly, converting the continuous occurrence times into times code characters according to a preset mapping relation, and writing the times code characters into a target storage position adjacent to the primary storage position.
For example: the first line of code character string is ' HVV- ' - ' where ' the continuous occurrence number of ' - ' is 16, so that when the line of code character is compressed, it writes into ' | in the first storage position where the first occurrence of the appointed code character ' - ' is first! "code characters are written in the target storage location adjacent to the first storage location by the number of times corresponding to 16, and since hexadecimal number of 16 is Ox10, Ox10+0x2e is 0x3E, and" 0x3E "is a code character" > "in the ASCII code table, then" > "is written in the target storage location. In general, after compressing the first line of encoded strings, the "HVV! And > ".
In some embodiments, considering that the threshold of the number of codes that can be represented by one byte is 81, if the threshold exceeds 81, the current byte overflows and the number of consecutive occurrences cannot be accurately recorded, and therefore, the number of consecutive occurrences may be stored in bytes, for example, in some embodiments, the target storage location includes a first storage location adjacent to the first storage location and a second storage location adjacent to the first storage location, the robot determines whether the number of consecutive occurrences is greater than the threshold of the number of codes, if so, divides the number of consecutive occurrences by the threshold of the number of codes, takes a quotient and a remainder, maps the quotient into a first target code character and writes the first target code character into the first storage location, and maps the remainder into a second target code character and writes the second storage location into the preset mapping relationship.
For example: the 100 th line of the encoded string is "> VHV-, -V- | | | | | | | | | | | | | | | | | | | | | | | |", wherein, when the "-" is searched for the first time, the number of continuous occurrences of "-" is 5. When "|" is searched for the first time, the number of consecutive occurrences of "|" is 14. Thus, by compressing the line of code characters, it writes "! "and then write the code character of the number corresponding to 5 in the first storage location adjacent to the first storage location," 0x33 "is the code character" 3 "in the ASCII code table because the hexadecimal number of 5 is Ox05, Ox05+0x2e is 0x33," 0x33 "is the code character" 3 ", and thus," 3 "is written in the first storage location.
Next, it writes "(" in the first storage location where the specified code character "|" first appears (and then writes 14 the corresponding number of times of code characters in the second storage location adjacent to the first storage location), and since the hexadecimal number of 14 is Ox0e, Ox0e +0x2e is 0x3C, and "0 x 3C" is the code character "<" in the ASCII code table, then, "<" is written in the second storage location.
In general, after compressing the encoded string of line 100, "> VHV! 3V- (<').
In some embodiments, the corresponding encoding characters are selected as the marker characters in the range of 0x20-0x2d in the ASCII code, and the encoding range of the marker characters 0x20-0x2d is not overlapped with the encoding range of the generated encoding file 0x2e-0x7 e.
In general, considering that in two adjacent lines/columns, the last encoded characters of one line/column are still the same as the first encoded characters of another line/column, in order to also effectively compress the situation, in some embodiments, when the robot records the continuous occurrence number of the specified encoded characters, in the encoded characters of the target column, when the specified encoded characters continuously appear at the last line character position, the robot jumps to the unsearched column and continues to search line by line next to the adjacent target column, and records the continuous occurrence number of the specified encoded characters until the unselected encoded characters are searched, and stops recording.
For example, in the column-by-column search, the first column code string is "> VHV-" V- "and" | | | | | | | | | | | | | l | ", the second column code string is" | | | | | | | | VHV- "V-" and the robot detects that the specified code character "|" is continuous until the last bit when searching the first column code string, then the robot jumps to the second column to continue searching and records the continuous occurrence number of "|", the continuous occurrence number of the specified code character "|" "in the first column is 14, the continuous occurrence number of the specified code character" | "" in the second column is 9, the specified code character "|" appears 23 times in total, the hexadecimal of 23 is Ox17, Ox17+0x2 x 3632 is 0x45, and "0 x 45" is the code character "E" in the ASCII table.
In the same way, in the code characters of the target row, when the specified code characters continuously appear at the positions of the last row of characters, skipping to the next row which is not searched and is adjacent to the target row to continue searching row by row, recording the continuous appearance times of the specified code characters, and stopping recording until the non-specified code characters are searched.
Generally, in order to obtain smaller files by compression, the longest edge of the encoded file may be selected for compression so as to compress the designated encoded characters that appear continuously as much as possible. Therefore, in some embodiments, when the robot searches the code characters of each column/row in the code file row by row/column according to the search direction, the robot selects the vertical search direction to search the code characters of each row in the code file row by row when the width of the code file is smaller than the height. And when the width of the coded file is larger than the height, selecting a horizontal searching direction to search the coded characters of each column in the coded file column by column.
Referring to fig. 7a and fig. 7b together, fig. 7a is a coded file coded by using a horizontal coding method according to an embodiment of the present invention, and fig. 7b is a compressed file compressed on the coded file shown in fig. 7 a. The original grid map has a width of 223, high bits 184, and a total of 223 × 184 — 41032 bytes. After the encoding is performed by the horizontal encoding method, the width of the encoded file is 56, the height is 184, and the total width of 56 × 184 is 10304 bytes. After compression, the compressed file was 1869bytes total, with a compression ratio of 21.95 times.
Therefore, the compression method provided by the embodiment of the invention can further reduce the size of the encoded file, reduce the occupation of bandwidth network resources and improve the map updating and transmission efficiency.
It should be noted that, in the foregoing embodiments, a certain order does not necessarily exist between the foregoing steps, and those skilled in the art can understand, according to the description of the embodiments of the present invention, that in different embodiments, the foregoing steps may have different execution orders, that is, may be executed in parallel, may also be executed interchangeably, and the like.
In another aspect of the embodiments of the present invention, a grid map encoding device is provided. The grid map coding device may be a software module, where the software module includes a plurality of instructions, and the instructions are stored in a memory, and the processor may access the memory and call the instructions to execute the instructions, so as to complete the grid map coding method described in each of the above embodiments.
In some embodiments, the grid map coding device may also be built by hardware devices, for example, the grid map coding device may be built by one or more than two chips, and each chip may work in coordination with each other to complete the grid map coding method described in each of the above embodiments. For another example, the grid map encoding apparatus may also be constructed by various types of logic devices, such as a general processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a single chip, an arm (acorn RISC machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
Referring to fig. 8, the grid map encoding apparatus 800 includes a map obtaining module 81, a grid combination module 82, and an encoding and mapping module 83.
The map obtaining module 81 is configured to obtain a grid map, where the grid map includes a plurality of grids, and a grid value of each grid may represent a corresponding grid state; the grid combination module 82 is used for sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes; the code mapping module 83 is configured to sequentially map each combined code into a corresponding code character according to a preset mapping relationship, so as to obtain a code file.
Therefore, each encoding character can simultaneously express the grid states of a plurality of grids under the condition of consuming less storage capacity, the original information of the grid map is not lost, and less storage capacity is occupied, so that the file size of the grid map is reduced, the grid map is transmitted only by less bandwidth and network flow, and the updating efficiency of the grid map is improved.
In some embodiments, the trellis-combining module 82 is configured to sequentially convert each M-ary combined code into a corresponding N-ary converted code; and mapping each N-system conversion code into a corresponding code character in sequence according to a preset mapping relation.
In some embodiments, the combination code is composed of K adjacent grid values, and the grid combination module 82 is configured to, when it is detected that the number of grids constituting the current combination code is less than K, fill a new grid to the current combination code according to a preset coding mode until the number of filled grids of the current combination code is equal to K, and fill a preset grid value to each new grid.
In some embodiments, the combined code consists of the trellis values of 4 adjacent trellis.
In some embodiments, the preset encoding mode is a horizontal encoding mode; the grid combination module 82 is configured to, on the premise that the width of the grid map is not evenly divided by 4: when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
In some embodiments, the preset encoding mode is a vertical encoding mode; the grid combination module 82 is used for, on the premise that the height of the grid map is not divided by 4: when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
In some embodiments, the preset encoding mode is a square encoding mode; the grid combination module 82 is used for, on the premise that the height and the width of the grid map are not evenly divided by 2: when the current combined code lacks two grids in the row direction, filling 2 new grids in the row direction of the current combined code according to a preset coding mode; when the current combined code lacks two grids in the column direction, filling 2 new grids in the column direction of the current combined code according to a preset coding mode; and when the current combined code lacks three grids in the row and column directions in total, filling 3 new grids in the row and column directions for the current combined code according to a preset coding mode.
In some embodiments, the number of types of grid states is equal to M, the M types of grid states include an obstacle-free state, an obstacle-present state, and an unknown state, and the preset grid value is equal to the grid value of the unknown state.
In some embodiments, the preset mapping relationship includes a corresponding relationship between each mapping code and each code character in a mapping range, the mapping range is defined by a start mapping code and an end mapping code, and the code mapping module 83 is configured to add each N-ary conversion code to the start mapping code in sequence to obtain a plurality of target mapping codes; and searching the code character corresponding to each target mapping code according to the preset mapping relation.
In some embodiments, the combined code consists of the grid values of K adjacent grids, and the number of mapping codes in the mapping range is K times M.
In some embodiments, the encoded characters are ASCII codes.
In some embodiments, the mapping range is 0x2e-0x7 e.
In some embodiments, the preset encoding mode includes a horizontal encoding mode, a vertical encoding mode or a square encoding mode, and the grid combination module 82 is configured to, when it is detected that the width of the grid map is smaller than the height, sequentially combine at least two adjacent grid values according to the horizontal encoding mode to obtain a plurality of combined codes; and when the grid map is detected to be smaller than the grid map in height and width, sequentially combining at least two adjacent grid values according to the vertical coding mode to obtain a plurality of combined codes.
In some embodiments, each of the trellis may have M trellis states, the combined code may be composed of K adjacent trellis values, and the number of code characters is at least K times M, where M and N are integers greater than or equal to 2.
In some embodiments, M is 3, and the 3 grid states include an obstacle-free state, an obstacle-present state, and an unknown state, and the 3 grid states correspond to grid values of 0, 1, and 2.
The grid map coding device can execute the grid map coding method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in the embodiments of the grid map encoding device, reference may be made to the grid map encoding method provided in the embodiments of the present invention.
Referring to fig. 9, fig. 9 is a schematic circuit structure diagram of an electronic device according to an embodiment of the present invention, where the electronic device may be any suitable type of device or electronic product, for example, the electronic device includes a device or electronic product with logic calculation and analysis functions, such as a numerical control machine, a computer, or a mobile phone. As shown in fig. 9, the electronic device 900 includes one or more processors 91 and memory 92. In fig. 9, one processor 91 is taken as an example.
The processor 91 and the memory 92 may be connected by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The memory 92, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the grid map encoding method in the embodiments of the present invention. The processor 91 executes various functional applications and data processing of the tool state monitoring apparatus by running the nonvolatile software program, instructions and modules stored in the memory 92, that is, the functions of the grid map encoding method provided by the above method embodiment and the various modules or units of the above apparatus embodiment are realized.
The memory 92 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 92 may optionally include memory located remotely from the processor 91, and such remote memory may be connected to the processor 91 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The program instructions/modules are stored in the memory 92 and, when executed by the one or more processors 91, perform the grid map encoding method of any of the method embodiments described above.
Embodiments of the present invention also provide a non-transitory computer storage medium storing computer-executable instructions, which are executed by one or more processors, such as the processor 91 in fig. 9, to enable the one or more processors to perform the grid map encoding method in any of the above method embodiments.
Embodiments of the present invention also provide a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, the computer program including program instructions that, when executed by an electronic device, cause the electronic device to perform any one of the grid map encoding methods.
The above-described embodiments of the apparatus or device are merely illustrative, wherein the unit modules described as separate parts may or may not be physically separate, and the parts displayed as module units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions substantially or contributing to the related art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (17)

1. A grid map encoding method, comprising:
acquiring a grid map, wherein the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state;
sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes;
and according to a preset mapping relation, mapping each combined code into a corresponding code character in sequence to obtain a code file.
2. The method of claim 1, wherein the combined codes are represented by M-ary, and the sequentially mapping each combined code to a corresponding code word according to the predetermined mapping relationship comprises:
sequentially converting each M-system combination code into a corresponding N-system conversion code;
and mapping each N-system conversion code into a corresponding code character in sequence according to a preset mapping relation.
3. The method of claim 2, wherein the combined code consists of K adjacent trellis values, and the sequentially mapping each combined code to a corresponding code word according to the predetermined mapping relationship further comprises:
and when detecting that the number of the grids forming the current combined code is less than K, filling new grids to the current combined code according to a preset coding mode until the number of the filled grids of the current combined code is equal to K, and filling preset grid values into each new grid.
4. A method according to claim 3, characterized in that the combined code consists of the grid values of 4 adjacent grids.
5. The method of claim 4,
the preset coding mode is a horizontal coding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that the width of the grid map is not divided by 4:
when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
6. The method of claim 4,
the preset coding mode is a vertical coding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that the height of the grid map is not divided by 4:
when the remainder is 3, filling 1 new grid to the current combined code according to a preset coding mode; when the remainder is 2, filling 2 new grids to the current combined code according to a preset coding mode; and when the remainder is 1, filling 3 new grids to the current combined code according to a preset coding mode.
7. The method of claim 4,
the preset coding mode is a square coding mode;
when it is detected that the number of the grids forming the current combined code is less than K, filling a new grid to the current combined code according to a preset coding mode includes:
on the premise that neither the height nor the width of the grid map is evenly divided by 2:
when the current combined code lacks two grids in the row direction, filling 2 new grids in the row direction of the current combined code according to a preset coding mode; when the current combined code lacks two grids in the column direction, filling 2 new grids in the column direction of the current combined code according to a preset coding mode; and when the current combined code lacks three grids in the row and column directions in total, filling 3 new grids in the row and column directions for the current combined code according to a preset coding mode.
8. The method of claim 3, wherein the number of types of grid states is equal to M, the M types of grid states include an obstacle-free state, an obstacle-present state, and an unknown state, and the preset grid value is equal to the grid value of the unknown state.
9. The method according to any one of claims 2 to 8, wherein the predetermined mapping relationship comprises a mapping relationship between each N-ary transformation code and each code character in a mapping range, the mapping range is defined by a start point mapping code and an end point mapping code, and the sequentially mapping each N-ary transformation code to the corresponding code character according to the predetermined mapping relationship comprises:
adding each N-system conversion code and the starting point mapping code in sequence to obtain a plurality of target mapping codes;
and searching the code character corresponding to each target mapping code according to the preset mapping relation.
10. The method according to claim 9, wherein the combined code consists of the grid values of K adjacent grids, and the number of mapping codes in the mapping range is K times M.
11. The method of claim 9, wherein the encoded characters are ASCII codes.
12. The method of claim 9, wherein the mapping range is 0x2e-0x7 e.
13. The method according to any one of claims 1 to 8, wherein the predetermined coding scheme includes a horizontal coding scheme, a vertical coding scheme, or a square coding scheme, and the sequentially combining at least two adjacent grid values according to the predetermined coding scheme to obtain a plurality of combined codes includes:
when the grid map is detected to be smaller than the height, sequentially combining at least two adjacent grid values according to the horizontal coding mode to obtain a plurality of combined codes;
and when the grid map is detected to be smaller than the grid map in height and width, sequentially combining at least two adjacent grid values according to the vertical coding mode to obtain a plurality of combined codes.
14. The method according to any one of claims 1 to 8, wherein each of said trellis has M trellis states, said combined code consists of K adjacent trellis values, and said code word is at least K times M, where M and N are integers greater than or equal to 2.
15. The method of claim 14, wherein M is 3, 3 grid states including an obstacle-free state, an obstacle-present state, and an unknown state, and the 3 grid states have grid values of 0, 1, and 2.
16. A grid map encoding apparatus, comprising:
the map acquisition module is used for acquiring a grid map, the grid map comprises a plurality of grids, and the grid value of each grid can represent the corresponding grid state;
the grid combination module is used for sequentially combining at least two adjacent grid values according to a preset coding mode to obtain a plurality of combined codes;
and the code mapping module is used for sequentially mapping each combined code into corresponding code characters according to a preset mapping relation to obtain a code file.
17. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the grid map encoding method of any one of claims 1 to 15.
CN202011128781.4A 2020-10-20 2020-10-20 Grid map coding method and device and electronic equipment Active CN112527929B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011128781.4A CN112527929B (en) 2020-10-20 2020-10-20 Grid map coding method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011128781.4A CN112527929B (en) 2020-10-20 2020-10-20 Grid map coding method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112527929A true CN112527929A (en) 2021-03-19
CN112527929B CN112527929B (en) 2023-12-08

Family

ID=74980219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011128781.4A Active CN112527929B (en) 2020-10-20 2020-10-20 Grid map coding method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112527929B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113225090A (en) * 2021-05-19 2021-08-06 上海高仙自动化科技发展有限公司 Compression method, compression device, electronic equipment and storage medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008076027A1 (en) * 2006-12-21 2008-06-26 Telefonaktiebolaget Lm Ericsson (Publ) Method and arrangement for symbol mapping in communication systems utilizing ofdm-techniques
CN102841933A (en) * 2012-08-06 2012-12-26 北京地拓科技发展有限公司 Method and device for writing raster data and method for reading raster data
CN102867023A (en) * 2012-08-15 2013-01-09 北京地拓科技发展有限公司 Method for storing and reading grid data and device
CN105160624A (en) * 2015-08-20 2015-12-16 中电科海洋信息技术研究院有限公司 Geographic information picture automatic registration method and apparatus
CN105701479A (en) * 2016-02-26 2016-06-22 重庆邮电大学 Intelligent vehicle multi-laser radar fusion recognition method based on target features
CN107301194A (en) * 2016-10-09 2017-10-27 上海炬宏信息技术有限公司 The compression storage of tile type grating map and dissemination method
CN108829901A (en) * 2018-10-09 2018-11-16 上海岚豹智能科技有限公司 A kind of plane map data compression method and device
CN109725327A (en) * 2019-03-07 2019-05-07 山东大学 A kind of method and system of multimachine building map
CN109737974A (en) * 2018-12-14 2019-05-10 中国科学院深圳先进技术研究院 A kind of 3D navigational semantic map updating method, device and equipment
CN110019582A (en) * 2017-08-28 2019-07-16 中国科学院沈阳自动化研究所 Cognitive map construction method based on space and Motion-Joint coding
CN110532342A (en) * 2019-08-16 2019-12-03 南京王师大数据有限公司 Global space target area position coding method and device
CN110909093A (en) * 2019-10-11 2020-03-24 中国人民解放军战略支援部队信息工程大学 Method and device for constructing intelligent landmark control network
CN111221337A (en) * 2020-01-19 2020-06-02 弗徕威智能机器人科技(上海)有限公司 Construction method and system of robot grid map
CN111723108A (en) * 2020-05-28 2020-09-29 长安大学 Candidate road section selection method and system based on GeoHash coding

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008076027A1 (en) * 2006-12-21 2008-06-26 Telefonaktiebolaget Lm Ericsson (Publ) Method and arrangement for symbol mapping in communication systems utilizing ofdm-techniques
CN102841933A (en) * 2012-08-06 2012-12-26 北京地拓科技发展有限公司 Method and device for writing raster data and method for reading raster data
CN102867023A (en) * 2012-08-15 2013-01-09 北京地拓科技发展有限公司 Method for storing and reading grid data and device
CN105160624A (en) * 2015-08-20 2015-12-16 中电科海洋信息技术研究院有限公司 Geographic information picture automatic registration method and apparatus
CN105701479A (en) * 2016-02-26 2016-06-22 重庆邮电大学 Intelligent vehicle multi-laser radar fusion recognition method based on target features
CN107301194A (en) * 2016-10-09 2017-10-27 上海炬宏信息技术有限公司 The compression storage of tile type grating map and dissemination method
CN110019582A (en) * 2017-08-28 2019-07-16 中国科学院沈阳自动化研究所 Cognitive map construction method based on space and Motion-Joint coding
CN108829901A (en) * 2018-10-09 2018-11-16 上海岚豹智能科技有限公司 A kind of plane map data compression method and device
CN109737974A (en) * 2018-12-14 2019-05-10 中国科学院深圳先进技术研究院 A kind of 3D navigational semantic map updating method, device and equipment
CN109725327A (en) * 2019-03-07 2019-05-07 山东大学 A kind of method and system of multimachine building map
CN110532342A (en) * 2019-08-16 2019-12-03 南京王师大数据有限公司 Global space target area position coding method and device
CN110909093A (en) * 2019-10-11 2020-03-24 中国人民解放军战略支援部队信息工程大学 Method and device for constructing intelligent landmark control network
CN111221337A (en) * 2020-01-19 2020-06-02 弗徕威智能机器人科技(上海)有限公司 Construction method and system of robot grid map
CN111723108A (en) * 2020-05-28 2020-09-29 长安大学 Candidate road section selection method and system based on GeoHash coding

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113225090A (en) * 2021-05-19 2021-08-06 上海高仙自动化科技发展有限公司 Compression method, compression device, electronic equipment and storage medium
CN113225090B (en) * 2021-05-19 2024-03-22 上海高仙自动化科技发展有限公司 Compression method, compression device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112527929B (en) 2023-12-08

Similar Documents

Publication Publication Date Title
US20210029381A1 (en) Method and apparatus for obtaining global matched patch
CN112102411B (en) Visual positioning method and device based on semantic error image
US9928605B2 (en) Real-time cascaded object recognition
CN113473127B (en) Point cloud geometric coding method, point cloud geometric decoding method, point cloud geometric coding equipment and point cloud geometric decoding equipment
CN112601083A (en) Image data encoding and decoding methods and devices
US20080080778A1 (en) Image data compression method and apparatuses, image display method and apparatuses
US9384387B2 (en) Concept for encoding data defining coded positions representing a trajectory of an object
CN104380267A (en) Data compression/decompression device
CN110944187B (en) Point cloud encoding method and encoder
CN111192364A (en) Low-cost mobile multi-robot vision simultaneous positioning and map creating method
CN112515556B (en) Environment map processing method and device and electronic equipment
CN112527929B (en) Grid map coding method and device and electronic equipment
CN115529357B (en) Updating abnormity matching method based on MES intercommunication interconnection production data
CN112740702A (en) Point cloud encoding and decoding method and device
CN114356243A (en) Data processing method and device and server
US20170052963A1 (en) Systems and methods for memory architecture
CN107431809B (en) Image processing method and device
CN113784125A (en) Point cloud attribute prediction method and device
CN113225090A (en) Compression method, compression device, electronic equipment and storage medium
CN103152574A (en) Remote sensing image transmitting system with limited velocity based on feature registration
US11034020B2 (en) Systems and methods for enhanced review of automated robotic systems
CN110800301A (en) Control method and device of coding equipment and storage medium
CN113449058A (en) Map data transmission method, cleaning robot and storage medium
CN102821139A (en) Artificial influence weather assignment information interactive system based on intelligent terminal
CN115955296B (en) Unmanned inspection-based rail transit operation and maintenance data transmission method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518110 1701, building 2, Yinxing Zhijie, No. 1301-72, sightseeing Road, Xinlan community, Guanlan street, Longhua District, Shenzhen, Guangdong Province

Applicant after: Shenzhen Yinxing Intelligent Group Co.,Ltd.

Address before: 518110 Building A1, Yinxing Hi-tech Industrial Park, Guanlan Street Sightseeing Road, Longhua District, Shenzhen City, Guangdong Province

Applicant before: Shenzhen Silver Star Intelligent Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant