Configure the Workflow

Workflow is the core of a Mech-Viz project. It is where you configure what the robot does at what point.

In the Workflow tab, you’ll add Tasks to the workflow, connect the Tasks , and adjust the parameters of Tasks to achieve the desired actions.

In the example project, you will create the following simple pick-and-place workflow.

../../../../_images/workflow_1.png

Build the Workflow

Set Home Position

The home position is where the robot starts to move and where it will return at the end. The home position should be relatively removed from other objects, and the robot shouldn’t block the camera when it’s at the home position.

The move Task can be used to define a target pose on the robot’s path and set how the robot moves to this pose.

Note

With the real robot connected, you can sync the pose of the real robot to the simulated robot in Mech-Viz.

  1. In Mech-Viz, click on Sync Robot in the toolbar. The simulated robot will move in sync with the real robot.

  2. Move the real robot to the desired home position. Check the simulated robot to make sure the pose of the real robot has been synced.

  3. From the Basic Move category in the Task library, drag the move Task to the programming area. The current pose of the simulated robot will be automatically set as the target.

    Note

    If not connected to a real robot, you can still adjust the target pose of the move Task in the parameter panel. The simulated robot will display the adjusted pose simultaneously.

  4. In the upper part of the parameter panel, rename the Task to Home in the Name field.

  5. Connect the start icon to Home.

    Hint

    A connection is added by holding and draging an exit port onto an entry port.

../../../../_images/workflow_2.png

Set Picking Target

Mech-Viz receives the workobject pose from Mech-Vision, and you’d want the robot to move according to this pose. This can be accomplished with the visual_look and visual_move Tasks.

  • visual_look Task obtains the workobject pose from the corresponding Mech-Vision project.

  • visual_move Task moves the robot according to the received workobject pose.

  1. From the Vision category in the Task library, drag the visual_look Task to the programming area. This Task is automatically named visual_look_1.

  2. In the lower part of the parameter panel, select samplevis (the example Mech-Vision project) from the drop-down menu of Vision Name.

    This will enable the Task to obtain workobject poses from the Mech-Vision project named samplevis.

  3. Connect Home to visual_look_1.

    ../../../../_images/workflow_3.png
  4. From the Vision category in the Task library, drag the visual_move Task to the programming area. This Task is automatically named visual_move_1.

  5. In the lower part of the parameter panel, select samplevis from the drop-down menu of Vision Name.

  6. Connect the exit port of visual_look_1 to the entry port of visual_move_1.

    ../../../../_images/workflow_4.png

Set DO for Picking

Once the robot reaches the picking target, the robot has to operate its tool to pick up the workobject. This is achieved with the set_do Task, which instructs the robot to operate its tool.

  1. From the DI DO category in the Task library, drag the set_do Task to the programming area.

  2. In the parameter panel, rename the Task to Set_DO_Pick in the Name field.

  3. Check the checkbox of Digital Out Value, which tells the robot to start generating vacuum.

  4. Connect the left-most exit port of visual_move_1 to Set_DO_Pick.

    ../../../../_images/workflow_5.png

Set Placing Target

After picking up the workobject, the robot should move to a predetermined position to drop off the workobject. Once again, the move Task can be used to define the placing target.

  1. Move the real robot to the desired placing target. Check the simulated robot to make sure the pose of the real robot has been synced.

  2. From the Basic Move category in the Task library, drag the move Task to the programming area. This Task is automatically named move_1.

  3. Connect Set_DO_Pick to move_1.

Set DO for Placing

Once the robot reaches the placing target, the robot has to once again operate its tool to drop off the workobject, which is achieved with the set_do Task.

  1. From the DI DO category in the Task library, drag the set_do Task to the programming area.

  2. In the parameter panel, rename the Task to Set_DO_Place in the Name field.

  3. Uncheck the checkbox of Digital Out Value, which tells the robot to release.

  4. Connect move_1 to Set_DO_Place.

    ../../../../_images/workflow_6.png

Return to Home

After the robot drops off the workobject, the next step is to return to its home position. As you already set the home position in Home, now you just need to copy and paste this Task.

  1. Right-click on Home and select Copy, or left-click on Home and then use the shortcut Ctrl + C.

  2. Navigate down to the end of the workflow. Right-click on the empty area and select Paste, or use the shortcut Ctrl + V.

  3. This pasted Task is automatically named move_2. Rename it to Return_Home in the Name field in the parameter panel.

  4. Connect Set_DO_Place to Return_Home.

The entire workflow now looks like this:

../../../../_images/workflow_7.png

Hint

Right-click in the programming area and select Format to automatically align the Tasks and adjust their spacing.


Click on Simulate in the toolbar, the simulated robot will move according to the workflow.

You can see that although we built the workflow according to the correct pick-and-place logic, there are several problems:

  • The robot motion from the home position to the picking target is too large.

  • Moving right after setting DO signals doesn’t provide enough time for the robot to pick/place.

  • It would be safer if the robot moves vertically down and up right before and after it performs picking and placing.

Now let’s improve the workflow to resolve the problems.

Improve the Workflow

Add Waypoint

Add a waypoint between the home position and the picking target to break down the motion into two parts.

  1. Move the real robot to the desired waypoint. Check the simulated robot to make sure the pose of the real robot has been synced.

    Note

    The robot should not block the view of the camera when its at this waypoint. You can capture an image to check it the robot is in the way.

  2. From the Basic Move category in the Task library, drag the move Task to the programming area.

  3. In the upper part of the parameter panel, rename the Task to Waypoint in the Name field.

  4. Connect Home to Waypoint and Waypoint to visual_look_1.

    ../../../../_images/workflow_8.png

Add Relative Targets for Picking

The more practical picking motion should be: the tool moves vertically down to the picking target, and then moves vertically up after it picks up the workobject.

The relative_move Task can be used to add targets relative to other targets.

Approaching the Picking Target

Move the robot to 200 mm above the picking target first, and then move it to the picking target from there.

  1. From the Basic Move category in the Task library, drag the relative_move Task to the programming area. The Task is automatically named relative_move_1.

  2. In the parameter panel, set the following fields:

    • Relative To(move-type Task): select Next, which means that the target defined here is relative to the next target in the Workflow (i.e., the target of visual_move_1).

    • Transition tab: set the value of Z to -200.

  3. Connect visual_look_1 to relative_move_1 and relative_move_1 to visual_look_1.

    ../../../../_images/workflow_9.png

Departing the Picking Target

Move the robot to 200 mm above the picking target after it picks up the workobject.

  1. From the Basic Move category in the Task library, drag the relative_move Task to the programming area. The Task is automatically named relative_move_2.

  2. In the parameter panel, set the following fields:

    • Relative To(move-type Task): select Current, which means that the target defined here is relative to the previous target in the Workflow (i.e., the target of visual_move_1).

    • Transition tab: set the value of Z to -200.

  3. Connect Set_DO_Pick to relative_move_2 and relative_move_2 to move_1.

    ../../../../_images/workflow_10.png

Add Relative Targets for Placing

Similarly, the more practical placing motion should be: the tool moves vertically down to the placing target, and then moves vertically up after it drops off the workobject.

Approaching the Placing Target

Move the robot to 200 mm above the placing target first, and then move it to the placing target from there.

  1. From the Basic Move category in the Task library, drag the relative_move Task to the programming area. The Task is automatically named relative_move_3.

  2. In the parameter panel, set the following fields:

    • Relative To(move-type Task): select Next, which means that the target defined here is relative to the next target in the Workflow (i.e., the target of move_1).

    • Transition tab: set the value of Z to -200.

  3. Connect relative_move_2 to relative_move_3 and relative_move_3 to move_1.

    ../../../../_images/workflow_11.png

Departing the Placing Target

Move the robot to 200 mm above the placing target after it drops off the workobject.

  1. From the Basic Move category in the Task library, drag the relative_move Task to the programming area. The Task is automatically named relative_move_4.

  2. In the parameter panel, set the following fields:

    • Relative To(move-type Task): select Current, which means that the target defined here is relative to the previous target in the Workflow (i.e., the target of move_1).

    • Transition tab: set the value of Z to -200.

  3. Connect Set_DO_Place to relative_move_4 and relative_move_4 to Return_Home.

    ../../../../_images/workflow_12.png

Wait after Setting DO Signals

Make the robot wait a little while after the DO signal is set to ensure that the picking and releasing actions are fully completed. This can be accomplished with the wait Task.

  1. From the Tools category in the Task library, drag the wait Task to the programming area. The Task is automatically named wait_1.

  2. Connect Set_DO_Pick to wait_1 and wait_1 to relative_move_2.

  3. From the Tools category in the Task library, drag the wait Task to the programming area. The Task is automatically named wait_2.

  4. Connect Set_DO_Place to wait_2 and wait_2 to relative_move_4.

    ../../../../_images/workflow_13.png

The complete workflow should look like this:

../../../../_images/workflow_14.png

Click on Simulate in the toolbar, the simulated robot will move according to the workflow.

You can see that the robot path is more smooth and safe now.