梯控系统
注意:
- 梯控机器人地图定位成功
- 梯控机器人必须建立巡线
- 梯控机器人必须处于巡线的点位之上
- 梯控机器人的地图不能使用复制的地图,会造成点位ID,楼层冲突,无法到达
导航乘梯
组件名称: NavigationElevatorComponent
组件描述: 导航乘梯组件,用于控制机器人前往指定位置点。
使用示例:
//DeliveryScreen类文件
import DeliveryElevatorViewModel from './DeliveryElevatorViewModel';
public constructor(props: BaseComponentProps) {
super(props);
let viewModel = new DeliveryElevatorViewModel(props);
this.setViewModel(viewModel);
let voice = new DeliveryVoice(viewModel);
this.setVoice(voice);
}
public render() {
return (
<>
<NavigationElevatorComponent
param={this.viewModel.getNavigationElevatorParams()}
onStatusUpdate={this.viewModel.handleNaviStatus}
onFinish={this.viewModel.handleNaviFinish}
/>
</>
);
}
//DeliveryScreen类文件
import DeliveryElevatorViewModel from './DeliveryElevatorViewModel';
public constructor(props: BaseComponentProps) {
super(props);
let viewModel = new DeliveryElevatorViewModel(props);
this.setViewModel(viewModel);
let voice = new DeliveryVoice(viewModel);
this.setVoice(voice);
}
public render() {
return (
<>
<NavigationElevatorComponent
param={this.viewModel.getNavigationElevatorParams()}
onStatusUpdate={this.viewModel.handleNaviStatus}
onFinish={this.viewModel.handleNaviFinish}
/>
</>
);
}
//DeliveryScreen类文件 import DeliveryElevatorViewModel from './DeliveryElevatorViewModel'; public constructor(props: BaseComponentProps) { super(props); let viewModel = new DeliveryElevatorViewModel(props); this.setViewModel(viewModel); let voice = new DeliveryVoice(viewModel); this.setVoice(voice); } public render() { return ( <> <NavigationElevatorComponent param={this.viewModel.getNavigationElevatorParams()} onStatusUpdate={this.viewModel.handleNaviStatus} onFinish={this.viewModel.handleNaviFinish} /> </> ); }
//DeliveryElevatorViewModel文件
/**
*获取导航参数
*/
import { NavigationElevatorParam, } from 'orionos-eve-core';
public getNavigationElevatorParams(): NavigationElevatorParam {
return new NavigationElevatorParam (
floorIndex + '', //floorIndex 楼层序号,手动设置固定值
poseName //poseName地点名称,手动设置固定值
);
}
/**
*导航状态处理
*@param event
*/
public handleNaviStatus = (event?: ComponentEvent): boolean => {
console.log(TAG, 'On navigation status update : ' + JSON.stringify(event));
if (!(event && event.status)) {
return false;
}
let subType = this.getEventSubType(event);
switch (event.status) {
case 32730022:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_AVOID_START, subType);
return true;
case 32730001:
// DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH);
this.state.setState(State.CRUISING);
return true;
case 32730002:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
//梯控导航,不处理传统的避障超时
//this.handleAvoidingEvent(event, subType);
return true;
case 32730011:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
this.handleAvoidStartEvent();
return true;
case 32730003:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
this.handleAvoidEndEvent(event, subType);
return true;
case -32620015:
this.waitInPlace();
return true;
case 32730004:
this.handleObstaclesEvent(event, subType);
return true;
case 32750004:
//进电梯,到达电梯门
this.handleArriveElevatorDoor();
return true;
case 32750005:
//进电梯,到达电梯中心,开始转向
this.handleArriveElevatorCenterAndStartTurn();
return true;
case 32750023:
//进电梯,到达电梯中心,转向完成
return true;
case 32750009:
//出电梯,离开电梯门
this.handleExitElevatorDoor();
return true;
case 32750008:
//出电梯,离开电梯中心
this.handleLeaveElevatorCenter();
return true;
case 32750003:
//进电梯,从电梯口去电梯中心
this.handleEnterElevator();
return true;
default:
return false;
} };
/**
*导航结束事件处理
*@param event
*/
public handleNaviFinish = (event?: ComponentEvent): boolean => {
console.log(TAG, 'On navigation finish : ' + JSON.stringify(event));
if (!(event && event.status)) {
return false;
}
// DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT);
let subType = this.getEventSubType(event);
switch (event.status) {
case 32610007:
this.handleNaviArrivedEvent(event);
return true;
case -32620015:
this.handleNaviArrivedEvent(event, false);
return true;
case -32610004:
case -32620007:
case -32620008: //navigation moving time out
case 32610009:
case -32620006:
case -32660015: //enter elevator failed
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE, subType);
this.waitInPlace();
return true;
case -32620009:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE,
subType, I18n.t('ttsNavigationGlobalPathFailedPleaseEditMap'));
this.showNaviError(subType);
return true;
case -32620014:
case -32600001:
case -32600002:
this.showNaviError(subType);
return true;
case -32620002:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_OUT_MAP, subType, I18n.t('ttsNavigationOutMap'));
this.showNaviError(subType, true);
return true;
case -32620001:
this.handleNotEstimateEvent(subType);
return true;
case -32620029:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_WAIT_TIMEOUT, subType, I18n.t('nav_waitTimeout_tts'));
this.showNaviError(subType, false, true);
return true;
case -32650006:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_ERROR, subType, I18n.t('nav_multiRobotError_tts'));
this.showNaviError(subType, false, false, true);
return true;
case -32620030:
this.handleRobotWheelError(subType);
return true;
case -32660021:
//梯控多楼层导航,地图错误
this.showNaviError(NavErrorConst.NAVI_ERROR_ELEVATOR_MAP_RONG);
return true;
default:
this.showNaviError(subType);
return false;
} };
private getEventSubType(event: ComponentEvent) {
let eventSubType = 0;
if (event.extraData) {
let extraData = JSON.parse(event.extraData);
let code = extraData.code;
console.log(TAG, ' onStatusUpdate code: ' + code);
if (code) {
eventSubType = code;
}
}
return eventSubType;
}
//DeliveryElevatorViewModel文件
/**
*获取导航参数
*/
import { NavigationElevatorParam, } from 'orionos-eve-core';
public getNavigationElevatorParams(): NavigationElevatorParam {
return new NavigationElevatorParam (
floorIndex + '', //floorIndex 楼层序号,手动设置固定值
poseName //poseName地点名称,手动设置固定值
);
}
/**
*导航状态处理
*@param event
*/
public handleNaviStatus = (event?: ComponentEvent): boolean => {
console.log(TAG, 'On navigation status update : ' + JSON.stringify(event));
if (!(event && event.status)) {
return false;
}
let subType = this.getEventSubType(event);
switch (event.status) {
case 32730022:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_AVOID_START, subType);
return true;
case 32730001:
// DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH);
this.state.setState(State.CRUISING);
return true;
case 32730002:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
//梯控导航,不处理传统的避障超时
//this.handleAvoidingEvent(event, subType);
return true;
case 32730011:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
this.handleAvoidStartEvent();
return true;
case 32730003:
if (settingStore.getIsOpenDemoSwitch) {
return true;
}
this.handleAvoidEndEvent(event, subType);
return true;
case -32620015:
this.waitInPlace();
return true;
case 32730004:
this.handleObstaclesEvent(event, subType);
return true;
case 32750004:
//进电梯,到达电梯门
this.handleArriveElevatorDoor();
return true;
case 32750005:
//进电梯,到达电梯中心,开始转向
this.handleArriveElevatorCenterAndStartTurn();
return true;
case 32750023:
//进电梯,到达电梯中心,转向完成
return true;
case 32750009:
//出电梯,离开电梯门
this.handleExitElevatorDoor();
return true;
case 32750008:
//出电梯,离开电梯中心
this.handleLeaveElevatorCenter();
return true;
case 32750003:
//进电梯,从电梯口去电梯中心
this.handleEnterElevator();
return true;
default:
return false;
} };
/**
*导航结束事件处理
*@param event
*/
public handleNaviFinish = (event?: ComponentEvent): boolean => {
console.log(TAG, 'On navigation finish : ' + JSON.stringify(event));
if (!(event && event.status)) {
return false;
}
// DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT);
let subType = this.getEventSubType(event);
switch (event.status) {
case 32610007:
this.handleNaviArrivedEvent(event);
return true;
case -32620015:
this.handleNaviArrivedEvent(event, false);
return true;
case -32610004:
case -32620007:
case -32620008: //navigation moving time out
case 32610009:
case -32620006:
case -32660015: //enter elevator failed
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE, subType);
this.waitInPlace();
return true;
case -32620009:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE,
subType, I18n.t('ttsNavigationGlobalPathFailedPleaseEditMap'));
this.showNaviError(subType);
return true;
case -32620014:
case -32600001:
case -32600002:
this.showNaviError(subType);
return true;
case -32620002:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_OUT_MAP, subType, I18n.t('ttsNavigationOutMap'));
this.showNaviError(subType, true);
return true;
case -32620001:
this.handleNotEstimateEvent(subType);
return true;
case -32620029:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_WAIT_TIMEOUT, subType, I18n.t('nav_waitTimeout_tts'));
this.showNaviError(subType, false, true);
return true;
case -32650006:
this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_ERROR, subType, I18n.t('nav_multiRobotError_tts'));
this.showNaviError(subType, false, false, true);
return true;
case -32620030:
this.handleRobotWheelError(subType);
return true;
case -32660021:
//梯控多楼层导航,地图错误
this.showNaviError(NavErrorConst.NAVI_ERROR_ELEVATOR_MAP_RONG);
return true;
default:
this.showNaviError(subType);
return false;
} };
private getEventSubType(event: ComponentEvent) {
let eventSubType = 0;
if (event.extraData) {
let extraData = JSON.parse(event.extraData);
let code = extraData.code;
console.log(TAG, ' onStatusUpdate code: ' + code);
if (code) {
eventSubType = code;
}
}
return eventSubType;
}
//DeliveryElevatorViewModel文件 /** *获取导航参数 */ import { NavigationElevatorParam, } from 'orionos-eve-core'; public getNavigationElevatorParams(): NavigationElevatorParam { return new NavigationElevatorParam ( floorIndex + '', //floorIndex 楼层序号,手动设置固定值 poseName //poseName地点名称,手动设置固定值 ); } /** *导航状态处理 *@param event */ public handleNaviStatus = (event?: ComponentEvent): boolean => { console.log(TAG, 'On navigation status update : ' + JSON.stringify(event)); if (!(event && event.status)) { return false; } let subType = this.getEventSubType(event); switch (event.status) { case 32730022: this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_AVOID_START, subType); return true; case 32730001: // DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH); this.state.setState(State.CRUISING); return true; case 32730002: if (settingStore.getIsOpenDemoSwitch) { return true; } //梯控导航,不处理传统的避障超时 //this.handleAvoidingEvent(event, subType); return true; case 32730011: if (settingStore.getIsOpenDemoSwitch) { return true; } this.handleAvoidStartEvent(); return true; case 32730003: if (settingStore.getIsOpenDemoSwitch) { return true; } this.handleAvoidEndEvent(event, subType); return true; case -32620015: this.waitInPlace(); return true; case 32730004: this.handleObstaclesEvent(event, subType); return true; case 32750004: //进电梯,到达电梯门 this.handleArriveElevatorDoor(); return true; case 32750005: //进电梯,到达电梯中心,开始转向 this.handleArriveElevatorCenterAndStartTurn(); return true; case 32750023: //进电梯,到达电梯中心,转向完成 return true; case 32750009: //出电梯,离开电梯门 this.handleExitElevatorDoor(); return true; case 32750008: //出电梯,离开电梯中心 this.handleLeaveElevatorCenter(); return true; case 32750003: //进电梯,从电梯口去电梯中心 this.handleEnterElevator(); return true; default: return false; } }; /** *导航结束事件处理 *@param event */ public handleNaviFinish = (event?: ComponentEvent): boolean => { console.log(TAG, 'On navigation finish : ' + JSON.stringify(event)); if (!(event && event.status)) { return false; } // DanceOperation.playLightEffect(LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT); let subType = this.getEventSubType(event); switch (event.status) { case 32610007: this.handleNaviArrivedEvent(event); return true; case -32620015: this.handleNaviArrivedEvent(event, false); return true; case -32610004: case -32620007: case -32620008: //navigation moving time out case 32610009: case -32620006: case -32660015: //enter elevator failed this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE, subType); this.waitInPlace(); return true; case -32620009: this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_DESTINATION_UNREACHABLE, subType, I18n.t('ttsNavigationGlobalPathFailedPleaseEditMap')); this.showNaviError(subType); return true; case -32620014: case -32600001: case -32600002: this.showNaviError(subType); return true; case -32620002: this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_OUT_MAP, subType, I18n.t('ttsNavigationOutMap')); this.showNaviError(subType, true); return true; case -32620001: this.handleNotEstimateEvent(subType); return true; case -32620029: this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_WAIT_TIMEOUT, subType, I18n.t('nav_waitTimeout_tts')); this.showNaviError(subType, false, true); return true; case -32650006: this.reportInvalidEvent(DeliveryInvalidEvent.EVENT_TYPE_MULTI_ROBOT_ERROR, subType, I18n.t('nav_multiRobotError_tts')); this.showNaviError(subType, false, false, true); return true; case -32620030: this.handleRobotWheelError(subType); return true; case -32660021: //梯控多楼层导航,地图错误 this.showNaviError(NavErrorConst.NAVI_ERROR_ELEVATOR_MAP_RONG); return true; default: this.showNaviError(subType); return false; } }; private getEventSubType(event: ComponentEvent) { let eventSubType = 0; if (event.extraData) { let extraData = JSON.parse(event.extraData); let code = extraData.code; console.log(TAG, ' onStatusUpdate code: ' + code); if (code) { eventSubType = code; } } return eventSubType; }
属性:
- param:组件参数,类型为NavigationElevatorParam
- onStatusUpdate:组件状态回调
- onFinish:组件执行结束回调
参数说明:
- floorIndex:楼层,必填项,不能为空,否则会抛出崩溃异常
- poseName:地点名称
状态说明:
通过ComponentEvent.status获取到状态码:
- 32730022:报告非法事件,常量定义ComponentStatusConst.STATUS_NAVIGATION_AVOID_IMMEDIATELY
- 32730001:开始导航,常量定义ComponentStatusConst.STATUS_START_NAVIGATION
- 32730002:梯控导航,不处理传统的避障超时,常量定义ComponentStatusConst.STATUS_NAVIGATION_AVOID
- 32730011:处理避障开始事件,常量定义ComponentStatusConst.STATUS_NAVIGATION_AVOID_START
- 32730003:处理避障结束事件,常量定义ComponentStatusConst.STATUS_NAVIGATION_AVOID_END
- -32620015:原地停留,常量定义ComponentErrorConst.ERROR_NAVIGATION_ALREADY_IN_DESTINATION
- 32730004:处理避停状态,常量定义ComponentStatusConst.STATUS_OBSTACLES_AVOID
- 32750004:进电梯,到达电梯门
- 32750005:进电梯,到达电梯中心,开始转向
- 32750023:进电梯,到达电梯中心,转向完成
- 32750009:出电梯,离开电梯门
- 32750008:出电梯,离开电梯中心
- 32750003:进电梯,从电梯口去电梯中心
结果说明:
通过ComponentEvent.status获取到结果码:
- 32610007:到达事件处理,常量定义 ComponentResultConst.RESULT_NAVIGATION_ARRIVED
- -32620015:已在目标位置点,常量定义ComponentErrorConst.ERROR_NAVIGATION_ALREADY_IN_DESTINATION
- -32610004:位置点名称无效,常量定义 ComponentErrorConst.ERROR_PARAMS_PLACE_NAME_INVALID
- -32620007:目标点不存在,常量定义 ComponentErrorConst.ERROR_DESTINATION_NOT_EXIST
- -32620008:目标点移动超时,常量定义 ComponentErrorConst.ERROR_DESTINATION_CAN_NOT_ARRIVE
- 32610009:底盘启动导航任务失败,常量定义 ComponentResultConst.RESULT_NAVIGATION_FAILURE
- -32620006:避让超时,常量定义 ComponentErrorConst.ERROR_REQUEST_RES_BUSYComponentErrorConst.ERROR_NAVIGATION_AVOID_TIMEOUT
- -32660015:进入电梯失败
- -32620009:全局路径规划失败,常量定义 ComponentErrorConst.ERROR_NAVIGATION_GLOBAL_PATH_FAILED
- -32620014:尝试重定位失败,常量定义 ComponentErrorConst.ERROR_NAVIGATION_RESET_ESTIMATE_FAIL
- -32600001:请求结果繁忙,常量定义 ComponentErrorConst.ERROR_REQUEST_RES_BUSY
- -32600002:请求结果失败,常量定义 ComponentErrorConst.ERROR_REQUEST_RES_FAILED
- -32620002:超出地图范围,常量定义 ComponentErrorConst.ERROR_NAVIGATION_OUT_MAP
- -32620001:没有定位,常量定义 ComponentErrorConst.ERROR_NOT_ESTIMATE
- -32620029: 多机器人等待超时,常量定义ComponentErrorConst.ERROR_MULTI_ROBOT_WAITING_TIMEOUT
- -32650006:多模式错误,常量定义ComponentErrorConst.ERROR_MULTIPLE_MODE_ERROR
- -32620030: 轮子过流,常量定义ComponentErrorConst.ERROR_WHEEL_OVER_CURRENT_RUN_OUT
- -32660021:梯控多楼层导航,地图错误
注意:开发中请使用常量定义进行结果及状态判断,以上出现的返回码在后续版本中有可能会发生变更
最低版本: 2.33.0
适用平台:
豹小秘 | mini | 招财豹 | 豹小递max | 豹小秘DP | 消杀豹 |
---|---|---|---|---|---|
否 | 否 | 否 | 否 | 否 | 是 |
充电乘梯
组件名称: ChargeElevatorComponent
组件描述: 乘梯充电组件,用于控制机器人前往不同楼层充电。
使用示例:
//ChargeProvider类文件
import {ChargeStartComponent,ChargeElevatorComponent,ChargeElevatorParam} from 'orionos-eve-core';
@observer
export class ChargeProvider<Props extends BaseComponentProps> extends BaseComponent<BaseComponentProps, ChargeViewModel, ChargeVoice> {
private chargeElevatorParam: ChargeElevatorParam;
private chargeComponentRef: RefObject<
ChargeStartComponent
> = React.createRef();
public constructor(props: any) {
super(props, false);
console.log(TAG, 'constructor prop is ' + JSON.stringify(props));
this.viewModel = new ChargeViewModel(props);
let voice = new ChargeVoice(this.viewModel);
this.setViewModel(this.viewModel);
this.setVoice(voice);
this.chargeStartParam = new ChargeStartParam(
undefined,
undefined,
undefined
);
this.chargeElevatorParam = new ChargeElevatorParam(
undefined,
undefined,
undefined
);
}
public render() {
return (
<>
<ChargeElevatorComponent
ref={this.chargeComponentRef}
param={this.chargeElevatorParam}
onStatusUpdate={
this.viewModel && this.viewModel.onStatusUpdate
}
onFinish={
this.viewModel && this.viewModel.onChargeFinish
}
/>
<>
);
}
}
//ChargeProvider类文件
import {ChargeStartComponent,ChargeElevatorComponent,ChargeElevatorParam} from 'orionos-eve-core';
@observer
export class ChargeProvider<Props extends BaseComponentProps> extends BaseComponent<BaseComponentProps, ChargeViewModel, ChargeVoice> {
private chargeElevatorParam: ChargeElevatorParam;
private chargeComponentRef: RefObject<
ChargeStartComponent
> = React.createRef();
public constructor(props: any) {
super(props, false);
console.log(TAG, 'constructor prop is ' + JSON.stringify(props));
this.viewModel = new ChargeViewModel(props);
let voice = new ChargeVoice(this.viewModel);
this.setViewModel(this.viewModel);
this.setVoice(voice);
this.chargeStartParam = new ChargeStartParam(
undefined,
undefined,
undefined
);
this.chargeElevatorParam = new ChargeElevatorParam(
undefined,
undefined,
undefined
);
}
public render() {
return (
<>
<ChargeElevatorComponent
ref={this.chargeComponentRef}
param={this.chargeElevatorParam}
onStatusUpdate={
this.viewModel && this.viewModel.onStatusUpdate
}
onFinish={
this.viewModel && this.viewModel.onChargeFinish
}
/>
<>
);
}
}
//ChargeProvider类文件 import {ChargeStartComponent,ChargeElevatorComponent,ChargeElevatorParam} from 'orionos-eve-core'; @observer export class ChargeProvider<Props extends BaseComponentProps> extends BaseComponent<BaseComponentProps, ChargeViewModel, ChargeVoice> { private chargeElevatorParam: ChargeElevatorParam; private chargeComponentRef: RefObject< ChargeStartComponent > = React.createRef(); public constructor(props: any) { super(props, false); console.log(TAG, 'constructor prop is ' + JSON.stringify(props)); this.viewModel = new ChargeViewModel(props); let voice = new ChargeVoice(this.viewModel); this.setViewModel(this.viewModel); this.setVoice(voice); this.chargeStartParam = new ChargeStartParam( undefined, undefined, undefined ); this.chargeElevatorParam = new ChargeElevatorParam( undefined, undefined, undefined ); } public render() { return ( <> <ChargeElevatorComponent ref={this.chargeComponentRef} param={this.chargeElevatorParam} onStatusUpdate={ this.viewModel && this.viewModel.onStatusUpdate } onFinish={ this.viewModel && this.viewModel.onChargeFinish } /> <> ); } }
//ChargeViewModel文件
public onStatusUpdate = (event?: ComponentEvent): boolean => {
console.log(TAG, 'onStatusUpdate', event);
if (event) {
switch (event.status) {
case 32730001
DanceOperation.playLightEffect(
LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH
);
break;
default:
break;
}
}
return false;
};
public onChargeFinish = (event?: ComponentEvent): boolean => {
console.log(TAG, ' onChargeFinish', event);
DanceOperation.playLightEffect(
LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT
);
if (event && event.status) {
switch (event.status) {
case 32610001:
console.log(TAG, 'Charge success');
chargeStore.setIsChargeEnable(false);
this.toMain();
break;
case -32620001:
console.log(TAG, 'charge ERROR_NOT_ESTIMATE');
Broadcast.sendBroadcast('action_reposition', {
repositionVision: true
});
break;
case -32620023:
case -32600007:
case -32600008:
case -32600009:
console.log(TAG, 'Charge fail. retry Without Forward...');
chargeStore.setIsChargeEnable(false);
chargeStore.setIsChargeEnable(true);
break;
default:
console.log(TAG, 'Charge error', event.status);
chargeStore.setIsChargeEnable(false);
this.retryCharge();
break;
}
}
return true;
};
//ChargeViewModel文件
public onStatusUpdate = (event?: ComponentEvent): boolean => {
console.log(TAG, 'onStatusUpdate', event);
if (event) {
switch (event.status) {
case 32730001
DanceOperation.playLightEffect(
LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH
);
break;
default:
break;
}
}
return false;
};
public onChargeFinish = (event?: ComponentEvent): boolean => {
console.log(TAG, ' onChargeFinish', event);
DanceOperation.playLightEffect(
LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT
);
if (event && event.status) {
switch (event.status) {
case 32610001:
console.log(TAG, 'Charge success');
chargeStore.setIsChargeEnable(false);
this.toMain();
break;
case -32620001:
console.log(TAG, 'charge ERROR_NOT_ESTIMATE');
Broadcast.sendBroadcast('action_reposition', {
repositionVision: true
});
break;
case -32620023:
case -32600007:
case -32600008:
case -32600009:
console.log(TAG, 'Charge fail. retry Without Forward...');
chargeStore.setIsChargeEnable(false);
chargeStore.setIsChargeEnable(true);
break;
default:
console.log(TAG, 'Charge error', event.status);
chargeStore.setIsChargeEnable(false);
this.retryCharge();
break;
}
}
return true;
};
//ChargeViewModel文件 public onStatusUpdate = (event?: ComponentEvent): boolean => { console.log(TAG, 'onStatusUpdate', event); if (event) { switch (event.status) { case 32730001 DanceOperation.playLightEffect( LIGHT_EFFECT_TYPE.LIGHT_EFFECT_NAVI_BREATH ); break; default: break; } } return false; }; public onChargeFinish = (event?: ComponentEvent): boolean => { console.log(TAG, ' onChargeFinish', event); DanceOperation.playLightEffect( LIGHT_EFFECT_TYPE.LIGHT_EFFECT_BLUE_LIGHT ); if (event && event.status) { switch (event.status) { case 32610001: console.log(TAG, 'Charge success'); chargeStore.setIsChargeEnable(false); this.toMain(); break; case -32620001: console.log(TAG, 'charge ERROR_NOT_ESTIMATE'); Broadcast.sendBroadcast('action_reposition', { repositionVision: true }); break; case -32620023: case -32600007: case -32600008: case -32600009: console.log(TAG, 'Charge fail. retry Without Forward...'); chargeStore.setIsChargeEnable(false); chargeStore.setIsChargeEnable(true); break; default: console.log(TAG, 'Charge error', event.status); chargeStore.setIsChargeEnable(false); this.retryCharge(); break; } } return true; };
属性:
- ref: RefObject<ChargeStartComponent> = React.createRef();
- param:组件参数,new ChargeElevatorParam(undefined, undefined, undefined);
- onStatusUpdate:组件状态回调
- onFinish:组件执行结束回调
状态说明:
通过ComponentEvent.status获取到状态码:
- 32730001:开始导航,常量定义ComponentStatusConst.STATUS_START_NAVIGATION
结果说明:
通过ComponentEvent.status获取到结果码:
- 32610001:充电成功,常量定义 ComponentResultConst.RESULT_SUCCESS
- -32620001:没有定位,常量定义ComponentErrorConst.ERROR_NOT_ESTIMATE
- -32620023:充电位置不能到达,常量定义 ComponentErrorConst.ERROR_CHARGE_POINT_CAN_NOT_ARRIVE
- -32600007:导航超时,常量定义 ComponentErrorConst.ERROR_CHARGE_START_NAVI_TIMEOUT
- -32600008:充电开始解析错误,常量定义 ComponentErrorConst.ERROR_CHARGE_START_PARSE_IN_LOCATION
- -32600009:尝试充电未移动,常量定义 ComponentErrorConst.ERROR_CHARGE_START_NOT_MOVE
注意:开发中请使用常量定义进行结果及状态判断,以上出现的返回码在后续版本中有可能会发生变更
最低版本: 2.33.0
适用平台:
豹小秘 | mini | 招财豹 | 豹小递max | 豹小秘DP | 消杀豹 |
---|---|---|---|---|---|
否 | 否 | 否 | 否 | 否 | 是 |
获取多楼层点位
组件名称: getMultiFloorConfigAndPose
组件描述: 获取多楼层点位列表。
使用示例:
console.log(TAG, 'getElevatorPlaceList()');
let action = new CommandListener();
action.addListener(CommandListener.EVENT_RESULT, (msg: any) => {
console.log(TAG, 'getElevatorPlaceList data : ' + JSON.stringify(msg));
if (msg && typeof msg !== 'undefined') {
if (msg) {
let code = msg.result;
let placeList = msg.message;
if(code === 1 && placeList){
this.processElevatorFloorData(placeList);
}
}
} else {
console.log(TAG, 'current ElevatorPlaceList is not exits');
}
});
RobotApi.getMultiFloorConfigAndCommonPose(action.getId());
//数据结构示例:
[
{
"availableElevators": [ //该地图使用的电梯名称
"1梯",
"2梯"
],
"floorId": 26, //数据主键ID,自增长
"floorIndex": 1, //楼层id,lora发送给梯控时使用的楼层id
"floorState": 1, //楼层类型,主楼层 默认的配送楼层,默认值0,主楼层1
"floorAlias": "1层", //楼层名称
"mapId": "b6fc75006f443c61bc32cdffa66a395c", //地图ID
"mapName": "地图名1", //地图名称
"poseList": [//站点列表
{
"name": "接待点"
},
{
"name": "会议室"
},
{
"name": "办公室"
}
]
},
{
"availableElevators": [
"1梯",
"2梯"
],
"floorId": 27,
"floorIndex": 2,
"floorState": 0,
"floorAlias": "2层",
"mapId": "b6fc75006f443c61bc32cdffa66a395d",
"mapName": "地图名2",
"poseList": [
{
"name": "接待点"
},
{
"name": "会议室"
},
{
"name": "办公室"
}
]
}
]
console.log(TAG, 'getElevatorPlaceList()');
let action = new CommandListener();
action.addListener(CommandListener.EVENT_RESULT, (msg: any) => {
console.log(TAG, 'getElevatorPlaceList data : ' + JSON.stringify(msg));
if (msg && typeof msg !== 'undefined') {
if (msg) {
let code = msg.result;
let placeList = msg.message;
if(code === 1 && placeList){
this.processElevatorFloorData(placeList);
}
}
} else {
console.log(TAG, 'current ElevatorPlaceList is not exits');
}
});
RobotApi.getMultiFloorConfigAndCommonPose(action.getId());
//数据结构示例:
[
{
"availableElevators": [ //该地图使用的电梯名称
"1梯",
"2梯"
],
"floorId": 26, //数据主键ID,自增长
"floorIndex": 1, //楼层id,lora发送给梯控时使用的楼层id
"floorState": 1, //楼层类型,主楼层 默认的配送楼层,默认值0,主楼层1
"floorAlias": "1层", //楼层名称
"mapId": "b6fc75006f443c61bc32cdffa66a395c", //地图ID
"mapName": "地图名1", //地图名称
"poseList": [//站点列表
{
"name": "接待点"
},
{
"name": "会议室"
},
{
"name": "办公室"
}
]
},
{
"availableElevators": [
"1梯",
"2梯"
],
"floorId": 27,
"floorIndex": 2,
"floorState": 0,
"floorAlias": "2层",
"mapId": "b6fc75006f443c61bc32cdffa66a395d",
"mapName": "地图名2",
"poseList": [
{
"name": "接待点"
},
{
"name": "会议室"
},
{
"name": "办公室"
}
]
}
]
console.log(TAG, 'getElevatorPlaceList()'); let action = new CommandListener(); action.addListener(CommandListener.EVENT_RESULT, (msg: any) => { console.log(TAG, 'getElevatorPlaceList data : ' + JSON.stringify(msg)); if (msg && typeof msg !== 'undefined') { if (msg) { let code = msg.result; let placeList = msg.message; if(code === 1 && placeList){ this.processElevatorFloorData(placeList); } } } else { console.log(TAG, 'current ElevatorPlaceList is not exits'); } }); RobotApi.getMultiFloorConfigAndCommonPose(action.getId()); //数据结构示例: [ { "availableElevators": [ //该地图使用的电梯名称 "1梯", "2梯" ], "floorId": 26, //数据主键ID,自增长 "floorIndex": 1, //楼层id,lora发送给梯控时使用的楼层id "floorState": 1, //楼层类型,主楼层 默认的配送楼层,默认值0,主楼层1 "floorAlias": "1层", //楼层名称 "mapId": "b6fc75006f443c61bc32cdffa66a395c", //地图ID "mapName": "地图名1", //地图名称 "poseList": [//站点列表 { "name": "接待点" }, { "name": "会议室" }, { "name": "办公室" } ] }, { "availableElevators": [ "1梯", "2梯" ], "floorId": 27, "floorIndex": 2, "floorState": 0, "floorAlias": "2层", "mapId": "b6fc75006f443c61bc32cdffa66a395d", "mapName": "地图名2", "poseList": [ { "name": "接待点" }, { "name": "会议室" }, { "name": "办公室" } ] } ]
注意:开发中请使用常量定义进行结果及状态判断,以上出现的返回码在后续版本中有可能会发生变更
最低版本: 2.33.0
适用平台:
豹小秘 | mini | 招财豹 | 豹小递max | 豹小秘DP | 消杀豹 |
---|---|---|---|---|---|
否 | 否 | 否 | 否 | 否 | 是 |