當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript schemas.TypedMessage類代碼示例

本文整理匯總了TypeScript中@lakemaps/schemas.TypedMessage的典型用法代碼示例。如果您正苦於以下問題:TypeScript TypedMessage類的具體用法?TypeScript TypedMessage怎麽用?TypeScript TypedMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TypedMessage類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: decode

    static decode(buf: Buffer): BoatConfig {
        const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
        const obj = TypedMessage.deserializeBinary(bytes).getBoatConfig();
        if (obj === null) {
            throw new Error(`Missing BoatConfig field`);
        }

        const surgeControllerGains = obj.getSurgeControllerGains();
        const surgeTimeStep = obj.getSurgeControllerDt();
        const yawControllerGains = obj.getYawControllerGains();
        const yawTimeStep = obj.getYawControllerDt();
        return new BoatConfig(
            new PidControllerGains(
                surgeControllerGains.getKp(),
                surgeControllerGains.getKi(),
                surgeControllerGains.getKd(),
            ),
            surgeTimeStep,
            new PidControllerGains(
                yawControllerGains.getKp(),
                yawControllerGains.getKi(),
                yawControllerGains.getKd(),
            ),
            yawTimeStep,
        );
    }
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:26,代碼來源:BoatConfig.ts

示例2: decode

    static decode(buf: Buffer): MissionInformation {
        const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
        const obj = TypedMessage.deserializeBinary(bytes).getMissionInformation();
        if (obj === null) {
            throw new Error(`Missing MissionInformation field`);
        }

        return new MissionInformation(obj.getDistanceToWaypoint());
    }
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:9,代碼來源:MissionInformation.ts

示例3: decode

 static decode(buf: Buffer): Motion {
     const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
     const obj = TypedMessage.deserializeBinary(bytes).getMotion();
     return Motion.fromMessage(obj);
 }
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:5,代碼來源:Motion.ts

示例4: decode

 static decode(buf: Buffer): TypedMessage {
     const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
     const obj = TypedMessageProtobuf.deserializeBinary(bytes);
     return new TypedMessage(obj.getType());
 }
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:5,代碼來源:TypedMessage.ts

示例5: decode

 static decode(buf: Buffer): Waypoint {
     const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
     return Waypoint.fromMessage(TypedMessage.deserializeBinary(bytes).getWaypoint());
 }
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:4,代碼來源:Waypoint.ts


注:本文中的@lakemaps/schemas.TypedMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。