UNPKG

rclnodejs

Version:
193 lines (167 loc) 4.99 kB
declare module 'rclnodejs' { /** * Middleware quality of service */ class QoS { /** * Create a QoS. * * @param history - The history value default = RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT * @param depth - The depth value, default = 0. * @param reliability - The reliability value, default = RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT * @param durability - The durability value, default = RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT * @param liveliness - The liveliness value, default = RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT * @param avoidRosNameSpaceConventions - The avoidRosNameSpaceConventions value, default = false. */ constructor( history?: QoS.HistoryPolicy, depth?: number, reliability?: QoS.ReliabilityPolicy, durability?: QoS.DurabilityPolicy, liveliness?: QoS.LivelinessPolicy, avoidRosNameSpaceConventions?: boolean ); /** * History value. */ history: number; /** * The depth value. */ depth: number; /** * Get the reliability value. */ reliability(): QoS.ReliabilityPolicy; /** * Get the durability value. */ durability: QoS.DurabilityPolicy; /** * Get the liveliness value. */ liveliness: QoS.LivelinessPolicy; /** * Get the avoidRosNameSpaceConventions value. */ avoidRosNameSpaceConventions: boolean; } namespace QoS { /** * Default profileref. */ export const profileDefault = 'qos_profile_default'; /** * Default system profileref. */ export const profileSystemDefault = 'qos_profile_system_default'; /** * Sensor data profileref. */ export const profileSensorData = 'qos_profile_sensor_data'; /** * Default services profileref. */ export const profileServicesDefault = 'qos_profile_services_default'; /** * Parameters profileref. */ export const profileParameters = 'qos_profile_parameters'; /** * The parameter events profileref. */ export const profileParameterEvents = 'qos_profile_parameter_events'; /** * The action status profileref. */ export const profileActionStatusDefault = 'qos_profile_action_status_default'; /** * A named policy reference. */ export type ProfileRef = string; /** * HistoryPolicy */ export enum HistoryPolicy { RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT = 0, RMW_QOS_POLICY_HISTORY_KEEP_LAST = 1, RMW_QOS_POLICY_HISTORY_KEEP_ALL = 2, } /** * ReliabilityPolicy */ export enum ReliabilityPolicy { RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT = 0, RMW_QOS_POLICY_RELIABILITY_RELIABLE = 1, RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT = 2, } /** * DurabilityPolicy */ enum DurabilityPolicy { RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT = 0, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL = 1, RMW_QOS_POLICY_DURABILITY_VOLATILE = 2, } /** * LivelinessPolicy */ enum LivelinessPolicy { RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT = 0, RMW_QOS_POLICY_LIVELINESS_AUTOMATIC = 1, RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC = 3, RMW_QOS_POLICY_LIVELINESS_UNKNOWN = 4, RMW_QOS_POLICY_LIVELINESS_BEST_AVAILABLE = 5, } } /** * Enum of overridable QoS policy kinds. */ enum QoSPolicyKind { HISTORY = 1, DEPTH = 2, RELIABILITY = 3, DURABILITY = 4, LIVELINESS = 5, AVOID_ROS_NAMESPACE_CONVENTIONS = 6, } /** * Options for overriding QoS policies via ROS parameters. * * When passed to `createPublisher()` or `createSubscription()`, the node * declares read-only parameters for each specified policy kind. These * parameters can be overridden at startup via `--ros-args -p` or `--params-file`. * * Parameter naming convention: * `qos_overrides.<topic>.<publisher|subscription>[_<entityId>].<policy>` */ class QoSOverridingOptions { /** * @param policyKinds - Which QoS policies to expose as parameters. * @param opts - Optional callback and entityId. */ constructor( policyKinds: QoSPolicyKind[], opts?: { callback?: (qos: QoS) => { successful: boolean; reason?: string }; entityId?: string; } ); /** Which QoS policies are exposed as parameters. */ readonly policyKinds: QoSPolicyKind[]; /** Optional validation callback. */ readonly callback: | ((qos: QoS) => { successful: boolean; reason?: string }) | null; /** Optional entity disambiguation suffix. */ readonly entityId: string | null; /** * Create options that override history, depth, and reliability. */ static withDefaultPolicies(opts?: { callback?: (qos: QoS) => { successful: boolean; reason?: string }; entityId?: string; }): QoSOverridingOptions; } }