Skip to content

Latest commit

 

History

History
181 lines (123 loc) · 8.86 KB

File metadata and controls

181 lines (123 loc) · 8.86 KB

AxoKrc4

KUKA KRC4 industrial robot controller proxy

AxoKrc4 (namespace AXOpen.Components.Kuka.Robotics.v_5_x_x) is the controller proxy for robots driven by a KUKA KRC4 controller. It extends AXOpen.Core.AxoComponent and implements AXOpen.Components.Abstractions.Robotics.IAxoRobotics, exposing all programme and motion commands as AxoTask instances that advance their state machine inside the component's Run() call.

KRC5 has an equivalent proxy — see AxoKrc5. The two classes share an identical public API (same task surface, same Config/Status/IO layout, same error catalogue) and the same AXOpen slot layout: slot 1 reserved (empty), slot 2 = DIO512 with 64-byte cyclic I/O. Only the vendor GSDML and PROFINET device template differ between them.

Capabilities

  • Programme control — StartAtMain, StartProgram, StopProgram, StartMotorsAndProgram, StopMovementsAndProgram.
  • Motor control — StartMotors, StopMotors.
  • Motion commands — StartMovements(movementParams), StopMovements, and a combined StartMotorsProgramAndMovements(movementParams).
  • Safety-interlocked task execution — every task checks Inputs.Manual, Inputs.Automatic, Inputs.AlarmStopActive, Inputs.UserSafetySwitchClosed, and Inputs.Error while busy (error IDs 20001–20005).
  • Hardware wiring — consumes a PROFINET device identifier; the Run() method auto-resolves the child slot layout (slot 1 safety-module = empty, slot 2 = 512 DI / 512 DO) via ReadSlotFromHardwareID and ReadHardwareIOAddress during first cycle.
  • Cyclic I/O transfer — Siemens.Simatic.DistributedIO.ReadData/WriteData on slot 2 each cycle (error IDs 1201 / 1231 on transport failure).
  • Tool / area / position / coordinate outputs driven from MovementParameters.
  • Hardware diagnostics task (HardwareDiagnosticsTask) and two on-delay info/error timers (Config.InfoTime, Config.ErrorTime, Config.TaskTimeout).

Configuration

The component is configured via the nested Config : AxoKrc4_Config member. Adjust these before invoking Run(); they can also be set from the commissioning UI.

Parameter Type Default Purpose
Config.InfoTime LTIME LT#2S Delay before a task publishes a potential (waiting-for-signal) message. Controls how long the component waits silently on an expected input before surfacing progress via TaskMessenger.
Config.ErrorTime LTIME LT#5S Delay before _errorTimer.output throws the currently-executing task. Acts as a per-step watchdog on KRC4 responses.
Config.TaskTimeout LTIME LT#50S Hard upper bound for a task's total duration. 0s disables the timeout (used in the showcase so commissioning demos never self-abort).
Config.HWIDs AxoKrc4_HWIDs Device hardware identifiers, auto-populated on first Run() from the hwID argument and the slot layout.

[!code-smalltalk]

[!code-smalltalk]

Declare component

[!code-pascal]

Declare initialization variables

Most of the initialization variables come from the I/O system. The example below is for demonstration purposes.

[!code-pascal]

Initialize & Run

[!code-pascal]

[!INCLUDE IntializeAndRun]

Use

[!code-pascal]

Source

View the library source at AxoKrc4.st.

The .NET twin for AxoKrc4 is generated by ixc from the ST source and extended by AxoKrc4.cs (partial class) under src/AXOpen.Components.Kuka.Robotics/AxoKrc4/v_5_x_x/. The partial wires the runtime messenger dictionaries (InitializeMessenger, InitializeTaskMessenger) and exposes ErrorDescription / ActionDescription helpers on AxoKrc4_Component_Status so the HMI can render the active step.

Source

View the .NET twin source at AXOpen.Components.Kuka.Robotics/AxoKrc4.

AxoKrc4 ships a dedicated Blazor view (AxoKrc4View.razor) inside AXOpen.Components.Kuka.Robotics.blazor. When RenderableContentControl inspects an AxoKrc4 context, it picks this view automatically based on the Presentation attribute. Operator commands are grouped into two tabs — Movements (Start/Stop Movements, Restore, Reset All Outputs, with movement parameters inline) and Power & Program (motor and programme tasks) — laid out as a uniform 2-column grid. If you prefer the generic AxoComponent rendering, use RenderableContentControl directly.

Status display

[!code-html]

Command control

[!code-html]

Type-agnostic status view

[!code-html]

Type-agnostic command view

[!code-html]

Available Presentation values: Status-Display, Command-Control, Service-Control, Spot, Compact.

Source

View the Blazor view at AxoKrc4View.razor.

Library-shipped assets

The raw GSDML and matching PROFINET device template for KRC4 live inside the library package so AxoKrc4 can be wired up without fetching files from the vendor:

The showcase copies the template into showcase/app/hwc/library_templates/kuka_krc4/ so application builds do not need a catalog round-trip.

Device template

PROFINET hardware template at showcase/app/hwc/library_templates/kuka_krc4/kuka_krc4_dio512.hwl.yml.

The template provisions a KRC4 as a PROFINET device with two slots:

Slot Module Purpose
1 (safety module, left empty by the template) Reserved — AxoKrc4.Run() verifies this slot resolves to HwID_None = 0.
2 512_DI_DO 64-byte in / 64-byte out PROFINET I/O cyclically transferred by the component.

I/O mapping

Run() takes a single hwID : UINT that identifies the KRC4 device in the configured hardware layout. The component then:

  1. Calls ReadSlotFromHardwareID(hwID) to obtain the device's geographic address.
  2. Reads the hardware ID of slot 1 and asserts it is 0 (no safety module wired — error 710 otherwise).
  3. Reads the hardware ID of slot 2 (the 512 DI / 512 DO module) and caches it in Config.HWIDs.HwID_512_DI_DO.
  4. Calls ReadHardwareIOAddress on slot 2 and asserts it exposes exactly 64 input and 64 output bytes (error 726 otherwise).
  5. Each cycle thereafter: Siemens.Simatic.DistributedIO.ReadData / WriteData transfer the 64-byte blocks bound to Inputs / Outputs.

Use the AXOpen.Showcase.HwIdentifiers#{device}_HwID constants to supply hwID from application code (as the showcase does with kuka_rb1_HwID for the KRC4 instance).

KRC4 device instantiation

[!code-yaml]

KRC4 IO system wiring

[!code-yaml]