|
|
|
@ -172,9 +172,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
|
|
|
|
this.viewport.addFrameTimerCallback(this.item.id, this.onFrameTimer.bind(this)) |
|
|
|
if (!worldModel.state.runState.isVirtual) { |
|
|
|
this.subscribeMessage('/wcs_server/' + this.item.id) |
|
|
|
this.subscribeMessage('/agv_robot/status') |
|
|
|
this.boot() |
|
|
|
this.bootForShow() |
|
|
|
} |
|
|
|
window.agv3 = this |
|
|
|
} |
|
|
|
@ -219,10 +217,19 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
const rbInfo = new this.viewport.ammoModel.btRigidBodyConstructionInfo(mass, boxMotionState, boxShape, localInertia) |
|
|
|
this.boxBody = new this.viewport.ammoModel.btRigidBody(rbInfo) |
|
|
|
this.viewport.physicsWorld.addRigidBody(this.boxBody) |
|
|
|
} |
|
|
|
|
|
|
|
bootForShow() { |
|
|
|
|
|
|
|
this.boot() |
|
|
|
this.subscribeMessage('/wcs_server/' + this.item.id) |
|
|
|
this.subscribeMessage('/agv_robot/status') |
|
|
|
|
|
|
|
if (!worldModel.state.runState.isVirtual) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
bootForMonitor() { |
|
|
|
|
|
|
|
this.boot() |
|
|
|
this.subscribeMessage('/wcs_server/' + this.vehicleId) |
|
|
|
this.send20147() |
|
|
|
setTimeout(() => { |
|
|
|
@ -565,6 +572,8 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
} |
|
|
|
|
|
|
|
if (endDirection != currentStepTask.EndDirection) { |
|
|
|
const item = this.viewport.entityManager.findItemByLogicXY(prevLink.X, prevLink.Y) |
|
|
|
if (item.dt?.agvRotation && item.dt?.agvRotation?.length > 0) { |
|
|
|
const stepTask: StepTask = { |
|
|
|
SeqNo: data.SeqNo, |
|
|
|
StepTaskType: 'ROTATION', |
|
|
|
@ -582,6 +591,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
currentStepTask = stepTask |
|
|
|
this.currentStepTaskList.push(stepTask) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const stepTask: StepTask = { |
|
|
|
SeqNo: data.SeqNo, |
|
|
|
@ -704,7 +714,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
this.runningStepTask = stepTask |
|
|
|
this.currentStepTaskList.shift() |
|
|
|
this.runningStepTaskList.push(stepTask) |
|
|
|
|
|
|
|
console.log('移动') |
|
|
|
this.addTravel(stepTask.X, stepTask.Y, stepTask.EndDirection, stepTask.Speed / 1000) |
|
|
|
|
|
|
|
} else { |
|
|
|
@ -715,12 +725,16 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
this.currentStepTaskList.shift() |
|
|
|
this.runningStepTaskList.push(stepTask) |
|
|
|
if (stepTask.StepTaskType == 'MOVE' || stepTask.StepTaskType == 'MOVE_BACKWARD') { |
|
|
|
console.log('移动') |
|
|
|
this.addTravel(stepTask.X, stepTask.Y, stepTask.EndDirection, stepTask.Speed / 1000) |
|
|
|
} else if (stepTask.StepTaskType == 'ROTATION') { |
|
|
|
console.log('转动') |
|
|
|
this.addRotation(stepTask.EndDirection) |
|
|
|
} else if (stepTask.StepTaskType == 'LOAD') { |
|
|
|
console.log('取货') |
|
|
|
this.addLoad(stepTask.GoodsSlotHeight / 1000, this.agvStatusVo.bizLpn) |
|
|
|
} else if (stepTask.StepTaskType == 'UNLOAD') { |
|
|
|
console.log('放货') |
|
|
|
this.addUnload(stepTask.GoodsSlotHeight / 1000, this.agvStatusVo.bizLpn) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -747,6 +761,9 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
|
|
|
|
// 转
|
|
|
|
addRotation(direction: number): Promise<void> { |
|
|
|
this.OperationType = 0 |
|
|
|
this.PickMode = 0 |
|
|
|
this.TaskMode = 2 |
|
|
|
let rad = 0 |
|
|
|
switch (direction) { |
|
|
|
case 1: |
|
|
|
@ -794,6 +811,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
|
|
|
|
this.OperationType = 0 |
|
|
|
this.PickMode = 0 |
|
|
|
this.TaskMode = 2 |
|
|
|
const pos = Model.getPositionByLogicXY(logicX, logicY) |
|
|
|
this.__toPos = pos as THREE.Vector3 |
|
|
|
//加速度
|
|
|
|
@ -923,6 +941,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
addLoad(height: number, goodsId: string): void { |
|
|
|
this.actionAnimation = 'wq' |
|
|
|
console.log('取货') |
|
|
|
this.TaskMode = 2 |
|
|
|
this.PickMode = 1 |
|
|
|
this.OperationType = 4 |
|
|
|
this.animationUpFork(height).then( |
|
|
|
@ -951,6 +970,7 @@ export default class PtrObject extends THREE.Object3D { |
|
|
|
addUnload(height: number, goodsId: string): void { |
|
|
|
this.actionAnimation = 'wq' |
|
|
|
console.log('卸货') |
|
|
|
this.TaskMode = 2 |
|
|
|
this.PickMode = 2 |
|
|
|
this.OperationType = 4 |
|
|
|
this.animationUpFork(height + 0.2).then( |
|
|
|
|