import { HardwareDescription } from './hardware-description'; /** * Represents a detailed error related to an encoder register. */ export interface EncoderRegisterError { /** * A short, human-readable name for the error. */ name: string; /** * A brief error code or message identifying the error type. */ error: string; /** * A concise description of the error condition. */ description: string; /** * Suggested actions or steps to resolve or remediate the error. */ remedy: string; /** * A comprehensive explanation of the error, including context and details. */ fullDescription: string; } /** * Enum of Circulo encoder register addresses. * * These constants represent the addresses of various encoder registers * used for status monitoring and data reading. */ export declare enum CirculoEncoderRegisterAddress { STATUS0 = 118, STATUS1 = 119, OUT_ZERO_OUT_MSB = 17 } /** * Lookup table mapping encoder register error bits to detailed error information. * * Each element in the array corresponds to a specific encoder status register (e.g., STATUS0, STATUS1), * identified by its index. Within each object, the keys represent bit flags (powers of two) indicating * specific error conditions. The associated value is an `EncoderRegisterError` object describing * the error, its cause, and suggested remedy. * * Example usage: * ```ts * const errorsForStatus0 = circuloEncoderRegisterErrors[0][1]; // Gets the error for bit 1 of STATUS0 * ``` */ export declare const circuloEncoderRegisterErrors: { [key: number]: EncoderRegisterError; }[]; /** * Maps a status register value to a list of corresponding encoder register errors. * * This function interprets each set bit in the given 8-bit `value` as an individual error flag. * It then looks up the corresponding `EncoderRegisterError` definitions from a predefined * error mapping (`circuloEncoderRegisterErrors`) based on the provided `statusIndex`. * * @param value - The 8-bit value read from the encoder's status register (typically 0–255). * @param statusIndex - The index of the status register (0 or 1), usually corresponding to * `CirculoEncoderRegisterAddress.STATUS0` or `STATUS1`. * @returns An array of `EncoderRegisterError` objects for each set error bit in the status value. * Returns an empty array if no error bits are set or no matching definitions are found. */ export declare function mapCirculoEncoderRegisterValueToErrors(value: number, statusIndex: 0 | 1): EncoderRegisterError[]; /** * Represents the configuration parameters of a Circulo encoder's battery mode. */ export interface CirculoEncoderBatteryMode { maxAcceleration: number; maxCurrent: number; value: number; } /** * Maps product groups to their supported battery modes for Circulo encoders. * * Each product group key (e.g., `'Circulo 7'`, `'Circulo 9'`) maps to an array of * `CirculoEncoderBatteryMode` objects, each describing a specific battery mode configuration. * * Battery modes specify constraints such as maximum acceleration and current, * along with a raw encoded `value` representing the mode setting. */ export declare const circuloEncoderBatteryModeMap: Map<"Node 400" | "Node 1000" | "Node 2000" | "Circulo 7" | "Circulo 9" | "Circulo NG 60" | "Circulo NG 70" | "Circulo NG 80" | "Circulo NG 85" | "Circulo NG 100" | "Integro 60" | "Integro 80" | "ACTILINK-S Integro 60" | "ACTILINK-S Integro 80" | "ACTILINK-JD 8" | "ACTILINK-JD 9" | "ACTILINK-JD 10" | "ACTILINK-JD 12" | "ACTILINK-JD Duo 10" | "ACTILINK-JD Duo 12", CirculoEncoderBatteryMode[]>; /** * Represents the possible types of encoder shafts. */ export type EncoderShaft = 'motor' | 'driving'; /** * Returns the default battery mode encoded value for a given encoder shaft type. * * @param shaft - The type of encoder shaft. Can be `'motor'` or `'driving'`. * If omitted or unrecognized, returns a default fallback value. * @returns The encoded default battery mode value corresponding to the shaft type: * - `0x5d` for `'motor'` * - `0x68` for `'driving'` * - `0x00` if the shaft type is not specified or unknown */ export declare function getCirculoEncoderBatteryModeDefaultValue(shaft?: 'motor' | 'driving'): 0 | 93 | 104; /** * Retrieves the available battery mode options for a Circulo encoder product. * * This function identifies the product by its ID or hardware description and, if the product * belongs to the 'Circulo' family, returns an array of battery mode options specific to the product group. * Each option consists of a human-readable key describing the mode and its corresponding encoded value. * * The returned array always includes a "Default" option based on the provided shaft type. * * @param productId - The identifier of the product. Can be a number, string, or a `HardwareDescription` object. * @param shaft - Optional encoder shaft type (`'motor'` or `'driving'`) used to determine the default battery mode. * @returns An array of battery mode options with keys describing the mode and their associated encoded values. * Returns an empty array if the product is not part of the Circulo family or no modes are found. */ export declare function getCirculoEncoderBatteryModeOptions(productId: number | string | HardwareDescription, shaft?: EncoderShaft): { key: string; value: number; }[]; export type EncoderConfigurationSubitemSetBy = 'none' | 'user' | 'firmware' | 'both'; export type EncoderConfigurationExceptionCase = 'case1' | 'case2' | 'case3' | 'case4'; /** * Represents the usage of encoder configurations across different firmware versions and products. * * This interface defines which subitems are available for each supported encoder type, * and specifies whether each subitem is set by the user, the firmware, or both. * It also maps these configurations to the relevant products and ports. * * The structure originates from the following documents: * - Encoder Configuration Types Supported * - Encoder configuration 0x2110/0x2112 subindex usage (default) * - Encoder configuration 0x2110/0x2112 subindex usage (exceptions) */ export interface EncoderConfigurationUsage { [key: string]: { encoderConfiguration: { encoderType: { [key: number]: { subitem: { [key: number]: { setBy: EncoderConfigurationSubitemSetBy; }; }; }; }; exceptions: { [key in EncoderConfigurationExceptionCase]: { subitem: { [key: number]: { setBy: EncoderConfigurationSubitemSetBy; }; }; }; }; }; product: { [key: string]: { port: { [key: number]: { allowedEncoderTypes: number[]; }; }; }; }; }; } /** * Selects the encoder configuration exception case based on the encoder ordinal, type, and product ID * * A Jasper drive is always case 4, whatever its product ID, encoder port and encoder type, so the firmware * version is checked first and on its own. * * @param productId - The product ID to check against. * @param encoderPort - The encoder port to check. * @param encoderType - The encoder type to check. * @param firmwareMajorMinorVersion - The firmware version in major.minor format. * @returns The selected exception case or undefined if no case matches. * @link https://docs.google.com/spreadsheets/d/1E0HTiZQtGmby2BJ9kOGV0UwD3HT6xQ7QRLjNbXpx5V0/edit?usp=sharing */ export declare function getEncoderConfigurationExceptionCase(productId: number | string | HardwareDescription | null, encoderPort: number, encoderType: number, firmwareMajorMinorVersion: string): EncoderConfigurationExceptionCase | undefined; /** * Computes the encoder resolution in bits from the total number of increments per revolution. * * The resolution in bits is calculated as the ceiling of the base-2 logarithm * of the number of increments, which represents the minimum number of bits * needed to uniquely represent each encoder position. * * @param increments - Total number of increments (counts) per revolution. * @returns The encoder resolution in bits. */ export declare function getEncoderResolutionBits(increments: number): number;