Code Guidelines and Standards for Robot Programs? How Do You Handle This?

Hi everyone,

Coding guidelines in my Background as an SW Engineer

I come from a software development background, where coding guidelines are a normal part of everyday work.

In software projects, these guidelines often come from several different sources. Some are general industry conventions, some are company or department requirements, and others are simply agreements made within a team. There are also many tools available that help developers follow these standards and keep code consistent.

This got me wondering:

  • How do people approach this when programming or teaching robot applications?
  • Do you have coding guidelines for robot programs?
  • Do we even call them coding guidelines in this context?

On one hand, a PolyScope program is clearly a form of code. On the other hand, it is also very much a “click-clack-boom” graphical environment, so it feels different from traditional software development.

I’m particularly interested in how teams ensure consistency when multiple people are responsible for creating and maintaining robot programs.

Context: Our application

To provide some context, we are about to start a larger automation project where the robot’s primary task will be transporting DUTs (Devices Under Test). The robot will move parts between incoming stations, buffer locations, various test tools, back to those buffer locations when required, and eventually to outgoing stations.

From a programming perspective, this will result in roughly 100 individual “move” operations, most likely implemented as separate URPX programs. They are individually called and played by a Dispatcher Software, on a Desktop Computer.

One of our goals is to spread the knowledge across the team instead of having a single robot expert. At the moment, we have:

  • Three people with PolyScope X Core Training (including myself)
  • One person with PolyScope 5 Core Training
  • Plans to train two additional people on PolyScope X

I would actually like all of them to contribute to the teaching and programming work. The current idea is to have people work in pairs and let each pair create a subset of the programs.

However, if six different people teach and structure programs in six different ways, maintenance will quickly become difficult. I would like all programs to follow a similar level of quality and look as if they came from a single team with a common methodology.

Also I’m already thinking about implementing some own kind of “StyleCop” running on a Desktop Computer which repeatedly downloads the Programs from the Robot.

So I’m curious:

  • Do you define programming or teaching standards for your robot applications?
  • If yes, what do those standards cover?
  • Naming conventions?
  • Program structure?
  • Folder organization?
  • Coordinate systems and feature usage?
  • Error handling?
  • Reusable components?
  • Documentation?
  • Code reviews or peer reviews?
  • Any tools that help enforce consistency?

I would also be very interested in hearing any general recommendations, lessons learned, or best practices that you have found valuable when multiple people are working on the same robot cell over a longer period of time.

Thanks in advance for sharing your experiences!

I can’t speak to Polyscope X haven’t not used it, but I have quite a bit of experience with PolyScope 5, and other Industrial Robot applications (Yaskawa, Fanuc, ABB, etc).

I would say decide early on how you’d like to store and name the programs. Are you going to store them on a network drive or the robot? Making a folder per project tends to work fine for us.

Are you going to version control your programs? (Something fancy like git, or just slapping a date on the end of the program name)

As someone who regularly went on the road and sat down in front of a machine I’ve never touched before, I HIGHLY advise you keep programming structure SIMPLE. As you become adept at programming, you can fall into the trap of making something really ELEGANT and awesome, but when someone else sits down in front of it, they have to unravel your genius.

I running your entire program inside a Switch/Case statement to be the way to go. This is a standard we adopted from traditional industrial robots. They essentially just sit there scanning their main ladder until a certain register equals some value, at which point it makes a job call. That register is loaded from an external source like a PLC (or a desktop in your case). This lets you break the application into smaller, more easily testable chunks.

USE FOLDER NODES. At least in Polyscope 5, there is no way to cut and paste multiple lines of code. So if you decide that little chunk of robot motion you’ve got actually needs to be somewhere else, you have to cut and paste each line. If you put it in a folder to start, you can just move the folder instead.

Lastly, decide on a sensible schema for waypoint names. If you’re not careful, you’ll end up with “Waypoint_135” which means nothing to anyone.

Good Morning

Thanks for sharing your thoughts and experience! I appreciate that a lot.

I completely agree we should define a naming scheme for the program’s before we start teaching them.

Yes, we do fancy git (as it is not that fancy for us, for other software projects we use it daily).

More details on recently implemented project

Recently we implemented a completely different setup: a UR5e that takes DUT’s from a measurement container, and places them on thwo different benches, while one of them has even 3 positions the DUT needs to place. Sounds similiar to this use case? Yes, but the implementation is completely different, as we only need one program, and the UR5e is in charge of everything, he tells my Desktop Software’s to run the tests. This is feasible, as in this production line, we basically only have one product, so all have to do the same procedure. The other setup, I described, will handle different prodcuts, that have to be tested on different tools.

In a recently implemented setup with Polyscope X, we made two simple Powershell scripts, one regularly downloading all programs from the Robot, to a local folder. Another one comparing the last downloaded programs, with their previously most recent known version. If something changed, they get copied to a backup folder with timetag. But that’s just to revert something during development. For the “real” revisioning, the local folder acts as a local clone of a git repo, and whenever we change something and have a state we want to “keep” we do a commit. The master is on a gitlab instance.

We basically want to keep this procedure also for the new implementation. But maybe even improved with some automatic checks in a gitlab pipeline.

I understand your recommendations. And I think, with PLC this is the way to go. But for our setup it’s different → the Dispatcher SW has a configuration, where he gets information about all “stuff” he has: tool stations, input stations, output stations, intermediate parkings, etc. But also stuff around, like tables. As, in a status screen it shows a 2d view on the whole setup, where you can see which DUT is where, what the robot is currently doing, which tools are busy, etc. So all informations, how to bring a device to a certain place (name of the program on the robot), geometric information, type, in case of tool, how to remote control the tool, etc comes from the same source. The good thing is, the same config I can also use on the robot side. For example to automatically generate the programs by corresponding templates. Also, as a lot of people will work on the programs, I think it is easier to track and check changes with each move operation being an own program. And, we also use the existence of the programs for scheduling decisions. One program missing? No problem. Then this Input Station, intermediate parking station, Tool Slot, or whatever is just currently not available and the Dispatcher will schedule around that.

Beside that, it’s a philosophy question, I want the Dispatcher SW being in charge of the Robot. It shall call programs by its name, and not set any register number that we have to make sure on both ends its understand as the right thing.

Thanks for the note about the Folder’s! I wasn’t acutally aware Polyscope 5 doesnt support selecting multiple lines to copy, but I pretty well know, Polyscope X doesnt. But maybe it comes. They already implemented quite some points we critized in the Core Training earlier this year :slight_smile:

Ah yes and the waypoints thing is also a good point! And something we could easily check in our gitlab pipeline → if the program contains Waypoint_xxx → fail :wink:

Do as little as possible on the actual robot. No sensor evaluation, no sequence logic - nothing.

Teach waypoints and move to and from them according to PLC instruction and build proper PLC software in Structured Text!.

We don’t use any PLC…

Well, in my opinion you should do that with every robot. Even more so with URs and their not so fun logic programming experience.
If it isn’t possible the thing that worked the best was to create a state machine (Loop with CASE inside) that way the logic steps could be organized somewhat ok.

As long as the programs aren’t too complicated URs are definitely fine, if it gets somewhat complex though its a really unpleasant programming experience.

Although I must say that I’ve never used Polyscope X and only been on 5.xx.xx, from what I’ve seen I think Polyscope X isn’t much better in that regard.

I agree with the “state machine” for UR robots. This is the method they teach in the certified integrator course. Use a Thread with a switch.