spot-sdk-ts
Version:
TypeScript bindings based on protobufs (proto3) provided by Boston Dynamics
270 lines • 12.4 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PayloadEstimationCommand_Feedback = exports.PayloadEstimationCommand_Request = exports.PayloadEstimationCommand = exports.payloadEstimationCommand_Feedback_ErrorToJSON = exports.payloadEstimationCommand_Feedback_ErrorFromJSON = exports.PayloadEstimationCommand_Feedback_Error = exports.payloadEstimationCommand_Feedback_StatusToJSON = exports.payloadEstimationCommand_Feedback_StatusFromJSON = exports.PayloadEstimationCommand_Feedback_Status = exports.protobufPackage = void 0;
/* eslint-disable */
const payload_1 = require("./payload");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = "bosdyn.api";
var PayloadEstimationCommand_Feedback_Status;
(function (PayloadEstimationCommand_Feedback_Status) {
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["STATUS_UNKNOWN"] = 0] = "STATUS_UNKNOWN";
/** STATUS_COMPLETED - Completed estimation routine successfully; estimated_payload is populated. */
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["STATUS_COMPLETED"] = 1] = "STATUS_COMPLETED";
/**
* STATUS_SMALL_MASS - Completed estimation routine successfully, but estimated mass is small enough to
* not significantly impact mobility; estimated_payload is empty.
*/
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["STATUS_SMALL_MASS"] = 2] = "STATUS_SMALL_MASS";
/** STATUS_IN_PROGRESS - Estimation routine is currently running; estimated_payload is empty. */
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["STATUS_IN_PROGRESS"] = 3] = "STATUS_IN_PROGRESS";
/** STATUS_ERROR - Error occurred during the routine; estaimted_payload is empty. */
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["STATUS_ERROR"] = 4] = "STATUS_ERROR";
PayloadEstimationCommand_Feedback_Status[PayloadEstimationCommand_Feedback_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(PayloadEstimationCommand_Feedback_Status = exports.PayloadEstimationCommand_Feedback_Status || (exports.PayloadEstimationCommand_Feedback_Status = {}));
function payloadEstimationCommand_Feedback_StatusFromJSON(object) {
switch (object) {
case 0:
case "STATUS_UNKNOWN":
return PayloadEstimationCommand_Feedback_Status.STATUS_UNKNOWN;
case 1:
case "STATUS_COMPLETED":
return PayloadEstimationCommand_Feedback_Status.STATUS_COMPLETED;
case 2:
case "STATUS_SMALL_MASS":
return PayloadEstimationCommand_Feedback_Status.STATUS_SMALL_MASS;
case 3:
case "STATUS_IN_PROGRESS":
return PayloadEstimationCommand_Feedback_Status.STATUS_IN_PROGRESS;
case 4:
case "STATUS_ERROR":
return PayloadEstimationCommand_Feedback_Status.STATUS_ERROR;
case -1:
case "UNRECOGNIZED":
default:
return PayloadEstimationCommand_Feedback_Status.UNRECOGNIZED;
}
}
exports.payloadEstimationCommand_Feedback_StatusFromJSON = payloadEstimationCommand_Feedback_StatusFromJSON;
function payloadEstimationCommand_Feedback_StatusToJSON(object) {
switch (object) {
case PayloadEstimationCommand_Feedback_Status.STATUS_UNKNOWN:
return "STATUS_UNKNOWN";
case PayloadEstimationCommand_Feedback_Status.STATUS_COMPLETED:
return "STATUS_COMPLETED";
case PayloadEstimationCommand_Feedback_Status.STATUS_SMALL_MASS:
return "STATUS_SMALL_MASS";
case PayloadEstimationCommand_Feedback_Status.STATUS_IN_PROGRESS:
return "STATUS_IN_PROGRESS";
case PayloadEstimationCommand_Feedback_Status.STATUS_ERROR:
return "STATUS_ERROR";
case PayloadEstimationCommand_Feedback_Status.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.payloadEstimationCommand_Feedback_StatusToJSON = payloadEstimationCommand_Feedback_StatusToJSON;
var PayloadEstimationCommand_Feedback_Error;
(function (PayloadEstimationCommand_Feedback_Error) {
PayloadEstimationCommand_Feedback_Error[PayloadEstimationCommand_Feedback_Error["ERROR_UNKNOWN"] = 0] = "ERROR_UNKNOWN";
/** ERROR_NONE - No error has occurred. */
PayloadEstimationCommand_Feedback_Error[PayloadEstimationCommand_Feedback_Error["ERROR_NONE"] = 1] = "ERROR_NONE";
/** ERROR_FAILED_STAND - Robot failed to stand/change stance. */
PayloadEstimationCommand_Feedback_Error[PayloadEstimationCommand_Feedback_Error["ERROR_FAILED_STAND"] = 2] = "ERROR_FAILED_STAND";
/** ERROR_NO_RESULTS - Failed to calculate results. */
PayloadEstimationCommand_Feedback_Error[PayloadEstimationCommand_Feedback_Error["ERROR_NO_RESULTS"] = 3] = "ERROR_NO_RESULTS";
PayloadEstimationCommand_Feedback_Error[PayloadEstimationCommand_Feedback_Error["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(PayloadEstimationCommand_Feedback_Error = exports.PayloadEstimationCommand_Feedback_Error || (exports.PayloadEstimationCommand_Feedback_Error = {}));
function payloadEstimationCommand_Feedback_ErrorFromJSON(object) {
switch (object) {
case 0:
case "ERROR_UNKNOWN":
return PayloadEstimationCommand_Feedback_Error.ERROR_UNKNOWN;
case 1:
case "ERROR_NONE":
return PayloadEstimationCommand_Feedback_Error.ERROR_NONE;
case 2:
case "ERROR_FAILED_STAND":
return PayloadEstimationCommand_Feedback_Error.ERROR_FAILED_STAND;
case 3:
case "ERROR_NO_RESULTS":
return PayloadEstimationCommand_Feedback_Error.ERROR_NO_RESULTS;
case -1:
case "UNRECOGNIZED":
default:
return PayloadEstimationCommand_Feedback_Error.UNRECOGNIZED;
}
}
exports.payloadEstimationCommand_Feedback_ErrorFromJSON = payloadEstimationCommand_Feedback_ErrorFromJSON;
function payloadEstimationCommand_Feedback_ErrorToJSON(object) {
switch (object) {
case PayloadEstimationCommand_Feedback_Error.ERROR_UNKNOWN:
return "ERROR_UNKNOWN";
case PayloadEstimationCommand_Feedback_Error.ERROR_NONE:
return "ERROR_NONE";
case PayloadEstimationCommand_Feedback_Error.ERROR_FAILED_STAND:
return "ERROR_FAILED_STAND";
case PayloadEstimationCommand_Feedback_Error.ERROR_NO_RESULTS:
return "ERROR_NO_RESULTS";
case PayloadEstimationCommand_Feedback_Error.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.payloadEstimationCommand_Feedback_ErrorToJSON = payloadEstimationCommand_Feedback_ErrorToJSON;
function createBasePayloadEstimationCommand() {
return {};
}
exports.PayloadEstimationCommand = {
encode(_, writer = minimal_1.default.Writer.create()) {
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePayloadEstimationCommand();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
fromPartial(_) {
const message = createBasePayloadEstimationCommand();
return message;
},
};
function createBasePayloadEstimationCommand_Request() {
return {};
}
exports.PayloadEstimationCommand_Request = {
encode(_, writer = minimal_1.default.Writer.create()) {
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePayloadEstimationCommand_Request();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
fromPartial(_) {
const message = createBasePayloadEstimationCommand_Request();
return message;
},
};
function createBasePayloadEstimationCommand_Feedback() {
return { status: 0, progress: 0, error: 0, estimatedPayload: undefined };
}
exports.PayloadEstimationCommand_Feedback = {
encode(message, writer = minimal_1.default.Writer.create()) {
if (message.status !== 0) {
writer.uint32(8).int32(message.status);
}
if (message.progress !== 0) {
writer.uint32(21).float(message.progress);
}
if (message.error !== 0) {
writer.uint32(24).int32(message.error);
}
if (message.estimatedPayload !== undefined) {
payload_1.Payload.encode(message.estimatedPayload, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePayloadEstimationCommand_Feedback();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.status = reader.int32();
break;
case 2:
message.progress = reader.float();
break;
case 3:
message.error = reader.int32();
break;
case 4:
message.estimatedPayload = payload_1.Payload.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status)
? payloadEstimationCommand_Feedback_StatusFromJSON(object.status)
: 0,
progress: isSet(object.progress) ? Number(object.progress) : 0,
error: isSet(object.error)
? payloadEstimationCommand_Feedback_ErrorFromJSON(object.error)
: 0,
estimatedPayload: isSet(object.estimatedPayload)
? payload_1.Payload.fromJSON(object.estimatedPayload)
: undefined,
};
},
toJSON(message) {
const obj = {};
message.status !== undefined &&
(obj.status = payloadEstimationCommand_Feedback_StatusToJSON(message.status));
message.progress !== undefined && (obj.progress = message.progress);
message.error !== undefined &&
(obj.error = payloadEstimationCommand_Feedback_ErrorToJSON(message.error));
message.estimatedPayload !== undefined &&
(obj.estimatedPayload = message.estimatedPayload
? payload_1.Payload.toJSON(message.estimatedPayload)
: undefined);
return obj;
},
fromPartial(object) {
const message = createBasePayloadEstimationCommand_Feedback();
message.status = object.status ?? 0;
message.progress = object.progress ?? 0;
message.error = object.error ?? 0;
message.estimatedPayload =
object.estimatedPayload !== undefined && object.estimatedPayload !== null
? payload_1.Payload.fromPartial(object.estimatedPayload)
: undefined;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=payload_estimation.js.map