UNPKG

spot-sdk-ts

Version:

TypeScript bindings based on protobufs (proto3) provided by Boston Dynamics

587 lines 26 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PowerCommandFeedbackResponse = exports.PowerCommandFeedbackRequest = exports.PowerCommandResponse = exports.PowerCommandRequest = exports.powerCommandRequest_RequestToJSON = exports.powerCommandRequest_RequestFromJSON = exports.PowerCommandRequest_Request = exports.powerCommandStatusToJSON = exports.powerCommandStatusFromJSON = exports.PowerCommandStatus = exports.protobufPackage = void 0; /* eslint-disable */ const license_1 = require("./license"); const header_1 = require("./header"); const lease_1 = require("./lease"); const robot_state_1 = require("./robot_state"); const minimal_1 = __importDefault(require("protobufjs/minimal")); exports.protobufPackage = "bosdyn.api"; /** Feedback on the current state of a power command on the robot. */ var PowerCommandStatus; (function (PowerCommandStatus) { /** STATUS_UNKNOWN - Status is not specified. */ PowerCommandStatus[PowerCommandStatus["STATUS_UNKNOWN"] = 0] = "STATUS_UNKNOWN"; /** STATUS_IN_PROGRESS - Power command is executing. */ PowerCommandStatus[PowerCommandStatus["STATUS_IN_PROGRESS"] = 1] = "STATUS_IN_PROGRESS"; /** STATUS_SUCCESS - Power command succeeded. */ PowerCommandStatus[PowerCommandStatus["STATUS_SUCCESS"] = 2] = "STATUS_SUCCESS"; /** STATUS_SHORE_POWER_CONNECTED - ERROR: Robot cannot be powered on while on wall power. */ PowerCommandStatus[PowerCommandStatus["STATUS_SHORE_POWER_CONNECTED"] = 3] = "STATUS_SHORE_POWER_CONNECTED"; /** STATUS_BATTERY_MISSING - ERROR: Battery not inserted into robot. */ PowerCommandStatus[PowerCommandStatus["STATUS_BATTERY_MISSING"] = 4] = "STATUS_BATTERY_MISSING"; /** STATUS_COMMAND_IN_PROGRESS - ERROR: Power command cant be overwritten. */ PowerCommandStatus[PowerCommandStatus["STATUS_COMMAND_IN_PROGRESS"] = 5] = "STATUS_COMMAND_IN_PROGRESS"; /** * STATUS_ESTOPPED - ERROR: Cannot power on while estopped. A robot may have multiple estops. * Inspect EStopState for additional info. */ PowerCommandStatus[PowerCommandStatus["STATUS_ESTOPPED"] = 6] = "STATUS_ESTOPPED"; /** STATUS_FAULTED - ERROR: Cannot power due to a fault. Inspect FaultState for more info. */ PowerCommandStatus[PowerCommandStatus["STATUS_FAULTED"] = 7] = "STATUS_FAULTED"; /** STATUS_INTERNAL_ERROR - ERROR: Internal error occurred, may be clear-able by issuing a power off command. */ PowerCommandStatus[PowerCommandStatus["STATUS_INTERNAL_ERROR"] = 8] = "STATUS_INTERNAL_ERROR"; /** STATUS_LICENSE_ERROR - ERROR: License check failed. Check license_status field for details. */ PowerCommandStatus[PowerCommandStatus["STATUS_LICENSE_ERROR"] = 9] = "STATUS_LICENSE_ERROR"; /** INCOMPATIBLE_HARDWARE_ERROR - ERROR: The Spot hardware is not compatible with the request request. */ PowerCommandStatus[PowerCommandStatus["INCOMPATIBLE_HARDWARE_ERROR"] = 10] = "INCOMPATIBLE_HARDWARE_ERROR"; /** * STATUS_OVERRIDDEN - ERROR: Robot has overridden the power command and disabled motor power. In the case * of a commanded power OFF, robot will report SUCCESS if power is disabled. */ PowerCommandStatus[PowerCommandStatus["STATUS_OVERRIDDEN"] = 11] = "STATUS_OVERRIDDEN"; PowerCommandStatus[PowerCommandStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(PowerCommandStatus = exports.PowerCommandStatus || (exports.PowerCommandStatus = {})); function powerCommandStatusFromJSON(object) { switch (object) { case 0: case "STATUS_UNKNOWN": return PowerCommandStatus.STATUS_UNKNOWN; case 1: case "STATUS_IN_PROGRESS": return PowerCommandStatus.STATUS_IN_PROGRESS; case 2: case "STATUS_SUCCESS": return PowerCommandStatus.STATUS_SUCCESS; case 3: case "STATUS_SHORE_POWER_CONNECTED": return PowerCommandStatus.STATUS_SHORE_POWER_CONNECTED; case 4: case "STATUS_BATTERY_MISSING": return PowerCommandStatus.STATUS_BATTERY_MISSING; case 5: case "STATUS_COMMAND_IN_PROGRESS": return PowerCommandStatus.STATUS_COMMAND_IN_PROGRESS; case 6: case "STATUS_ESTOPPED": return PowerCommandStatus.STATUS_ESTOPPED; case 7: case "STATUS_FAULTED": return PowerCommandStatus.STATUS_FAULTED; case 8: case "STATUS_INTERNAL_ERROR": return PowerCommandStatus.STATUS_INTERNAL_ERROR; case 9: case "STATUS_LICENSE_ERROR": return PowerCommandStatus.STATUS_LICENSE_ERROR; case 10: case "INCOMPATIBLE_HARDWARE_ERROR": return PowerCommandStatus.INCOMPATIBLE_HARDWARE_ERROR; case 11: case "STATUS_OVERRIDDEN": return PowerCommandStatus.STATUS_OVERRIDDEN; case -1: case "UNRECOGNIZED": default: return PowerCommandStatus.UNRECOGNIZED; } } exports.powerCommandStatusFromJSON = powerCommandStatusFromJSON; function powerCommandStatusToJSON(object) { switch (object) { case PowerCommandStatus.STATUS_UNKNOWN: return "STATUS_UNKNOWN"; case PowerCommandStatus.STATUS_IN_PROGRESS: return "STATUS_IN_PROGRESS"; case PowerCommandStatus.STATUS_SUCCESS: return "STATUS_SUCCESS"; case PowerCommandStatus.STATUS_SHORE_POWER_CONNECTED: return "STATUS_SHORE_POWER_CONNECTED"; case PowerCommandStatus.STATUS_BATTERY_MISSING: return "STATUS_BATTERY_MISSING"; case PowerCommandStatus.STATUS_COMMAND_IN_PROGRESS: return "STATUS_COMMAND_IN_PROGRESS"; case PowerCommandStatus.STATUS_ESTOPPED: return "STATUS_ESTOPPED"; case PowerCommandStatus.STATUS_FAULTED: return "STATUS_FAULTED"; case PowerCommandStatus.STATUS_INTERNAL_ERROR: return "STATUS_INTERNAL_ERROR"; case PowerCommandStatus.STATUS_LICENSE_ERROR: return "STATUS_LICENSE_ERROR"; case PowerCommandStatus.INCOMPATIBLE_HARDWARE_ERROR: return "INCOMPATIBLE_HARDWARE_ERROR"; case PowerCommandStatus.STATUS_OVERRIDDEN: return "STATUS_OVERRIDDEN"; case PowerCommandStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } exports.powerCommandStatusToJSON = powerCommandStatusToJSON; /** * Commands for the robot to execute. * Note that not all Spot robots are compatible with all these commands. Check your robot's * HardwareConfiguration in bosdyn.api.robot_state. */ var PowerCommandRequest_Request; (function (PowerCommandRequest_Request) { /** REQUEST_UNKNOWN - Invalid request; do not use. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_UNKNOWN"] = 0] = "REQUEST_UNKNOWN"; /** * REQUEST_OFF - Cut power to motors immediately. * * @deprecated */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_OFF"] = 1] = "REQUEST_OFF"; /** * REQUEST_ON - Turn on power to the robot motors. * * @deprecated */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_ON"] = 2] = "REQUEST_ON"; /** REQUEST_OFF_MOTORS - Cut power to motors immediately. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_OFF_MOTORS"] = 1] = "REQUEST_OFF_MOTORS"; /** REQUEST_ON_MOTORS - Turn on power to the robot motors. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_ON_MOTORS"] = 2] = "REQUEST_ON_MOTORS"; /** REQUEST_OFF_ROBOT - Turn off the robot. Same as physical switch. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_OFF_ROBOT"] = 3] = "REQUEST_OFF_ROBOT"; /** REQUEST_CYCLE_ROBOT - Power cycle the robot. Same as physical switch. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_CYCLE_ROBOT"] = 4] = "REQUEST_CYCLE_ROBOT"; /** REQUEST_OFF_PAYLOAD_PORTS - Cut power to the payload ports. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_OFF_PAYLOAD_PORTS"] = 5] = "REQUEST_OFF_PAYLOAD_PORTS"; /** REQUEST_ON_PAYLOAD_PORTS - Turn on power to the payload ports. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_ON_PAYLOAD_PORTS"] = 6] = "REQUEST_ON_PAYLOAD_PORTS"; /** REQUEST_OFF_WIFI_RADIO - Cut power to the hardware Wi-Fi radio. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_OFF_WIFI_RADIO"] = 7] = "REQUEST_OFF_WIFI_RADIO"; /** REQUEST_ON_WIFI_RADIO - Power on the hardware Wi-Fi radio. */ PowerCommandRequest_Request[PowerCommandRequest_Request["REQUEST_ON_WIFI_RADIO"] = 8] = "REQUEST_ON_WIFI_RADIO"; PowerCommandRequest_Request[PowerCommandRequest_Request["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(PowerCommandRequest_Request = exports.PowerCommandRequest_Request || (exports.PowerCommandRequest_Request = {})); function powerCommandRequest_RequestFromJSON(object) { switch (object) { case 0: case "REQUEST_UNKNOWN": return PowerCommandRequest_Request.REQUEST_UNKNOWN; case 1: case "REQUEST_OFF": return PowerCommandRequest_Request.REQUEST_OFF; case 2: case "REQUEST_ON": return PowerCommandRequest_Request.REQUEST_ON; case 1: case "REQUEST_OFF_MOTORS": return PowerCommandRequest_Request.REQUEST_OFF_MOTORS; case 2: case "REQUEST_ON_MOTORS": return PowerCommandRequest_Request.REQUEST_ON_MOTORS; case 3: case "REQUEST_OFF_ROBOT": return PowerCommandRequest_Request.REQUEST_OFF_ROBOT; case 4: case "REQUEST_CYCLE_ROBOT": return PowerCommandRequest_Request.REQUEST_CYCLE_ROBOT; case 5: case "REQUEST_OFF_PAYLOAD_PORTS": return PowerCommandRequest_Request.REQUEST_OFF_PAYLOAD_PORTS; case 6: case "REQUEST_ON_PAYLOAD_PORTS": return PowerCommandRequest_Request.REQUEST_ON_PAYLOAD_PORTS; case 7: case "REQUEST_OFF_WIFI_RADIO": return PowerCommandRequest_Request.REQUEST_OFF_WIFI_RADIO; case 8: case "REQUEST_ON_WIFI_RADIO": return PowerCommandRequest_Request.REQUEST_ON_WIFI_RADIO; case -1: case "UNRECOGNIZED": default: return PowerCommandRequest_Request.UNRECOGNIZED; } } exports.powerCommandRequest_RequestFromJSON = powerCommandRequest_RequestFromJSON; function powerCommandRequest_RequestToJSON(object) { switch (object) { case PowerCommandRequest_Request.REQUEST_UNKNOWN: return "REQUEST_UNKNOWN"; case PowerCommandRequest_Request.REQUEST_OFF: return "REQUEST_OFF"; case PowerCommandRequest_Request.REQUEST_ON: return "REQUEST_ON"; case PowerCommandRequest_Request.REQUEST_OFF_MOTORS: return "REQUEST_OFF_MOTORS"; case PowerCommandRequest_Request.REQUEST_ON_MOTORS: return "REQUEST_ON_MOTORS"; case PowerCommandRequest_Request.REQUEST_OFF_ROBOT: return "REQUEST_OFF_ROBOT"; case PowerCommandRequest_Request.REQUEST_CYCLE_ROBOT: return "REQUEST_CYCLE_ROBOT"; case PowerCommandRequest_Request.REQUEST_OFF_PAYLOAD_PORTS: return "REQUEST_OFF_PAYLOAD_PORTS"; case PowerCommandRequest_Request.REQUEST_ON_PAYLOAD_PORTS: return "REQUEST_ON_PAYLOAD_PORTS"; case PowerCommandRequest_Request.REQUEST_OFF_WIFI_RADIO: return "REQUEST_OFF_WIFI_RADIO"; case PowerCommandRequest_Request.REQUEST_ON_WIFI_RADIO: return "REQUEST_ON_WIFI_RADIO"; case PowerCommandRequest_Request.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } exports.powerCommandRequest_RequestToJSON = powerCommandRequest_RequestToJSON; function createBasePowerCommandRequest() { return { header: undefined, lease: undefined, request: 0 }; } exports.PowerCommandRequest = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.RequestHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } if (message.lease !== undefined) { lease_1.Lease.encode(message.lease, writer.uint32(18).fork()).ldelim(); } if (message.request !== 0) { writer.uint32(24).int32(message.request); } 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 = createBasePowerCommandRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.RequestHeader.decode(reader, reader.uint32()); break; case 2: message.lease = lease_1.Lease.decode(reader, reader.uint32()); break; case 3: message.request = reader.int32(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.RequestHeader.fromJSON(object.header) : undefined, lease: isSet(object.lease) ? lease_1.Lease.fromJSON(object.lease) : undefined, request: isSet(object.request) ? powerCommandRequest_RequestFromJSON(object.request) : 0, }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.RequestHeader.toJSON(message.header) : undefined); message.lease !== undefined && (obj.lease = message.lease ? lease_1.Lease.toJSON(message.lease) : undefined); message.request !== undefined && (obj.request = powerCommandRequest_RequestToJSON(message.request)); return obj; }, fromPartial(object) { const message = createBasePowerCommandRequest(); message.header = object.header !== undefined && object.header !== null ? header_1.RequestHeader.fromPartial(object.header) : undefined; message.lease = object.lease !== undefined && object.lease !== null ? lease_1.Lease.fromPartial(object.lease) : undefined; message.request = object.request ?? 0; return message; }, }; function createBasePowerCommandResponse() { return { header: undefined, leaseUseResult: undefined, status: 0, powerCommandId: 0, licenseStatus: 0, blockingFaults: [], }; } exports.PowerCommandResponse = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.ResponseHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } if (message.leaseUseResult !== undefined) { lease_1.LeaseUseResult.encode(message.leaseUseResult, writer.uint32(18).fork()).ldelim(); } if (message.status !== 0) { writer.uint32(24).int32(message.status); } if (message.powerCommandId !== 0) { writer.uint32(32).uint32(message.powerCommandId); } if (message.licenseStatus !== 0) { writer.uint32(40).int32(message.licenseStatus); } for (const v of message.blockingFaults) { robot_state_1.SystemFault.encode(v, writer.uint32(50).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 = createBasePowerCommandResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.ResponseHeader.decode(reader, reader.uint32()); break; case 2: message.leaseUseResult = lease_1.LeaseUseResult.decode(reader, reader.uint32()); break; case 3: message.status = reader.int32(); break; case 4: message.powerCommandId = reader.uint32(); break; case 5: message.licenseStatus = reader.int32(); break; case 6: message.blockingFaults.push(robot_state_1.SystemFault.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.ResponseHeader.fromJSON(object.header) : undefined, leaseUseResult: isSet(object.leaseUseResult) ? lease_1.LeaseUseResult.fromJSON(object.leaseUseResult) : undefined, status: isSet(object.status) ? powerCommandStatusFromJSON(object.status) : 0, powerCommandId: isSet(object.powerCommandId) ? Number(object.powerCommandId) : 0, licenseStatus: isSet(object.licenseStatus) ? (0, license_1.licenseInfo_StatusFromJSON)(object.licenseStatus) : 0, blockingFaults: Array.isArray(object?.blockingFaults) ? object.blockingFaults.map((e) => robot_state_1.SystemFault.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.ResponseHeader.toJSON(message.header) : undefined); message.leaseUseResult !== undefined && (obj.leaseUseResult = message.leaseUseResult ? lease_1.LeaseUseResult.toJSON(message.leaseUseResult) : undefined); message.status !== undefined && (obj.status = powerCommandStatusToJSON(message.status)); message.powerCommandId !== undefined && (obj.powerCommandId = Math.round(message.powerCommandId)); message.licenseStatus !== undefined && (obj.licenseStatus = (0, license_1.licenseInfo_StatusToJSON)(message.licenseStatus)); if (message.blockingFaults) { obj.blockingFaults = message.blockingFaults.map((e) => e ? robot_state_1.SystemFault.toJSON(e) : undefined); } else { obj.blockingFaults = []; } return obj; }, fromPartial(object) { const message = createBasePowerCommandResponse(); message.header = object.header !== undefined && object.header !== null ? header_1.ResponseHeader.fromPartial(object.header) : undefined; message.leaseUseResult = object.leaseUseResult !== undefined && object.leaseUseResult !== null ? lease_1.LeaseUseResult.fromPartial(object.leaseUseResult) : undefined; message.status = object.status ?? 0; message.powerCommandId = object.powerCommandId ?? 0; message.licenseStatus = object.licenseStatus ?? 0; message.blockingFaults = object.blockingFaults?.map((e) => robot_state_1.SystemFault.fromPartial(e)) || []; return message; }, }; function createBasePowerCommandFeedbackRequest() { return { header: undefined, powerCommandId: 0 }; } exports.PowerCommandFeedbackRequest = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.RequestHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } if (message.powerCommandId !== 0) { writer.uint32(16).uint32(message.powerCommandId); } 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 = createBasePowerCommandFeedbackRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.RequestHeader.decode(reader, reader.uint32()); break; case 2: message.powerCommandId = reader.uint32(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.RequestHeader.fromJSON(object.header) : undefined, powerCommandId: isSet(object.powerCommandId) ? Number(object.powerCommandId) : 0, }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.RequestHeader.toJSON(message.header) : undefined); message.powerCommandId !== undefined && (obj.powerCommandId = Math.round(message.powerCommandId)); return obj; }, fromPartial(object) { const message = createBasePowerCommandFeedbackRequest(); message.header = object.header !== undefined && object.header !== null ? header_1.RequestHeader.fromPartial(object.header) : undefined; message.powerCommandId = object.powerCommandId ?? 0; return message; }, }; function createBasePowerCommandFeedbackResponse() { return { header: undefined, status: 0, blockingFaults: [] }; } exports.PowerCommandFeedbackResponse = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.header !== undefined) { header_1.ResponseHeader.encode(message.header, writer.uint32(10).fork()).ldelim(); } if (message.status !== 0) { writer.uint32(16).int32(message.status); } for (const v of message.blockingFaults) { robot_state_1.SystemFault.encode(v, writer.uint32(26).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 = createBasePowerCommandFeedbackResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.header = header_1.ResponseHeader.decode(reader, reader.uint32()); break; case 2: message.status = reader.int32(); break; case 3: message.blockingFaults.push(robot_state_1.SystemFault.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object) { return { header: isSet(object.header) ? header_1.ResponseHeader.fromJSON(object.header) : undefined, status: isSet(object.status) ? powerCommandStatusFromJSON(object.status) : 0, blockingFaults: Array.isArray(object?.blockingFaults) ? object.blockingFaults.map((e) => robot_state_1.SystemFault.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; message.header !== undefined && (obj.header = message.header ? header_1.ResponseHeader.toJSON(message.header) : undefined); message.status !== undefined && (obj.status = powerCommandStatusToJSON(message.status)); if (message.blockingFaults) { obj.blockingFaults = message.blockingFaults.map((e) => e ? robot_state_1.SystemFault.toJSON(e) : undefined); } else { obj.blockingFaults = []; } return obj; }, fromPartial(object) { const message = createBasePowerCommandFeedbackResponse(); message.header = object.header !== undefined && object.header !== null ? header_1.ResponseHeader.fromPartial(object.header) : undefined; message.status = object.status ?? 0; message.blockingFaults = object.blockingFaults?.map((e) => robot_state_1.SystemFault.fromPartial(e)) || []; return message; }, }; function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=power.js.map