Collision Maps

What you will learn

You will learn how to include / exclude collision in EcScript. It is possible to enable collision between links / manipulators. If a collision is included, the specified links / manipulators will stop once the bounding volumes touch. If the collision is excluded, the specified links / manipulators will pass through each other.

Prequisites

Collision Exclusion

When picking an object in the scene, meshes would typically touch and the bounding volumes would overlap. How is it possible to to pick an object if there is collision? The answer is to exclude collision with desired links or objects right before they collide. For an example, if the UR5e wants to pick up an object or part, it is best to exclude collision with it right before the approach to pick.

The local path planner will be used here, let's set up the robot to move to the left side of the bar. Go to the Scripting Page and paste the EcScript into development environment:

(motion_seq

    # Manipulator Index
    (def_u32 manip_id 0)

    # Vector of reals for joint positions
    (def_real_vec desired_joints (-180.0deg -90.0deg -90.0deg -90deg 90.0deg 0.0))

    # Speed Factor
    (def_real speed_factor 0.1)

    # Acceleration Factor
    (def_real accel_factor 0.1)

    # Tolerance
    (def_real tolerance 1e-3)

    # Move Joint to left side of bar
    (move_joint  
        manip_id 
        desired_joints 
        (speed_factor accel_factor) 
        tolerance
    )
)

Save As CollisionMoveJoint1.ecs

  1. Go to the 3D Model Page
  2. Select Script File as CollisionMoveJoint1.ecs
  3. Put the Mode Selection in Servo
  4. Play the simulation

The robot should be in this position:

Now go back to the Scripting Page, create a New File, and paste the following:

(motion_seq
    # Robot Manipulator Index
    (def_u32 robot_manip_id 0)

    # Table Manipulator Index
    (def_u32 table_manip_id 1)

    # Gripper Manipulator Index
    (def_u32 gripper_manip_id 2)

    # Extrusion Bar Index
    (def_u32 bar_manip_id 3)

    # Base Link Index
    (def_u32 base_link_id BASE)

    # Motion Constraint Set
    (def_u32 motion_constraint_set 0)

    # Motion Constraint
    (def_u32 motion_constraint 0)

    # Speed Factor
    (def_real speed_factor 0.1)

    # Acceleration Factor
    (def_real accel_factor 0.1)

    # Tolerance
    (def_real tolerance 1e-3)

    # Excluding collision with the gripper and table
    (exclude_collision 
        gripper_manip_id 
        table_manip_id
    )

    # Excluding collision with the gripper and bar
    (exclude_collision 
        gripper_manip_id 
        bar_manip_id
    )

    # Moving locally to pick location of the bar
    (move_pose 
        robot_manip_id 
        motion_constraint_set 
        motion_constraint 
        (get_frame table_manip_id base_link_id "TABLE_PICK_PLACE_2_1") 
        (speed_factor accel_factor) 
        tolerance
    )
)

Save As CollisionExclusion1.ecs

  1. Go back to the 3D Model Page
  2. Select Script File as CollisionExclusion1.ecs
  3. Make sure the Mode Selection is in Servo
  4. Play the simulation

The results should look like this:

The gripper has excluded collision with the Table and the Extrusion Bar. It then does a move_pose to the TABLE_PICK_PLACE_2_1 frame, which is located with respect to the Table.

Toggle the Render Bounding Volumes. Notice there is no collision even though the bounding volumes overlap:

Note: Bounding volumes are primative shapes that wrap around the links / manipulators / workcells to determine collision zones between objects.

Let's see what happens when collision is included between those objects.

Go to the Scripting Page and create a New File and paste this:

(motion_seq
    # Robot Manipulator Index
    (def_u32 robot_manip_id 0)

    # Table Manipulator Index
    (def_u32 table_manip_id 1)

    # Gripper Manipulator Index
    (def_u32 gripper_manip_id 2)

    # Extrusion Bar Index
    (def_u32 bar_manip_id 3)

    # Base Link Index
    (def_u32 base_link_id BASE)

    # Motion Constraint Set
    (def_u32 motion_constraint_set 0)

    # Motion Constraint
    (def_u32 motion_constraint 0)

    # Speed Factor
    (def_real speed_factor 0.1)

    # Acceleration Factor
    (def_real accel_factor 0.1)

    # Tolerance
    (def_real tolerance 1e-3)

    # Including collision with the gripper and table
    (include_collision 
        gripper_manip_id 
        table_manip_id
    )

    # Including collision with the gripper and bar
    (include_collision 
        gripper_manip_id 
        bar_manip_id
    )

    # Moving locally to pick location of the bar
    (move_pose 
        robot_manip_id 
        motion_constraint_set 
        motion_constraint 
        (get_frame table_manip_id base_link_id "TABLE_PICK_PLACE_2_1") 
        (speed_factor accel_factor) 
        tolerance
    )
)

Save As CollisionInclusion1.ecs

The code change here was simple, only exclude_collision was changed to include_collision.

  1. Go back to the 3D Model Page
  2. Select Script File as CollisionMoveJoint1.ecs
  3. Put the Mode Selection in Servo
  4. Play the simulation
  5. Select Script File as CollisionInclusion1.ecs
  6. Play the simulation

First the robot was moved back to its home position. Then it repeated the same move_pose command, but this time the collision was included. The robot should look like this:

The robot was not able to reach to the pick location because it came into a collision. Highlighted in red, notice the two objects stopped at the collision are the gripper's finger and the Extrusion Bar. Toggle the Render Bounding Volumes to see where the collision zones have collided.

Its shows the gripper's finger bounding volume has touched the Extrusion Bar's bounding volume. Also, the Script Output displays an error indicating the collision.

Next: Manipulator Attachments