This Simple Programming Trick Avoids Robot Collisions

Robotics professionals use one simple trick all the time to avoid collisions. Here’s the programming trick that nobody teaches you about, but we all use.

Collisions are a real danger with robotics. Large collisions can damage the workshop, the robot itself, and anyone who is unfortunate enough to be close by. Even tiny collisions can be costly. As a result, it’s important to ensure that your robot will not collide with anything when running its program.

The problem is that many people over-complicate collision avoidance. They assume (understandably) that robots are capable of autonomously avoiding obstacles in the workspace. The truth is that autonomous collision avoidance is a complex topic. Robotics researchers spend years developing trajectory planners which would be far too bloated for most industrial robot users.

There are much simpler ways to stop your robot banging into things, as we explained in our previous article 5 Easy Ways to Avoid Robot Collisions (& a last resort). Hardly any of them require complex programming.

However, there one programming trick which can help you avoid most collisions. In this article, we’ll explain how you can use this trick and avoid collisions completely.

The Secret to Collision-Free Robot Programs

Consider the following simplified robot program for a pick-and-place application:

  1. Move robot to “pick” location.
  2. Grasp object.
  3. Move to “place” location.
  4. Drop object.

On the surface, this looks like the framework for a good robot program, doesn’t it?

However, it is actually missing 4 vital steps which will ensure that the robot does not collide with anything in the environment.

The secret to collision-free programs is to split your program instructions by type. Traveling moves should always be performed in “free space” and operational moves should be done carefully. Any time you switch between a travel and operation, you need to insert either an “approach” or a “retreat” action.

How to Split Your Program Instructions by Type

The trick is to assign each of your program instructions to one of the following three types.

This is a practice which is almost second nature for experienced roboticists. Over the years, we’ve caused so many small collisions with our robots that we do this without even thinking. However, newer robot programmers sometimes forget to do it.

These are the 3 basic types of moves in any robot program:

1. Traveling Moves

A traveling move is where the robot moves from one location within its workspace to another. The important property here is speed. The robot should move as quickly as possible (safely, of course) as traveling moves can significantly affect your cycle time.

For this reason, Joint Move instructions are often used for traveling. They are imprecise but they are quicker than Linear Move and Circular Move instructions.

Whichever instruction you choose, the key to avoiding collisions is always to perform traveling moves within “free space” (i.e. spaces where there are no objects). All traveling moves should start in free space — a distance away from any object — and they should end in free space.

2. Operational Moves

An operational move (this is not an “official” term) is where the robot is actually performing a task. The important property here is precision. The robot must follow a precise path to guide the robot tool (e.g. paint gun, welder, machining spindle, etc).

The most common instructions used for operational moves are:

Because operational moves are performed near objects, it’s important that you plan them carefully to avoid collisions.

3. Approach/Retract Moves

Approach moves are the real secret to success when it comes to avoiding collisions. They are very simple and easy to implement, but forgetting about them can wreak havoc on your robot program.

Instead of moving the robot directly to the start location of your operational move (e.g. the “pick” location in our example program), you should move it to a nearby location in free space. Then, you can carefully approach the start location and avoid colliding with anything. A Retract Move is the same but when moving away.

Depending on the size of your robot, the “approach distance” can be anything from a few millimeters to tens of centimeters.

How to Add Approach Moves to Your Robot Program

Let’s look back at our simple pick and place program from before:

  1. Move robot to “pick” location.
  2. Grasp object.
  3. Move to “place” location.
  4. Drop object.

First, we also need to add two extra locations (called “targets” in RoboDK) to our program space:

  • Approach 1 — this is a short distance away from the “pick” location, in free space.
  • Approach 2 — this is a short distance away from the “place” location, in free space.

We can now update the program to specify the type of each move and add our approach and retract moves.

Our program would look something like this:

  1. (Traveling Move) Quickly move to Approach 1.
  2. (Approach Move) Carefully move to “pick” location.
  3. (Operational Move) Grasp object.
  4. (Retract Move) Carefully move back to Approach 1.
  5. (Traveling Move) Quickly move to Approach 2.
  6. (Approach Move) Carefully move to “place” location.
  7. (Operational Move) Drop object.
  8. (Retract Move) Carefully move back to Approach 2.

It’s true that this program looks a bit longer than it did before. However, you just have to remember that all we are doing is using the following two simple rules:

The Only 2 Things You Need to Remember

You can tell whether or not you need an approach or retract move like this:

  • Moving from a Traveling Move to an Operational Move? Add an Approach Move.
  • Moving from an Operational Move to a Traveling Move? Add a Retract Move.

To use this technique in RoboDK, just check out the following guide in our documentation pages.

Any questions? Tell us in the comments below or join the discussion on LinkedIn, Twitter, Facebook, Instagram or in the RoboDK Forum.

About Alex Owen-Hill

Alex Owen-Hill is a freelance writer and public speaker who blogs about a large range of topics, including science, presentation skills at CreateClarifyArticulate.com, storytelling and (of course) robotics. He completed a PhD in Telerobotics from Universidad Politecnica de Madrid as part of the PURESAFE project, in collaboration with CERN. As a recovering academic, he maintains a firm foot in the robotics world by blogging about industrial robotics.

View all posts by Alex Owen-Hill

Leave a Reply

Your email address will not be published. Required fields are marked *