4. Self Practice
Task 1: Loop
Use the same task as the Basic self practice, but repeat it six times.
Verification 1
- The mahjong board position is not fixed. Check whether the arm can accurately place the mahjong block into a slot and repeat six times. It is recommended not to rotate the board more than 180°.
- After repeating six times, check whether it automatically exits the project execution screen.
Small Tip
When running a loop, remember to pick up the mahjong block, or the arm will crash into it.
Answer 1
Continue from the Basic self practice.
- Add a counting variable.
Set: after the last gripper release (DO_0isL), set the variable to+= 1.If: create the loop, for example by setting the variable condition to>= 6.Yes: same as the later part of the Basic self practice, end the project.No: useGototo connect back toIfand close the loop. You can also directly draw the flow line back instead of usingGoto.
Small Tip
There are many ways to count variables and write If conditions. This is only one example.
Task 2: Fill the Board
Place six mahjong blocks one by one into the six slots on the small mahjong board. The board position changes within a range and is not fixed.
Verification 2
- The mahjong position is not fixed. Check whether the arm can accurately pick it up.
- The small board position is not fixed. Check whether the mahjong blocks can fill all six slots in order, especially the middle row.
- After filling all six slots, check whether it automatically exits the project execution screen.
Answer 2
Continue after finishing Task 1: Loop.
Pallet(Vision Base): replace the original placementPointwithPallet.- Leave everything else unchanged.
Task 3: Stack Up
Stack three to five mahjong blocks vertically at the same place, and display in real time how many mahjong blocks have been stacked.
Verification 3
- The mahjong block position is not fixed. Check whether the arm can accurately pick it up.
- Check whether the mahjong blocks can be picked repeatedly and placed at the same position without triggering a collision error.
- After the flow ends, check whether it automatically exits the project execution screen.
Answer 3
Continue after finishing Task 1: Loop.
- Change the
Ifcondition so the loop runs the number of times you want, three to five times. - Change the
Setthat releases the gripper and increments the variable, and add coordinate parameterization to it. Display: add display information at the first step of the loop to show "how many mahjong blocks have been stacked so far" in real time.
Task 4: Choose a Slot
As before, pick up a mahjong block from an unfixed position. But when placing it on the small board, let the user freely choose one of the six slots, then continue the remaining placement and ending flow.
Small Tip
The task does not require a loop. But if you want extra self practice, you can make the project run until all six slots have been chosen. If the user selects a slot that was already chosen, do not execute it and show an error message.
Verification 4
- The mahjong position is not fixed. Check whether the arm can accurately pick it up.
- After picking up the mahjong block, check whether a human-machine interaction window with six options appears.
- After the user chooses a position, check whether the mahjong block is placed at the corresponding position, while the board position is not fixed.
- After the flow ends, check whether it automatically exits the project execution screen.
Answer 4
Continue from the Basic self practice.
M-Decision: before the original placementPoint, add anM-Decisionnode with six options. You can name them yourself. Each option branch should correspond to onePoint(Vision Base).
Small Tip
To complete the extension, let the project run a six-time loop and create six variables to record whether each slot has been chosen. Then use If to decide whether a chosen slot should show an error (Display) or whether an unchosen slot should place the block at that point (Point).
The six branches of M-Decision can change only the Point; the shared parts such as Set and Wait for can all connect back to the same place.