|
@@ -11,7 +11,8 @@ import { StreamService } from './stream/stream.service';
|
|
|
// import { InjectQueue } from '@nestjs/bull';
|
|
|
// import { Queue } from 'bull';
|
|
|
import { RotateService } from 'src/rotate/rotate.service';
|
|
|
-import { DelayQueue, RxQueue, DebounceQueue } from 'rx-queue';
|
|
|
+// import { DelayQueue, RxQueue, DebounceQueue } from 'rx-queue';
|
|
|
+import { DelayQueue, RxQueue, DebounceQueue } from '../queue/mod';
|
|
|
import { MoveService } from 'src/move/move.service';
|
|
|
import { GetRouterService } from 'src/get-router/get-router.service';
|
|
|
import { ConfigService } from '@nestjs/config';
|
|
@@ -355,6 +356,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.logger.log('walking-trace_id', request.trace_id);
|
|
|
// 进入正常walking流程
|
|
|
if (!this.onMoving.getValue()) {
|
|
|
+ console.log('walking-step-main-1', request.trace_id);
|
|
|
this.latestWalkingRequest = null;
|
|
|
this.handleWalking(request);
|
|
|
}
|
|
@@ -362,13 +364,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (!this.moveSliceLastFrameSub) {
|
|
|
this.moveSliceLastFrameSub = this.moveSliceLastFrame.subscribe(
|
|
|
async (frame: MovingLastUpdateType) => {
|
|
|
+ console.log('walkingStop-'+ this.latestWalkingRequest + ','+ this.onMoving.value);
|
|
|
//TODO 正在行走时,有新的reqest
|
|
|
if (this.latestWalkingRequest && this.onMoving.value) {
|
|
|
this.logger.log('stop-data-1', frame);
|
|
|
// this.moveQueue.complete();
|
|
|
// this.moveQueue.of('');
|
|
|
// TODO 中断move队列 ?优化如何清空
|
|
|
- // this.moveQueue.pipe(ignoreElements());
|
|
|
+ this.moveQueue.clean();
|
|
|
this.moveQueueSubscription.unsubscribe();
|
|
|
this.moveQueueSubscription = null;
|
|
|
//step1 执行stop方法
|
|
@@ -398,6 +401,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
);
|
|
|
this.logger.log('stop-redisMeta', redisMeta);
|
|
|
// 2. 中断重新walking
|
|
|
+ console.log('walking-step-reWalking-1', request.trace_id);
|
|
|
this.handleReWalking(this.latestWalkingRequest);
|
|
|
}
|
|
|
},
|
|
@@ -414,11 +418,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
async handleWalking(request: MoveRequest): Promise<void> {
|
|
|
try {
|
|
|
// if (!this.onMoving.getValue()) {
|
|
|
+ console.log('walking-step-main-2', request.trace_id);
|
|
|
const start = performance.now();
|
|
|
this._rotateCount = 0;
|
|
|
const user = this.moveService.users[this.user_id];
|
|
|
- this.logger.log('进入1 - searchRoad');
|
|
|
- this.logger.log('path-start' + user.breakPointId);
|
|
|
+ console.log('进入1 - searchRoad');
|
|
|
+ console.log('path-start' + user.breakPointId);
|
|
|
const path = await this.getRouterService.searchRoad(
|
|
|
user.appId,
|
|
|
user.breakPointId,
|
|
@@ -426,7 +431,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
);
|
|
|
this.logger.log('walking-path', path);
|
|
|
if (!path) {
|
|
|
- this.logger.log('不存在--path', path);
|
|
|
+ console.log('不存在--path', path);
|
|
|
this.resumeStream();
|
|
|
return;
|
|
|
}
|
|
@@ -535,7 +540,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
|
this.logger.log(
|
|
|
'joystick-breakPointId:' +
|
|
|
- this.moveService.users[this.user_id].breakPointId,
|
|
|
+ this.moveService.users[this.user_id].breakPointId,
|
|
|
);
|
|
|
// 有数据 [0]是rotate数据,[1-infinity]是walking数据
|
|
|
this.logger.log('joystickRes-1', joystickRes);
|
|
@@ -783,7 +788,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
}
|
|
|
} else {
|
|
|
const msg: RTCMessageRequest = JSON.parse(message);
|
|
|
- console.log('msg.action_type:' + msg.action_type);
|
|
|
+ // console.log('msg.action_type:' + msg.action_type);
|
|
|
switch (msg.action_type) {
|
|
|
case ActionType.walk:
|
|
|
const walk = msg as any as MoveRequest;
|