Brief description of the interface

The core functions of Mikado can be called up via the fieldbus interface. A distinction is made between general functions and functions for controlling a loaded Mikado program.

General functions

  • Carry out the hand-eye calibration.

Functions for controlling a Mikado program

  • Start and stop the Mikado program or an individual sequence within the Mikado program.

  • The synchronization of Mikado variables with the PLC.

An overview of the fieldbus interface documentation can be found here.

General communication process

Communication is realized by means of commands (see Commands) that are sent from the PLC to Mikado. The status of the communication is described using status bits (see Communication status). The following process description applies to all commands. The condition for communication is OutReadyBit = 1, which depends on the Mikado system status.

General communication process

Time

SPS

Mikado

\(<t_1\)

Wait for OutReadyBit = 1

Wait for OutBusyBit = 0

Set parameters

Waiting on command

\(t_1\)

Set InCmd

Wait for OutBusyBit = 1

\(t_2\)

OutErrorCode = 0

OutBusyBit = 1 (fieldbus adapter processes command)

Only when starting the program or a sequence:

OutRunningBit = 1

\(t_3\)

Reset InCmd to 0

Wait for OutBusyBit = 0

\(t_4\)

Write OutErrorCode

OutBusyBit = 0 (fieldbus adapter has processed command)

\(t_5\)

Reading OutErrorCode

Nur when starting the program or a sequence:

Wait for OutRunningBit = 0

\(t_6\)

Nur when starting the program or a sequence:

Reading OutErrorCode

Only when the program or a sequence was started before:

OutRunningBit = 0 (MIK program ends)

from here

read variables if necessary

General case signal trace

General signal trace, alternative cases dashed

Signal trace for commands like StartCalib, CaptureCalib, FinishCalib

Signal trace for commands like StartCalib, CaptureCalib, FinishCalib

  • If a command is set (InCmd \(\neq\) 0), Mikado responds with OutBusyBit = 1 and first resets the OutErrorCode. The PLC responds to OutBusyBit = 1 with InCmd = 0 and then waits for OutBusyBit = 0.

  • The PLC evaluates the OutErrorCode. If this has the value 0, the command has been executed successfully.

  • Only commands RunMikadoProg and StartSequence cause OutRunningBit = 1. This signals that Mikado is processing the current program. As soon as OutRunningBit = 0, the OutErrorCode and the corresponding output variables can be read out.

Communication status

LifeBit

A LifeBit is used to check the status of communication between Mikado and the PLC. The PLC reads the value of OutLifeBit and writes it unchanged to InLifeBit. The fieldbus adapter reads the value of InLifeBit and writes the negated value to OutLifeBit. If the value of OutLifeBit does not change regularly, communication is considered interrupted and a corresponding error is displayed in the Mikado status.

Mikado status

The status of Mikado is transmitted to the PLC using three different bits. The following table summarizes the meaning of the individual bits.

Meaning of the individual status bits

Name

Explanation

Value

OutBusyBit

Status of the fieldbus adapter.

True = Command is processed.

False = Adapter is ready to accept new command

OutReadyBit

System status of Mikado.

True = Mikado ready for operation

False = Mikado not ready

OutRunningBit

Program status of Mikado

True = Mikado program is running (corresponds to green or yellow in Mikado)

False = program is not running (corresponds in Mikado: orange, red or grey)

Note

New commands are only accepted if OutBusyBit = False

Synchronising fieldbus data and Mikado variables

Fieldbus data can be mapped to Mikado variables and vice versa. This makes it possible to write data to the fieldbus or read data from it directly from within a Mikado program.

The mapping between fieldbus data and Mikado variables can be configured in the Mikado Assistant under ‘Interfaces’. Dedicated configuration pages are available for the various supported communication protocols (ADS, EtherCAT, EtherNet/IP, Profinet).

In the Address Assignment table, the name of a Mikado variable can be specified in the “Variable name in Mikado” field for each element of the fieldbus interface. This automatically synchronises that element of the interface with the corresponding variable. The elements of the standard address assignment are named with the prefixes FI (short for ‘fieldbus input’) or FO (short for ‘fieldbus output’).

../../_images/assistant_configuration.png

Assistant for customising address mapping and synchronised variables

Rotation conventions

The rotation convention defines how the orientation of poses is transferred to the interface or read from the interface. The orientation is always specified in the form of Euler angles, which can be interpreted in different ways depending on the convention (see below).

The rotation convention is specified as a combination of four letters: r (relative, intrinsic, rotated coordinate system) or s (static ,extrinsic, fixed coordinate system) followed by the order of the three rotation axes x/y/z. This theoretically results in 24 different combinations in which the orientation of poses can be represented in Euler angles.

The following table lists the rotation conventions for some robot manufacturers. The convention must be set to match the robot used in the Mikado Assistant under the “Interfaces” tab so that the alignment of poses can be interpreted correctly.

Mikado uses the convention rxyz (roll-nick-yaw / RPY) as standard. If this convention is selected, the Mikado poses are passed on to the interface unchanged. If a different setting is selected, the rotation part of a pose is converted by the interface into the corresponding format.

The rotation convention uvw, which is used natively by Universal Robots, has a special position. Instead of converting this to Euler angles on the robot side, it can be used directly by selecting the corresponding convention. The parameters u, v and w represent a vector around which the pose is rotated. The type of rotation description corresponds to the Axis-Angle Representation.

Supported conventions

ID

Convention

Robot manufacturer

R1

R2

R3

0

rxyz

(Standard)

Stäubli

X (Roll)

Y’ (Nick/Pitch)

Z’’ (Gier/Yaw)

1

sxyz

Fanuc

Yaskawa Motoman

Universal Robots

Fruitcore

Mitsubishi

Techman

X (A)

Y (B)

Z (C)

2

rzyx

Kuka

ABB

Nachi

Z (A)

Y’ (B)

X’’ (C)

3

rzyz

Doosan

Kawasaki

Omron

Z

Y’

Z’’

4

uvw

Universal Robots

U

V

W

Error codes

The output word OutErrorCode encodes error messages. The following table summarises all possible error codes and explains their meaning and recommended corrective actions.

Possible error messages

Code

Error name

Description

Recommended action

0

NoError

Initial state. No error present

-

>0

Error in the Mikado program

Project-specific error in the Mikado program

For details, see the Mikado program or project-specific documentation

-1

ServiceCallFailed

Command failed due to an internal error.

Contact Mikado Support

-4

NoReplyValue

No return value received (internal error)

Contact Mikado Support

-5

TooManyReplyValues

Number of return values higher than expected (internal error)

Contact Mikado Support

-6

FatalErrorMikadoProgram

The Mikado program has a fatal error. The program cannot continue from this point.

Reset the Mikado program and restart the program / sequence

-8

UnknownCommand

Unknown command received

Check InCmd. For valid commands, see Commands.

-9

LifebitClientMissing

Lifebit of the client was not recognized.

Check the fieldbus connection between Mikado and the communication partner and the configuration of the ‘LifeBit’

-11

TriggeringFailed

Failed to call a Mikado sequence. This can occur, for example, if Mikado is not ready for operation or if a program is already running.

Ensure that Mikado is ready for operation (ReadyBit = true) and that no program is already running (RunningBit = false)

-12

ReadingVariableFailed

Internal error when reading data from the fieldbus interface

Contact Mikado Support

-13

WritingVariableFailed

Internal error when reading data from the fieldbus interface

Contact Mikado Support

Possible error messages, continued

Code

Error name

Description

Recommended action

-15

CancelCalibrationFailed

Aborting an already started calibration failed

Ensure that calibration has been started previously (StartCalib) and that no program is running (RunningBit = false)

-16

CaptureForCalibrationFailed

Command CaptureCalib failed. Capture for ongoing calibration unsuccessful

Ensure that calibration has been started previously (StartCalib) and that no program is running (RunningBit = false)

-17

FinishCalibrationFailed

Command FinishCalib failed. Calculating and saving calibration was not successful

Ensure that calibration has been started previously (StartCalib) and that no program is running (RunningBit = false)

-18

StartCalibrationFailed

Command StartCalib failed. Calibration could not be started

Ensure that no calibration is already in progress and no program is running (RunningBit = false)

-19

SequenceDoesNotExist

Command StartSequence failed. Mikado sequence with the specified ID does not exist

Check SequenceID and call command StartSequence with a valid ID

-20

MissingConfigurationItem

Invalid fieldbus configuration. A required entry is missing.

Contact Mikado Support

-60

RetryErrorMikadoProgram

The Mikado program has an error, but the execution can be retried. This can occur if the connection to the robot or camera is briefly interrupted while Mikado is attempting to execute an action.

Execute the command RunMikadoProg. In many cases, the cause of the error will have been automatically corrected by the time the retry is attempted, and the process can be continued successfully. If not, another error will be triggered.

-61

RetryActionErrorMikadoProgram

Robot movement failed. A movement command from Mikado could not be successfully executed by the robot. This can occur if the connection to the robot is lost or if the robot is stopped unexpectedly, for example due to an error or a safety stop (emergency stop).

If applicable, first rectify the cause of the unexpected stop and then execute the command RunMikadoProg. The program will continue. If the movement still cannot be executed successfully, an error will be triggered again.

-100

UnexpectedError

Unexpected error occurred

Contact Mikado Support

Commands

All commands have at least OutErrorCode as a return value. Some commands have additional input and return values. The additional input and return values are listed in the detailed description of the commands, if they exist.

Note

The input values must be present on the fieldbus before the command is set so that they can be taken into account. The return values are present on the fieldbus as soon as OutBusyBit == 0 and the configuration file contains the corresponding entries (see Synchronising fieldbus data and Mikado variables).

The following table lists all available commands:

Available commands

InCmd

Command name

Description

0

Idle

Waiting

Program specific commands

1

RunMikadoProg

Start/continue Mikado program from the current task

2

StartSequence

Start a specific sequence of the Mikado program. SequenceID must be set beforehand

3

PauseMikadoProg

Stop process after execution of the current task

4

StopMikadoProg

Stop the Mikado program

5

ResetMikadoProg

Stop Mikado program and reset all variables and states in the Mikado

General commands

8

StartCalib

Start hand-eye calibration

9

CaptureCalib

Triggers image acquisition and measurement of the calibration pattern

10

FinishCalib

Calculate and save hand-eye calibration

11

readPoseAndPublishTool0

Sets the pose of the robot flange in Mikado

14

CancelCalib

Cancel hand-eye calibration

20

Capture

Triggers image acquisition

21

StartPickSearch

Start searching for objects and picks

22

GetBestPick

Reads the best available pick

Program specific commands

Program-specific commands refer to the current Mikado program and can only be executed if a program is loaded. These commands have no additional return values. The desired results depend on the implementation in the Mikado program and are communicated individually via the synchronized variables (see Synchronising fieldbus data and Mikado variables).

Conversely, the behaviour of the Mikado program can be influenced via the fieldbus by using synchronized variables as inputs for tasks in the Mikado program. It should be noted that a synchronized variable used as task input in the Mikado program sequence is read out at the time of task execution. Therefore, synchronized variables on the PLC side should only be changed if no Mikado program is running.

Note

To avoid errors in the program sequence, synchronized variables on the PLC side should only be changed if no Mikado program is running (OutRunningBit = 0).

RunMikadoProg

This command is used to start or continue the current Mikado program. After successful execution of the command, the RunningBit = True changes and signals the running Mikado program. As soon as this is reset by Mikado, the synchronized variables can be evaluated.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

StartSequence

This command executes the Mikado sequence with the ID stored in the word SequenceID. From program version 3, the ID of a sequence can be set in the text field to the right of the sequence name. In earlier program versions, the sequence name must be the same as the ID sent, for example the integer “42”.

After successful execution of the command, the RunningBit = 1 changes and signals the running Mikado program. As soon as this is reset by Mikado, the synchronized variables can be evaluated.

Input values

Description

InSequenceID

ID of the sequence to be started

Return values

Description

OutErrorCode

Error code

PauseMikadoProg

This command pauses the execution of the current program.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

StopMikadoProg

This command stops the execution of the current program.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

ResetMikadoProg

This command stops the execution of the current program and resets the status of the program and all variables.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

General Commands

General commands can be executed independently of the Mikado program. The return values are at the address defined in the configuration file as soon as OutBusyBit == 0.

StartCalib

This command starts the hand-eye calibration.

Input values

Description

InCameraID

ID of the camera to be used

InFrontLightOn

Specifies whether the front light is switched on during calibration

Return values

Description

OutErrorCode

Error code

CaptureCalib

This command is used to collect poses for hand-eye calibration. The calibration process must first have been started using the StartCalib command. At least 6 valid poses must be collected for calibration. Ideally, however, around 10 to 20 poses should be collected to achieve the best possible result. This command must therefore be run frequently.

Input values

Description

InPose

Current Tool0 position (robot flange)

Return values

Description

OutErrorCode

Error code

Example procedure:

  • Robot strikes a pose

  • PLC writes the current flange pose (tool0) to InPose

  • The command CaptureCalib is triggered

  • Mikado reads the current robot pose from InPose and takes a picture

FinishCalib

This command is used to calculate the hand-eye calibration. This is the last step in the hand-eye calibration process. This takes place after a sufficient number of collected pattern poses with the help of CaptureCalib.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

OutCalibMaxDist

Maximum pose error distance

OutCalibMeanDist

Mean pose error distance

OutCalibMeanX

Mean pose error x

OutCalibMeanY

Mean pose error y

OutCalibMeanZ

Mean pose error z

OutCalibMeanAngle

Mean pose error angle

CancelCalib

This command cancels the active hand-eye calibration.

Input values

Description

none

Return values

Description

OutErrorCode

Error code

readPoseAndPublishTool0

Note

This command is generally only used for select cells.

This command reads in a pose transmitted by the PLC and sets it in Mikado as the current pose of the robot flange (tool0). The position of the robot during image acquisition must be known for the Mikado program sequence, whereby Mikado Select itself has no information about the robot status. It is not necessary to use this command for hand-eye calibration, as the CaptureCalib command already performs the same functions in the background.

Input values

Description

InPose

Current Tool0 position (robot flange)

Return values

Description

OutErrorCode

Error code

Capture

Note

This command is generally only used for select cells.

This command triggers a capture for the selected camera.

Input values

Description

InCameraID

ID of the camera to be used

Return values

Description

OutErrorCode

Error code

StartPickSearch

Note

This command is generally only used for select cells.

This command initiates a pick-search, i.e. a search for objects followed by picks. The most recent image captured by the selected camera is used for this purpose. It may therefore be necessary to trigger a capture beforehand using the Capture command.

Calling this command starts the search. However, the search itself runs asynchronously in the background. The command does not block until results are available!

Input values

Description

InCameraID

ID of the camera to be used

InBoxID

ID of the camera to be used

InProductID

ID of the product to be used

InGripperID

ID of the gripper to be used

InRoiID

ID of the ROI (region of interest) to be used

InPickSearchParametersID

ID of the search parameters to be used

Return values

Description

OutErrorCode

Error code

GetBestPick

Note

This command is generally only used for select cells.

This command retrieves the best available pick at the time it is called. To identify the correct search run, the parameters InBoxID, InProductID and InGripperID must be specified when calling the command. The term “best pick” refers to the criteria set for sorting picks.

The pick search benefits from having as long a time interval as possible between the start (StartPickSearch) and the retrieval of results (GetBestPick). Only then is there sufficient time to calculate all possible pick variations and prioritise them against one another, so that the best possible pick can be determined.

If the search has not yet finished when this command is called, the command will be blocked until either at least one valid pick has been found or all possible pick variations have been calculated, but no valid picks are found.

However, in order to produce a result quickly, the search may be terminated prematurely in this case, and the first possible pick will be returned. This will be any valid pick, but not necessarily the best theoretically possible pick.

For best results, StartPickSearch should therefore be called as early as possible in the cycle, whilst GetBestPick should be called as late as possible (just before the pick). This allows the pick search the maximum possible calculation time to find an ideal pick.

Input values

Description

InBoxID

ID of the camera to be used

InProductID

ID of the product to be used

InGripperID

ID of the gripper to be used

Return values

Description

OutErrorCode

Error code

OutNoObjectsFoundBit

This bit indicates whether product objects were found. true if no objects are present, otherwise false.

OutNoPickableObjectsBit

This bit indicates whether pickable objects were found. true if no objects are present, otherwise false.

OutNumRecognizedObjects

Number of recognized product objects

OutNumPickableObjects

Number of pickable objects available at the time of the call

OutPickGripperId

ID of the gripper with which the selected pick is to be performed

OutPickCategory

Category of the pick

OutPickSubcategory

Subcategory of the pick

OutPickStartPose

Starting pose of the pick. Depending on the settings, the pose can be given in TCP or Tool0 coordinates (robot flange).

OutPickApproachPose

Approach pose of the pick. Depending on the settings, the pose can be given in TCP or Tool0 coordinates (robot flange).

OutPickGraspPose

Pick pose of the pick. Depending on the settings, the pose can be given in TCP or Tool0 coordinates (robot flange).

OutPickRetractPose

Retract pose of the pick. Depending on the settings, the pose can be given in TCP or Tool0 coordinates (robot flange).

OutPickFinalPose

Final pose of the pick. Depending on the settings, the pose can be given in TCP or Tool0 coordinates (robot flange).

Example sequence for select cells

The following example illustrates how a typical process unfolds in Mikado Select.

Example procedure for a select cell

#

SPS

Mikado

Capture

1

Set InCameraID

Setze InCmd = 20 (Capture)

2

Triggers image acquisition

End of the sequence: OutBusyBit = 0

Searching for objects and picks

3

Set InCameraID, InBoxID, InProductID, InGripperID, InRoiID, InPickSearchParametersID

Set InCmd = 21 (StartPickSearch)

4

Start searching for objects and picks

End of the sequence: OutBusyBit = 0

Read results

5

Set InBoxID, InProductID, InGripperID

Set InCmd = 22 (GetBestPick)

6

Reads the best available pick

Set return values; see GetBestPick

End of the sequence: OutBusyBit = 0

Updates of the fieldbus interface

Version 3.3.1

Commands 20 (Capture), 21 (StartPickSearch) and 22 (GetBestPick) have been added. These commands allow pick searches to be initiated directly via the fieldbus interface and their results to be read. This means, for example, that Mikado Select cells can be operated without necessarily requiring a Mikado program sequence.

As part of this, the default address assingment for both Mikado-Control and Mikado-Select has also been revised.

Version 3.3.0

A PROFINET configuration that has been officially certified by Siemens is now being shipped. This requires the use of a new Optonic GSDML file. A slightly modified TIA module is available for communication with Siemens PLCs, which incorporates this new GSDML file.

Existing cells are not updated automatically. The changes are not backwards compatible, and adjustments are required on both the Mikado and PLC sides. If necessary, you can switch between the older and the current configuration in the Mikado Assistant (see figure below; you may need to use “advanced mode” to display this option). For new cells, the newer Optonic configuration is automatically preselected from version 3.3.0 of the Mikado Assistant onwards. It is strongly recommended to retain this selection. The obsolete Hilscher configuration remains selectable solely for reasons of backward compatibility.

../../_images/assistant_profinet_options.png

I/O configuration for PROFINET: obsolete (red) and new (green) options

Version 3.1.2

Since mikado-profinet version 3.1.2 the package also supports the protocols EtherCAT and EtherNet/IP in addition to Profinet.

The protocol can be configured in Mikado Assistant on the fieldbus interface page.

Version 3.1.0

(mikado-profinet v3.1.0, mikado_io_beckhoff v3.1.0)

Note

If PLC-side value changes are made at program runtime (RunningBit = 1), unexpected behavior may occur with this version, as they are immediately visible to the program.

The new fieldbus adapter version brings the significant innovation that synchronized variables are constantly updated. In previous versions, variables had to be updated with the syncAll command. This change has the following consequences:

  • The user-defined live property of variables no longer applies because all variables are now “live”.

  • The syncAll command is superfluous and is therefore no longer listed in this documentation. The command can still be sent. The OutErrorCode returned in this case is NoError.

  • If PLC-side value changes are made at program runtime, unexpected behavior may occur.

The following table shows an example of how PLC-side changes can lead to unexpected behavior at an inopportune time. Assume a program is loaded in Mikado that calls the task Find Sceneobject, among others. The synchronized variable InBoxID is used as task input.

Example of PLC-side changes at an unfavorable time

Time

SPS

Mikado

Comment

\(t_1\)

Set InBoxID = 42
Set InCmd = 1 (start program)

PLC sets the variable InBoxID = 42 and sends start command

\(t_2\)

OutBusyBit = 1
OutRunningBit = 1
OutBusyBit = 0
Adapter executes command
Mikado starts program
Command execution completed

\(t_3\)

InBoxID = 0 (false)
InCmd = 0

This is an unfavorable time. Variables used in the program sequence should not be changed at runtime.

\(t_4\)

Program calls FindSceneObject (InBoxID)

Mikado has now arrived at the task call. The current InBoxID = 0 is used.

\(t_5\)

OutRunningBit = 0

End of program reached

\(t_6\)

InBoxID = 0 (correct)

The right time to reset variables.