Time optimization method for mechanical actions of Rubik's cube robot with two-arm and two-finger structure
By scanning the appearance of the Rubik's Cube and using greedy algorithms to optimize the time of each restore path, the problem of least mechanical steps in the prior art does not equal the minimum time, and the Rubik's Cube restore effect that consumes the least time under different mechanical actions is achieved.
Patent Information
- Application Number
- CN202510319832.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-06-06
AI Technical Summary
The existing solution with the least mechanical steps of the two-arm two-finger Rubik's Cube robot is not necessarily the solution with the least time, which leads to inconsistent time under different mechanical actions.
By scanning the appearance of the Rubik's Cube, calculating the restore steps of the Rubik's Cube, and using greedy algorithms to optimize the time for each restore path, selecting the path with the shortest time to achieve rapid restoration of the Rubik's Cube.
Among various different mechanical solutions, relatively optimized solutions can be found at a lower cost of time, which are suitable for various Rubik's Cube robots, with controllable calculations and low cost.
Smart Images

Figure CN120095817A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of mechanical control, and in particular to a time optimization method for mechanical actions of a double-arm two-finger structured Rubik's Cube robot. Background Art
[0002] In the article "DFS-based Two-Finger Dual-Arm Rubik's Cube Robot" (first author: Cui Junwen) in the 2019 issue 24 of Computer Knowledge and Technology, a constrained depth-first mechanical step optimization algorithm is proposed. There are many such public DFS step optimization algorithm literatures. Their main advantage is that they can find the solution with the least mechanical steps under constrained conditions at a relatively low cost; but the disadvantage is that different two-arm two-finger Rubik's Cube robots have different driving mechanisms, driving capabilities, and mechanical loads, and the time consumed by each mechanical action is not the same. Therefore, the solution with the least mechanical steps is often not the solution with the least time. Summary of the invention
[0003] For various two-arm two-finger Rubik's Cube robots, under the premise that the speeds of their various basic movements have been determined, the present invention can find a more time-optimized solution among various mechanical solutions at a relatively small time cost.
[0004] The technical solution of the present invention is: a time optimization method for mechanical movements of a two-arm two-finger structure Rubik's Cube robot, wherein the two-arm two-finger structure Rubik's Cube robot in the method has two rotatable mechanical arms, each of which has two fingers that can be opened and closed, and the Rubik's Cube is clamped by the two fingers, and the Rubik's Cube is driven to rotate by rotating the mechanical arms; the two mechanical arms are vertically arranged at 90 degrees, clamping the middle position of two adjacent faces of the Rubik's Cube, and each mechanical arm can rotate; the two mechanical arms include 3 postures, posture 0 is the initial position, posture 1 is the right mechanical arm rotated 90 degrees based on the initial posture, and posture 2 is the left mechanical arm rotated 90 degrees based on the initial posture;
[0005] Define the six faces of the Rubik's Cube as U, D, R, L, F, and B; collect the opening and closing time of the robot fingers, the time required for the robot arm to rotate 90 degrees, the time required for the robot arm to rotate 90 degrees and 180 degrees with the help, and the time required for the robot arm to twist 90 degrees and 180 degrees. The "with the help" means to rotate the Rubik's Cube with the help, and the "twist" means to twist one face of the Rubik's Cube to rotate;
[0006] The steps of this method are:
[0007] Step 1: Scan the shape of the Rubik's Cube and calculate the steps to restore the Rubik's Cube. Each step is an operation on one face. List the order of operations for each face.
[0008] Step 2: Split the restoration steps of each Rubik's Cube into coaxial pairs of opposite faces. In the operation sequence of each face, if the operation steps of two opposite faces are adjacent, then swap the operation sequence of the two faces to achieve a split of the restoration steps. Split all coaxial pairs of opposite faces according to the above method to obtain all restoration paths.
[0009] Step 3: Calculate the time consumption of all restoration paths according to all the action times of the robot, and select the path with the shortest time;
[0010] Step 4: According to the selected path, set the opening and closing time of the robot arm, the time for the robot arm to idle, rotate, and twist 90 degrees and 180 degrees to restore the Rubik's Cube.
[0011] Furthermore, the method for calculating the time in step 3 is: using a greedy algorithm to find the optimal time for each restoration path, and the optimization constraints of the greedy algorithm include:
[0012] The two steps of coaxial and two manipulators facing each other cannot be optimized;
[0013] Can the two adjacent steps of the robot fingers remain motionless and only the robot arm rotates? If so, the robot arm rotates directly;
[0014] In the case where the robot arm cannot be rotated directly, if a certain robot arm is currently rotating, another robot arm in the subsequent step will be idle at the same time; if a certain robot arm is currently idling, another robot arm in the subsequent step will be rotated at the same time;
[0015] Complete the same preparatory movements before twisting. If you can rotate it freely, don't turn it; if you can rotate it 90 degrees, don't turn it 180 degrees.
[0016] Furthermore, the restoration path optimization method is that the robot optimizes once every two steps.
[0017] A1: The first step of each optimization search is to twist any one of the six faces of the Rubik's Cube, and the second step is to twist any one of the remaining five faces. The arrangement of the six faces of the Rubik's Cube is P 6 2 = 30. Considering the symmetry of the manipulator and the Rubik's Cube, the mathematical description of the optimization path is a mirror image relationship. In fact, 30 / 2 = 15 types need to be calculated.
[0018] A2: Considering that two manipulators cannot be optimally arranged adjacent to each other, and three coaxial manipulators cannot be optimally arranged opposite each other, there are only 15-1-3=11 variations that can be truly optimized.
[0019] A3: The possible rotation angles of each side of the comprehensive Rubik's Cube are 90 and 180. For each initial posture of the manipulator, there are 4*11=44 actual changes.
[0020] A4: Since the robot posture 1 and posture 2 are symmetrical, there are only 44*2=88 possible changes in the real optimization space;
[0021] A4: Based on the action time of the robot, calculate the time required for these 88 changes. The action that takes the least time is the optimal action. The robot performs the next two steps and then performs step A1 again.
[0022] Furthermore, when recording the operation steps of the robot arm, the operation process is defined in the following way:
[0023] U, D, R, L, F, and B represent a 90-degree clockwise rotation of the corresponding surface;
[0024] U2, D2, R2, L2, F2, and B2 represent a 180-degree rotation of the corresponding surface;
[0025] U', D', R', L', F', and B' represent a 90-degree counterclockwise rotation of the corresponding surface.
[0026] The present invention is based on the fact that the optimal mechanical steps are not necessarily the optimal time. It does not pursue the minimum steps for solving the Rubik's Cube, nor the minimum mechanical steps for each solution. Instead, it chooses to quickly generate multiple restoration solutions at one time, and optimizes the time of the mechanical steps for each restoration solution; finally, the time-optimal solution is selected from multiple optimized mechanical steps for restoration.
[0027] This solution has wide applicability and can be used by various Rubik's Cube robots; the calculation is controllable and low-cost, and several Rubik's Cube solutions can be selectively solved with relatively low time consumption; even for the Rubik's Cube of God's Number with only 20 steps to solve, it has good performance; before the Rubik's Cube is restored, the time to solve the Rubik's Cube can be accurately calculated. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is the initial position of the robot arm.
[0029] Figure 2 is the position of robot arm posture 1.
[0030] Figure 3 is the position of robot arm posture 2.
[0031] Figure 4 It is a schematic diagram of the definition of the spatial orientation corresponding to each face of the Rubik's Cube in a specific implementation manner.
[0032] Figure 5 The initial state of the Rubik's Cube is used as an example of the optimization method in the specific implementation method.
[0033] Figure 6 It is the original definition graph of each face in Kociemba two-stage algorithm.
[0034] Figure 7 This is the flow chart of the main process of optimization.
[0035] Figure 8 This is a two-step greedy algorithm flow framework diagram. DETAILED DESCRIPTION
[0036] Various acceleration and deceleration curves (FT curves) of the robot arm's rotation are stored in the FLASH chip in advance. If different curves are selected, the acceleration and deceleration of the robot arm will be different. Then, the time taken to rotate the same angle will be different.
[0037] The voltage-controlled multi-segment line for closing the manipulator is also stored in the FLASH chip and can be set manually; according to the inherent characteristics of the machine, the opening time of the manipulator is set in advance with a margin.
[0038] Once the mechanical steps for solving the Rubik's Cube are determined, the time for solving the Rubik's Cube is determined in advance, based on the selection and determination of the time for the mechanical arm rotation and the opening and closing of the mechanical hand. The expected time for solving multiple mechanical steps can be compared and the optimal one can be selected.
[0039] In this case, ordinary closed-loop stepper motors and ordinary electromagnets are used. The approximate time for each mechanical action is:
[0040]
[0041] Rubik's cube solving string:
[0042] Kociemba defines the six faces of the Rubik's Cube as U, D, R, L, F, and B respectively. See the Rubik's Cube definition diagram for each face and color block.
[0043] Rubik's cube solving string, used to express the steps to solve and restore a scrambled Rubik's cube, such as "U2 BU2 L2 DL'B'D'L'B2 D'B U D'F2 U'L2 U'F2 U F2", "U2" means the first step is to rotate the U side 180 degrees, "B" means the second step is to rotate the B side 90 degrees clockwise, and so on, "L'" means to rotate the L side 90 degrees counterclockwise, until the last step "F2" rotates the F side 180 degrees to complete the restoration. Note that when twisting a side, the other sides must remain stationary.
[0044] Taking the initial posture of placing the chaotic Rubik's Cube on the manipulator as the reference, the spatial orientation of the U surface is 4, the spatial orientation of the D surface is 5, the spatial orientation of the F surface is 0, the spatial orientation of the B surface is 1, the spatial orientation of the L surface is 2, and the spatial orientation of the R surface is 3; Figure 4 shown.
[0045] Obviously, the spatial orientation 0 and 3 are the orientations corresponding to the manipulator, and it is possible to twist directly. The other surfaces must be turned to 0 and 3 before they can be twisted.
[0046] The robot in the 0-position is defined as Lh (left robot), and the robot in the 3-position is defined as Rh (right robot).
[0047] For any scrambled Rubik's Cube, find A, B, C, D... kinds of restoration series, and optimize each sequence using a greedy algorithm every 2 steps.
[0048] For each 2-step optimization, there are 3 initial postures of the manipulator.
[0049] There are three possibilities for each step: 90 degrees forward, 90 degrees backward, and 180 degrees. Due to the symmetric coupling between the Rubik's Cube and the manipulator, although the directions of 90 degrees forward and 90 degrees backward are different, the mechanical step time consumption is the same, and it can be treated as a branch.
[0050] In each optimization step, the first step is to twist any of the six sides of the Rubik's Cube, and the second step is to twist any of the remaining five sides. In the two-step optimization, the arrangement of the six sides of the Rubik's Cube is Considering the symmetry of the Rubik's Cube, the mathematical description of the optimization path is a mirror relationship, which can actually be 30 / 2=15. Considering that the arrangement of the two manipulator faces cannot be optimized, and the three coaxial faces cannot be optimized, there are only 15-1-3=11 variations that can be optimized.
[0051] The possible rotation angles of each side of the comprehensive Rubik's Cube are 90 and 180. For each initial posture of the manipulator, there are 4*11=44 changes to be discussed. Since the manipulator posture 1 and posture 2 are symmetrical, there are only 44*2=88 possible changes that can be optimized. These 88 changes can be fully enumerated.
[0052] Under the optimization constraints described above, the changes are limited, and the 2-step time optimization or 3-step time optimization can be achieved directly by using table lookup or branch + conditional judgment statements.
[0053] Theoretically, when the number of basic steps of the greedy algorithm increases from 2 to 20 (the entire reduction step), the optimal solution will be obtained in time; the larger the number of basic steps, the closer the solution is to the optimal solution. However, the more basic steps there are, the greater the computational cost, which is not advisable for quickly solving the Rubik's Cube.
[0054] For the two-arm two-finger Rubik's Cube robot, there are only two manipulators that can twist the Rubik's Cube. Even if the basic number of steps is 4, the sides to be twisted still need to be "fed" to the two manipulators in sequence. The greedy algorithm with more than 3 or 4 basic steps has no significant benefit. Therefore, we only take 2 or 3 steps as the basic number of steps for discussion. A good balance is achieved between computing consumption and final benefits.
[0055] Implementation example of the optimization method:
[0056] Step 1: Use the two-stage Rubik's Cube solving algorithm to obtain at least one or more Rubik's Cube solving strings.
[0057] Example: For example Figure 5 Find 2 solutions to the scrambled Rubik's Cube
[0058] "F L2(U D2)L'(F'B')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0059] "L F2 D2(R'L2)D R'U2 R'B2 U B'L'U2 F(U2 D2)R2"
[0060] Step 2: In a Rubik's Cube string, if two sides of the Rubik's Cube appear adjacent to each other, such as U D' or F2 B or RL2, then the two sides can be twisted in the same order. If it appears once in the Rubik's Cube string, the string can be split into 2^1=2 strings; if it appears twice, it can be split into 2^2=4 strings; and so on, if it appears N times, it can be split into 2^N strings.
[0061] The above two strings can be split into a total of 8 strings
[0062] "F L2(U D2)L'(F'B')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0063] "F L2(D2 U)L'(F'B')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0064] "F L2(U D2)L'(B'F')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0065] "F L2(D2 U)L'(B'F')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0066] "L F2 D2(R'L2)D R'U2 R'B2 U B'L'U2 F(U2 D2)R2"
[0067] "L F2 D2(R'L2)D R'U2 R'B2 U B'L'U2 F(D2 U2)R2"
[0068] "L F2 D2(L2 R')D R'U2 R'B2 U B'L'U2 F(U2 D2)R2"
[0069] "L F2 D2(L2 R')D R'U2 R'B2 U B'L'U2 F(D2 U2)R2"
[0070] Step 3: Optimization
[0071] A. Optimization constraints:
[0072] Optimization constraint 1: The two steps of coaxial opposite and two manipulators facing each other cannot be optimized.
[0073] Optimization constraint 2: If it can be tightened directly, tighten it directly.
[0074] Optimization constraint 3: Time reuse. If the current mechanical step cannot be directly turned, if a certain robot is currently rotating, consider idling another robot in the subsequent step; if a certain robot is currently idling, consider driving another robot in the subsequent step. Idle and driving time reuse, because driving is always slower than idling, which is equivalent to idling without extra time consumption, and at the same time, it also reduces the number of robot opening and closing times.
[0075] Optimization constraint 4: To complete the same preparatory action before twisting, if it can be rotated idly, then don’t rotate it; if it can be rotated 90 degrees, then don’t rotate it 180 degrees.
[0076] B. Optimal calculation:
[0077] For each of the 8 Rubik's Cube strings in step 2, use a greedy algorithm with a depth of 2 to optimize the time of the mechanical steps, that is, the time for every 2 steps is optimal.
[0078] For the following Rubik's Cube string, we use the first 6 steps of optimization to illustrate:
[0079] "F L2(D2 U)L'(F'B')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0080] Robot initial posture 0
[0081] If only 1 step is considered for each mechanical step:
[0082] Lh turns 90 degrees clockwise, 65ms
[0083] Lh open, Lh idle 90 degrees, Lh closed, Rh open, Lh belt rotate 180 degrees, Rh closed, Rh twist 180 degrees, (when only considering 1 step, the spatial orientation is on the 4th or 5th face, you can use Rh twist or Lh twist to generate different step branches, generate a binary tree, and finally compare the final results to get the best one.) (30+22)*2+65+184+107=460ms
[0084] Rh open, Rh idle 90 degrees, Rh closed, Lh open, Rh counterclockwise rotate 90 degrees, Lh closed, Lh twisted 180 degrees, (30+22)*2+65+166+107=442ms
[0085] Lh is open, Rh rotates 180 degrees, Lh is closed, Lh is turned 90 degrees clockwise, 30+22+184+65=301ms.
[0086] Lh opens, Lh idles 90 degrees, Lh closes, Rh turns 90 degrees counterclockwise, 30+22+65+65=182ms.
[0087] Lh is open, Rh is turned 90 degrees counterclockwise, Lh is closed, Lh is turned 90 degrees counterclockwise, 30+22+166+65=283ms.
[0088] Total time: 65+460+442+301+182+283=1733ms
[0089] 2-step optimization, whenever you cannot directly turn it, when it is idling or rotating, consider the next step and the current step time reuse:
[0090] Lh turns 90 degrees clockwise, 65ms
[0091] Rh opens, Lh rotates 90 degrees counterclockwise (while Rh idles 90 degrees clockwise), Rh closes, Lh opens, Rh rotates 90 degrees clockwise, Lh closes, Lh turns 180 degrees, Rh turns 180 degrees, (30+22)*2+166*2+107=543ms, 543+107=650msRh opens, Lh rotates 180 degrees (while Rh idles 90 degrees), Rh closes, Rh turns 90 degrees clockwise, Lh turns 90 degrees counterclockwise, 30+22+184+65=301ms, 301+65=366ms
[0092] Rh is open, Lh rotates 90 degrees clockwise (if Rh is idling at the same time, a branch can be generated to change the posture of the robot after this step is completed, thereby changing the subsequent steps), Rh is closed, Rh rotates 90 degrees counterclockwise, 30+22+166+65=283ms
[0093] Total time: 65+650+366+283=1364ms
[0094] 3-step optimization. Whenever you cannot directly twist the machine, consider the time reuse of the next 2 steps and the current step when the machine is idling or rotating. The 3-step optimization can be decomposed into 1+2-step optimization and 2-step optimization + 1:
[0095] "F L2(D2 U)L'(F'B')D'F2 DBRU F2 U2 F'D2 B2 R2"
[0096] Lh turns 90 degrees clockwise, 65ms
[0097] Because there is no optimization space for the two sides of the last two steps in the three steps of L2(D2 U), only the first two steps can be optimized for these three steps.
[0098] Rh opens, Lh rotates 90 degrees counterclockwise (while Rh rotates 90 degrees clockwise), Rh closes, Lh opens, Rh rotates 90 degrees clockwise, Lh closes, Lh rotates 180 degrees, Rh rotates 180 degrees, (30+22)*2+166*2+107=543ms, 543+107=650ms
[0099] In this example, the next 3 steps U L'F' do not reflect the advantages of 3-step optimization. In some special cases, such as UB R, we can consider R in the Rh position and bring U and B to Lh to solve it, which may reduce one drive.
[0100] Rh is open, Lh rotates 180 degrees (while Rh rotates 90 degrees), Rh is closed, Rh is turned 90 degrees clockwise, Lh is turned 90 degrees counterclockwise, 30+22+184+65=301ms, 301+65=366ms
[0101] Rh is open, Lh rotates 90 degrees clockwise (if Rh is idling at the same time, a branch can be generated to change the posture of the robot after this step is completed, thereby changing the subsequent steps), Rh is closed, Rh rotates 90 degrees counterclockwise, 30+22+166+65=283ms
[0102] Total time: 65+650+366+283=1364ms
[0103] C. Calculation method:
[0104] Because the combination of the manipulator posture and the two or three sides of the Rubik's Cube to be twisted is limited, the present invention actually uses branch conditional statement logic judgment to calculate the total time of each mechanical step. Generally, the optimization time fluctuates from tens of ms to hundreds of ms.
[0105] You can also create table queries to speed up calculations.
[0106] D. Optimal comparison:
[0107] According to method B, calculate all possible mechanical step branches for solving the Rubik's Cube string and take the one with the best time.
[0108] According to the mechanical action time in this article, after thousands of tests, most of the Rubik's Cubes that are deliberately scrambled can be solved within 4.0-4.5 seconds. If it is just randomly scrambled, and the Rubik's Cube can be restored in 15-17 moves, many can be solved in less than 4 seconds.
Claims
1. A time optimization method for mechanical movements of a two-arm two-finger Rubik's Cube robot, wherein the two-arm two-finger Rubik's Cube robot has two rotatable mechanical arms, each of which has two fingers that can be opened and closed, and the Rubik's Cube is clamped by two fingers, and the Rubik's Cube is driven to rotate by rotating the mechanical arms; the two mechanical arms are set vertically at 90 degrees, clamping the middle position of two adjacent faces of the Rubik's Cube, and each mechanical arm can rotate; the two mechanical arms include 3 postures, posture 0 is the initial position, posture 1 is the right mechanical arm rotated 90 degrees based on the initial posture, and posture 2 is the left mechanical arm rotated 90 degrees based on the initial posture; Define the six faces of the Rubik's Cube as U, D, R, L, F, and B; collect the opening and closing time of the robot fingers, the time required for the robot arm to rotate 90 degrees, the time required for the robot arm to rotate 90 degrees and 180 degrees with the help, and the time required for the robot arm to twist 90 degrees and 180 degrees. The "with the help" means to rotate the Rubik's Cube with the help, and the "twist" means to twist one face of the Rubik's Cube to rotate; The steps of this method are: Step 1: Scan the shape of the Rubik's Cube and calculate the steps to restore the Rubik's Cube. Each step is an operation on one face. List the order of operations for each face. Step 2: Split the restoration steps of each Rubik's Cube into coaxial pairs of opposite faces. In the operation sequence of each face, if the operation steps of two opposite faces are adjacent, then swap the operation sequence of the two faces to achieve a split of the restoration steps. Split all coaxial pairs of opposite faces according to the above method to obtain all restoration paths. Step 3: Calculate the time consumption of all restoration paths according to all the action times of the robot, and select the path with the shortest time; Step 4: According to the selected path, set the opening and closing time of the robot arm, the time for the robot arm to idle, rotate, and twist 90 degrees and 180 degrees to restore the Rubik's Cube.
2. A time optimization method for mechanical movements of a dual-arm two-finger Rubik's Cube robot as claimed in claim 1, characterized in that: The method for calculating the time in step 3 is: using a greedy algorithm to find the optimal time for each restoration path. The optimization constraints of the greedy algorithm include: The two steps of coaxial and two manipulators facing each other cannot be optimized; Can the two adjacent steps of the robot fingers remain motionless and only the robot arm rotates? If so, the robot arm rotates directly; In the case where the robot arm cannot be rotated directly, if a certain robot arm is currently rotating, another robot arm in the subsequent step will be idle at the same time; if a certain robot arm is currently idling, another robot arm in the subsequent step will be rotated at the same time; Complete the same preparatory movements before twisting. If you can rotate it freely, don't turn it; if you can rotate it 90 degrees, don't turn it 180 degrees.
3. A time optimization method for mechanical movements of a dual-arm two-finger Rubik's Cube robot as claimed in claim 1, characterized in that: When recording the operation steps of the robot arm, the operation process is defined in the following way: U, D, R, L, F, and B represent a 90-degree clockwise rotation of the corresponding surface; U2, D2, R2, L2, F2, and B2 represent a 180-degree rotation of the corresponding surface; U', D', R', L', F', and B' represent a 90-degree counterclockwise rotation of the corresponding surface.
4. A time optimization method for mechanical movements of a dual-arm two-finger Rubik's Cube robot as claimed in claim 2, characterized in that: The restoration path optimization method is that the robot optimizes once every two steps. A1: The first step of each optimization search is to twist any of the six faces of the Rubik's Cube, and the second step is to twist any of the remaining five faces. The arrangement of the six faces of the Rubik's Cube is P6. 2 = 30. Considering the symmetry of the manipulator and the Rubik's Cube, the mathematical description of the optimization path is a mirror image relationship. In fact, 30 / 2 = 15 types need to be calculated. A2: Considering that two manipulators cannot be optimally arranged adjacent to each other, and three coaxial manipulators cannot be optimally arranged opposite each other, there are only 15-1-3=11 variations that can be truly optimized. A3: The possible rotation angles of each side of the comprehensive Rubik's Cube are 90 and 180. For each initial posture of the manipulator, there are 4*11=44 actual changes. A4: Since the robot posture 1 and posture 2 are symmetrical, there are only 44*2=88 possible changes in the real optimization space; A4: Based on the action time of the robot, calculate the time required for these 88 changes. The action that takes the least time is the optimal action. The robot performs the next two steps and then performs step A1 again.
Citation Information
Cited By
Double-arm Rubik's cube robot capable of achieving rapid linkage operation and rapid adjustment method for restoring Rubik's cube
CN120422202A