Skip to content
🔐

專班教材存取限制

請輸入授權密碼以繼續閱覽

4. Self Practice

Task 1: Loop

Use the same task as the Basic self practice, but repeat it six times.

Verification 1

  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°.
  2. 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.

  1. Add a counting variable.
  2. Set: after the last gripper release (DO_0 is L), set the variable to += 1.
  3. 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: use Goto to connect back to If and close the loop. You can also directly draw the flow line back instead of using Goto.

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

  1. The mahjong position is not fixed. Check whether the arm can accurately pick it up.
  2. The small board position is not fixed. Check whether the mahjong blocks can fill all six slots in order, especially the middle row.
  3. After filling all six slots, check whether it automatically exits the project execution screen.

Answer 2

Continue after finishing Task 1: Loop.

  1. Pallet (Vision Base): replace the original placement Point with Pallet.
  2. 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

  1. The mahjong block position is not fixed. Check whether the arm can accurately pick it up.
  2. Check whether the mahjong blocks can be picked repeatedly and placed at the same position without triggering a collision error.
  3. After the flow ends, check whether it automatically exits the project execution screen.

Answer 3

Continue after finishing Task 1: Loop.

  1. Change the If condition so the loop runs the number of times you want, three to five times.
  2. Change the Set that releases the gripper and increments the variable, and add coordinate parameterization to it.
  3. 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

  1. The mahjong position is not fixed. Check whether the arm can accurately pick it up.
  2. After picking up the mahjong block, check whether a human-machine interaction window with six options appears.
  3. After the user chooses a position, check whether the mahjong block is placed at the corresponding position, while the board position is not fixed.
  4. After the flow ends, check whether it automatically exits the project execution screen.

Answer 4

Continue from the Basic self practice.

  1. M-Decision: before the original placement Point, add an M-Decision node with six options. You can name them yourself. Each option branch should correspond to one Point (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.

A textbook for the YMSH AI program