import { RequestStatus } from './types'; import { DataType } from 'python-struct'; import { ModesOfOperation } from './cia402'; /** * Type guard to determine if the provided value is a OS Command Response object. */ export declare function isOsCommandResponse(value: any): value is OsCommandResponse; export interface OsCommandResponse { /** * The command that was sent to the device through the 0x1023:01 OS Command. */ command?: Uint8Array; /** * Array of numbers representing the received data. * * The length of data depends on the response type. * If the response number is 3 (Command completed with error and with response), * the length can be up to 5 numbers; otherwise, it can be up to 6 numbers. */ data?: number[]; /** * The error code is only set when the response number is 3 (Command completed with error and with response). * * The meaning of the error code can be general or command specific. * General error codes start at 254 and go downwards: * - 254: Unsupported command * - 253: Command timeout * - 252: Command aborted * - 251: Command not allowed * OS command specific error codes start at 0 and go upwards. */ errorCode?: number; /** * The error name is derived from the OS command number and error code number. */ errorName?: string; /** * The error description is derived from the OS command number and error code number. * The purpose of the error description is to provide more information about the error than the name can. */ errorDescription?: string; /** * Stores the content of the fs-buffer file if accessed during the execution of the OS command. */ fsBuffer?: Uint8Array | number[] | null | undefined; /** * Reported progress during the OS command execution. * * The progress can be in the range from 0 to 100 and is computed from the command status. * A status value between 100 and 200 indicates that the command is executing with a percentage (100 = 0%, 200 = 100%). */ progress?: number; /** * Status of the request. */ request: RequestStatus; /** * Raw response as sent by the device. */ response: Uint8Array; } export declare function parseOsCommandResponse(response: Uint8Array, command?: Uint8Array): OsCommandResponse; export declare enum OsCommandMode { EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY = 0, ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER = 3 } /** * Outcome of aborting the OS command in progress. * * See {@link MotionMasterReqResClient#abortOsCommand}. */ export interface OsCommandAbortResult { /** * `succeeded` when the drive no longer reports a command in progress, `failed` when the command was * still running once the timeout elapsed. The OS command mode is reset to * {@link OsCommandMode.EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY} in both cases. */ request: RequestStatus; /** * Whether a command was in progress when the abort was requested. When `false`, the abort was a no-op * for the drive, and the reported `last*` properties belong to the previously completed command, if any. */ wasInProgress: boolean; /** * Raw status byte (0x1023:03 Byte 0) of the last response read from the drive. * * An aborted command typically reports 3 (command completed with error and with response) together with * `lastErrorCode` 252 (command aborted). */ lastStatus?: number; /** * OS error code of the last response read from the drive; see {@link OsCommandResponse#errorCode}. */ lastErrorCode?: number; /** * Name of {@link OsCommandAbortResult#lastErrorCode}, when known. */ lastErrorName?: string; /** * Set when the command was still in progress once the timeout elapsed. */ timeout?: boolean; } export declare enum OsCommandId { CUSTOM_OS_COMMAND = -1, ENCODER_REGISTER_COMMUNICATION = 0, ICMU_CALIBRATION_MODE = 1, OPEN_LOOP_FIELD_MODE = 2, HRD_STREAMING = 3, MOTOR_PHASE_ORDER_DETECTION = 4, COMMUTATION_OFFSET_MEASUREMENT = 5, OPEN_PHASE_DETECTION = 6, POLE_PAIR_DETECTION = 7, PHASE_RESISTANCE_MEASUREMENT = 8, PHASE_INDUCTANCE_MEASUREMENT = 9, TORQUE_CONSTANT_MEASUREMENT = 10, SMM_ACYCLIC_HANDLER = 11, SKIPPED_CYCLED_COUNTER = 13, IGNORE_BISS_STATUS_BITS = 14, SYSTEM_IDENTIFICATION = 15, TRIGGER_ERROR = 16, KUBLER_ENCODER_COMMAND = 17, USE_INTERNAL_ENCODER_VELOCITY = 18, KUBLER_ENCODER_REGISTER_COMMUNICATION = 19 } export type OsCommandErrors = { [key: number]: { errorName: string; errorDescription: string; }; }; export interface OsCommandSubcommand { id: T; name: string; } export declare enum SmmAcyclicHandlerSubcommandId { PARAMETER_DOWNLOAD_LOGIN = 1, TRANSMIT_PARAMETERS = 2, LOAD_PARAMETERS_FOR_VERIFICATION = 3, VERIFY_PARAMETERS = 4, LOAD_VALIDATION_FILE = 5, VALIDATE_CONFIGURATION = 6, CHANGE_PASSWORD = 7, LOGOUT = 8, SOFTWARE_UPDATE_LOGIN = 9, CONFIGURE_SOFTWARE_UPDATE = 10, TRANSMIT_SOFTWARE = 11, FINALIZE_SOFTWARE_UPDATE = 12, READ_SMM_PARAMETER = 13, IO_FAILURE_ACKNOWLEDGE = 14, TRIGGER_RESTART = 15 } export declare const osCommandErrorCode: { [key: number]: string; }; export declare function createOsCommandTypedArray(elements: number[]): Uint8Array; /** * OS command 0: Encoder register communication * * This OS command is utilized for reading or writing registers from an encoder service. * Presently, the only service supporting this functionality is BiSS, but it can be easily extended to other encoder services. * For more information on how BiSS register communication operates, please consult the official BiSS C Interface Protocol Description. * * | | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | * |--------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| * | Byte 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | * | Byte 1 | - | - | - | - | - | A | A | A | * | Byte 2 | B | B | B | B | B | B | B | C | * | Byte 3 | D | D | D | D | D | D | D | D | * | Byte 4 | E | E | E | E | E | E | E | E | * | Byte 5 | - | - | - | - | - | - | - | - | * | Byte 6 | - | - | - | - | - | - | - | - | * | Byte 7 | - | - | - | - | - | - | - | - | * * @param encoderOrdinal (A) 2^3=8 encoder ordinals. Counting starts from 1, so '1' refers to Encoder 1 configured in 0x2110. * @param slaveAddress (B) 2^7=128 slave addresses. Select the address of the slave to read (BiSS protocol level). Since our BiSS service doesn't support multiple slaves in the same device, this value should always be 0. * @param rw (C) Read or write the encoder register. Select the direction of the command: 0 for reading a register, and 1 for writing it. * @param registerAddress (D) Register to be read/written. * @param registerWriteValue (E) The value to write to the register. This value is ignored when reading a register (when rw is set to 0). */ export declare function createEncoderRegisterCommunicationOsCommand(encoderOrdinal?: number, slaveAddress?: number, rw?: number, registerAddress?: number, registerWriteValue?: number): Uint8Array; export interface EncoderRegisterCommunicationOsCommandResponse extends OsCommandResponse { registerValue?: number; } /** * OS command 1: iC-MU calibration mode * * This command is used to set a particular BiSS mode when using an iC-MU encoder, which is primarily employed for iC-MU calibration. * * The supported modes are explained below: * * **Configuration mode**: The BiSS service clocks the encoder normally, but it only utilizes the bits for register communication and discards the rest, * thereby not updating the encoder data. * This also implies that the BisCrc error is not triggered while in this mode. * This mode is intended to allow the user to change the configuration in the encoder BiSS registers without encountering a BisCrc error. * * **Raw mode**: The BiSS service clocks the encoder assuming it was correctly configured for raw mode. * It continues to calculate all the encoder data, but additionally, it averages the raw data and makes it available in 0x2704 User MISO, as follows: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
313029282726252423222120191817161514131211109876543210
0Nonius countMaster count
* * This data can also be read by using OS command 3. * * **Standard mode**: The BiSS service clocks the encoder normally. * * When transitioning from any mode to Configuration mode, the current position is saved. * If we subsequently switch to Raw mode, this saved position serves as the starting point for position calculation because the raw data is relative. * Therefore, the motor should not be moved while in Configuration mode if there are plans to switch to Raw mode afterward. * * @param encoderOrdinal (A) 2^3=8 encoder ordinals. Counting starts from 1, so '1' refers to Encoder 1 configured in 0x2110. * @param modeEnable: Select the iC-MU calibration mode. Configuration mode is 0, raw mode is 1, and standard mode is 2. */ export declare function createIcMuCalibrationModeOsCommand(encoderOrdinal?: number, modeEnable?: number): Uint8Array; export interface IcMuCalibrationModeOsCommandResponse extends OsCommandResponse { calibrationModeSet?: boolean; } export declare function createOpenLoopFieldModeOsCommand(parameterIndex?: number, parameterValue?: number): Uint8Array; export declare const openLoopFieldModeParameters: { parameterIndex: number; parameterName: string; }[]; export interface OpenLoopFieldModeOsCommandResponse extends OsCommandResponse { openLoopFieldMode?: boolean; } /** * Enum for selecting the action to perform in HRD streaming. */ export declare enum HrdStreamingOsCommandAction { /** * Deletes all previous HRD files from the filesystem. * The user then configures the stream duration and the variable to stream. * File deletion may take up to approximately 5 seconds in the worst-case scenario. */ CONFIGURE_STREAM = 0, /** * Starts the stream using the previously configured settings. */ START_STREAM = 1 } /** * Enum for selecting the data to stream. * * This value is used only when the selected Action is Configure Stream (0). */ export declare enum HrdStreamingOsCommandDataIndex { /** * Record raw encoder data. * * The encoder must be set up first using OS command 1. */ ENCODER_RAW_DATA = 0, /** * Record system identification data. * * The identification procedure must be configured with OS command 15 and started before recording. */ SYSTEM_IDENTIFICATION_DATA = 1 } export declare function createHrdStreamingOsCommand(action?: HrdStreamingOsCommandAction, dataIndex?: HrdStreamingOsCommandDataIndex, duration?: number): Uint8Array; export interface HrdStreamingOsCommandResponse extends OsCommandResponse { hrdStreamingComplete: true; } export declare const hrdStreamingOsCommandErrors: OsCommandErrors; /** * Parses a binary HRD data buffer into an array of velocity/torque samples. * * Each sample in the buffer consists of: * - 4 bytes: velocity (signed 32-bit integer, little-endian, Q15 fixed-point format) * - 2 bytes: torque (signed 16-bit integer, little-endian) * * The function iterates through the buffer in 6-byte chunks, extracting * velocity and torque for each sample. The velocity is converted from * Q15 fixed-point format to a floating-point number and **rounded to an integer**. * * Each returned sample is a tuple of the form: * `[velocityQ15, torque, velocity]`, where: * - `velocityQ15` is the original 32-bit Q15 integer from the buffer * - `torque` is the 16-bit signed integer from the buffer * - `velocity` is the floating-point velocity value converted from Q15 and rounded to an integer * * If the buffer length is not a multiple of 6, a warning is logged and any trailing bytes are discarded. * * @param data - A `Uint8Array` containing raw HRD binary data. * @returns An array of `[velocityQ15, torque, velocity]` tuples one per sample. */ export declare function parseHrdBuffer(data: Uint8Array): number[][]; /** * Converts a 2D array of HRD (High Resolution Data) samples into a CSV-formatted string. * * @param samples - A two-dimensional array where each inner array represents a single sample * in the format `[velocityQ15, torque, velocity]`. * @returns A CSV string with a header row and one row per sample. * Returns an empty string if no samples are provided. * * @example * ```ts * const samples = [ * [12345, 1.23, 100.5], * [12346, 1.20, 101.2] * ]; * * const csv = convertHrdSamplesToCsv(samples); * // "HRD Velocity (Q15),HRD Torque [‰],HRD Velocity [RPM]\n12345,1.23,100.5\n12346,1.20,101.2\n" * ``` * * @remarks * - The CSV header is fixed as: `"HRD Velocity (Q15),HRD Torque [‰],HRD Velocity [RPM]"`. * - Each sample is written on a new line, with comma-separated values. */ export declare function convertHrdSamplesToCsv(samples: number[][]): string; /** * Command 4: Motor phase order detection * * This command is used to detect the order of the motor phases. * When this command finishes successfully, the found value is automatically written to the object 0x2003:5 Motor phases inverted. * This command rotates the motor. * * This OS command has no arguments. * * When the command finishes successfully, it will return a value of 0 for normal and 1 for inverted motor phases. * * This command doesn't have any command-specific OS error code, so this status will only happen when a general OS error code occurs. * * This command will report its progress without indicating a percentage. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, there is no active limit switch, * and the brake status is disengaged (in case there is a configured brake). If any of these conditions is not true during the execution of the command, * the execution will stop, and it will return the OS error code 251 (command not allowed). */ export declare function createMotorPhaseOrderDetectionOsCommand(): Uint8Array; export interface MotorPhaseOrderDetectionOsCommandResponse extends OsCommandResponse { motorPhaseOrder?: number; } /** * Command 5: Commutation offset measurement * * This command is used to measure the commutation angle offset. * The configuration of the procedure is derived from the pre-existing and previously used commutation offset objects in the object dictionary. * Upon successful completion of this command, the determined value is automatically written to: * - 0x2001:00 Commutation angle offset * - 0x2009:01 State is set to OFFSET_VALID * * In version 5.0, three different methods can be selected for command 5. These methods are named: * - Commutation offset measurement - method 0 * - Commutation offset measurement - method 1 * - Commutation offset measurement - method 2 * Among these three methods, "method 0" and "method 1" involve rotating the rotor. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS) and the CIA402 state is Operation enabled. * Additionally, if the commutation offset measurement method (0x2009:3) is set to 0 or 1, * the command is permissible only when there are no active limit switches, and the brake status is disengaged (in case a brake is configured). * If any of these conditions is not met during the execution of the command, the execution will be halted, * and it will return the OS error code 251 (Command not allowed). */ export declare function createCommutationOffsetMeasurementOsCommand(): Uint8Array; export interface CommutationOffsetMeasurementOsCommandResponse extends OsCommandResponse { commutationAngleOffset?: number; } /** * Command 6: Open phase detection * * This command is used to detect whether one of the phases is open. * It might rotate the motor if there is no brake or if it is disengaged. * * If this command finishes successfully, it indicates that all motor phases seem to be fine. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, * and there is no limit switch active. If any of these conditions is not true during the execution of the command, * the execution will stop, and it will return the OS error code 251 (Command not allowed). */ export declare function createOpenPhaseDetectionOsCommand(): Uint8Array; export interface OpenPhaseDetectionOsCommandResponse extends OsCommandResponse { phaseOpened?: boolean; } export declare const openPhaseDetectionErrors: OsCommandErrors; /** * Command 7: Pole pair detection * * This command is used to detect the number of pole pairs that the connected motor has. * It requires the rotation of the rotor. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, * and there is no limit switch active. If any of these conditions is not true during the execution of the command, * the execution will stop, and it will return the OS error code 251 (Command not allowed). */ export declare function createPolePairDetectionOsCommand(): Uint8Array; export interface PolePairDetectionOsCommandResponse extends OsCommandResponse { numberOfPolePairs?: number; } /** * Command 8: Phase resistance measurement * * This command is used to measure the phase resistance of the motor in milliohms (mΩ). * It might rotate the motor if there is no brake or if it is disengaged. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, * and there is no limit switch active. If any of these conditions is not true during the execution of the command, * the execution will stop, and it will return the OS error code 251 (Command not allowed). */ export declare function createPhaseResistanceMeasurementOsCommand(): Uint8Array; export interface PhaseResistanceMeasurementOsCommandResponse extends OsCommandResponse { phaseResistance?: number; } /** * Command 9: Phase inductance measurement * * This command is used to measure the phase inductance of the motor in microhenries (μH). * It might rotate the motor if there is no brake or if it is disengaged. * * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, * and there is no limit switch active. If any of these conditions is not true during the execution of the command, * the execution will stop, and it will return the OS error code 251 (Command not allowed). */ export declare function createPhaseInductanceMeasurementOsCommand(): Uint8Array; export interface PhaseInductanceMeasurementOsCommandResponse extends OsCommandResponse { phaseInductance?: number; } export declare function createTorqueConstantMeasurementOsCommand(): Uint8Array; export interface TorqueConstantMeasurementOsCommandResponse extends OsCommandResponse { torqueConstant: number; } export declare function createSmmAcyclicHandlerOsCommand(subcommandId: SmmAcyclicHandlerSubcommandId): Uint8Array; export declare function createSmmAcyclicHandlerReadSmmParameterOsCommand(index: number, subindex?: number): Uint8Array; export declare function createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand(fileSize: number): Uint8Array; export interface SmmAcyclicHandlerOsCommandResponse extends OsCommandResponse { parameterValueUpdated?: boolean; } export interface SmmAcyclicHandlerLoadParametersForVerificationOsCommandResponse extends OsCommandResponse { values: DataType[]; } export declare function createSkippedCyclesCounterOsCommand(firmwareService?: number): Uint8Array; export interface SkippedCyclesCounterOsCommandResponse extends OsCommandResponse { skippedCycles: number; } export declare function createIgnoreBissStatusBitsOsCommand(trigger?: number, encoderOrdinal?: number): Uint8Array; export interface IgnoreBissStatusBitsOsCommandResponse extends OsCommandResponse { ignoringBissStatusBits: boolean; } export declare function createSystemIdentificationOsCommand(parameterIndex?: number, parameterValue?: number): Uint8Array; export declare enum SystemIdentificationOsCommandSignalType { LOGARITHMIC_WITH_AMPLITUDE_MODULATION = 0, LINEAR_WITH_CONSTANT_AMPLITUDE = 1 } export declare enum SystemIdentificationOsCommandStartProcedure { NO_ACTION = 0, IMMEDIATELLY = 1, WAIT_FOR_HRD_STREAMING_TO_START = 2 } /** * Defines the parameters used to execute a chirp signal on a device. * * A chirp signal is a frequency sweep that transitions linearly from a * starting frequency to a target frequency over a specified time period, * with a defined amplitude. These options control how the chirp signal * is generated and executed. */ export type ChirpSignalOptions = { /** * Duration of high-rate data streaming (in milliseconds) that runs in parallel * with the chirp excitation. This streaming window is used to collect * high-resolution measurement data required for plant model computation. */ hrdStreamingDuration: number; /** * Modes of operation to set before starting the chirp signal procedure. * If not provided, the current modes of operation will be used. * * Sets the value of 0x6060: Modes of operation before starting the procedure. */ modesOfOperation?: ModesOfOperation; /** * Type of chirp signal to be used. * * This is parameter number 4 in the system identification OS command. */ signalType: SystemIdentificationOsCommandSignalType; /** * Start frequency of the chirp signal, in millihertz (mHz). * * This is parameter number 0 in the system identification OS command. */ startFrequency: number; /** * When to start the chirp signal procedure. * * This is parameter number 5 in the system identification OS command. */ startProcedure: SystemIdentificationOsCommandStartProcedure; /** * Target amplitude of the chirp signal, expressed in permils (‰) * of the rated torque. * * This is parameter number 2 in the system identification OS command. */ targetAmplitude: number; /** * Target frequency of the chirp signal, in millihertz (mHz). * * This is parameter number 1 in the system identification OS command. */ targetFrequency: number; /** * Duration of the frequency sweep, in milliseconds (ms), * representing the transition time from start to target frequency. * * This is parameter number 3 in the system identification OS command. */ transitionTime: number; }; export declare const systemIdentificationParameters: { parameterIndex: number; parameterName: string; }[]; export interface SystemIdentificationOsCommandResponse extends OsCommandResponse { systemIdentificationCompleted?: boolean; } export declare function createTriggerErrorOsCommand(firmwareService?: number, errorType?: number): Uint8Array; export interface TriggerErrorOsCommandResponse extends OsCommandResponse { errorSet: boolean; } export declare const triggerErrorTypes: { value: number; name: string; }[]; export declare enum KublerEncoderSubcommandId { WRITE_CORRECTION_TABLE = 0, SEND_SCPI_COMMAND = 1, SWITCH_TO_BOOTLOADER_FIRMWARE = 2, CHECK_FIRMWARE_UPDATE_SIZE = 3, ERASE_FIRMWARE = 4, WRITE_FIRMWARE = 5, EXIT_BOOTLOADER_MODE = 6, READ_CORRECTION_TABLE = 7 } export declare function createKublerEncoderOsCommand(subcommandId: KublerEncoderSubcommandId): Uint8Array; export declare function createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand(firmwareSize: number): Uint8Array; export declare function createKublerEncoderCommandWriteFirmwareOsCommand(firmwareSize: number): Uint8Array; export interface KublerEncoderCommandOsCommandResponse extends OsCommandResponse { numberOfBytesWritten?: number; responseInFoeBuffer?: boolean; } export declare const kublerEncoderCommandOsCommandErrors: OsCommandErrors; export declare function createUseInternalEncoderVelocityOsCommand(trigger?: number): Uint8Array; export interface UseInternalEncoderVelocityOsCommandResponse extends OsCommandResponse { usingInternalEncoderVelocity: boolean; } export declare function createKublerEncoderRegisterCommunicationOsCommand(rw?: number, registerAddress?: number, registerLength?: number, registerWriteValue?: number): Uint8Array; export interface KublerEncoderRegisterCommunicationOsCommandResponse extends OsCommandResponse { kublerRegisterValue: number; } export declare const kublerEncoderRegisterCommunicationReadOsCommandErrors: OsCommandErrors; export declare const kublerEncoderRegisterCommunicationWriteOsCommandErrors: OsCommandErrors; export declare const kublerEncoderRegisterValueMeaning: { [register: string]: { [value: string]: string; }; }; export interface OsCommand { id: OsCommandId; name: string; } export declare const osCommands: OsCommand[]; export declare const smmAcyclicHandlerSubcommands: OsCommandSubcommand[]; export declare const kublerEncoderSubcommands: OsCommandSubcommand[]; /** * Maps an OS command response to a specific object, effectively adding more * properties to the response object, such as the computed commutation angle offset. */ export declare function mapOsCommandResponse(): import("rxjs").UnaryFunction, import("rxjs").Observable>;