|
|
|
@ -39,9 +39,13 @@ function AGVanimate() {
|
|
|
|
|
AGVanimate()
|
|
|
|
|
|
|
|
|
|
let floorData = {
|
|
|
|
|
floor2Data: {
|
|
|
|
|
x: 1314,
|
|
|
|
|
z: 636
|
|
|
|
|
},
|
|
|
|
|
floor3Data: {
|
|
|
|
|
x: 100,
|
|
|
|
|
z: 100
|
|
|
|
|
x: 1314,
|
|
|
|
|
z: 636
|
|
|
|
|
},
|
|
|
|
|
floor5Data: {
|
|
|
|
|
x: 1314,
|
|
|
|
@ -50,6 +54,14 @@ let floorData = {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let agvData = {
|
|
|
|
|
floor2AGVGroup: null,
|
|
|
|
|
floor2AGV: null,
|
|
|
|
|
floor2AGVData: {
|
|
|
|
|
x: 0,
|
|
|
|
|
z: 0,
|
|
|
|
|
rotate: 0
|
|
|
|
|
},
|
|
|
|
|
floor2AGVGroupLocation: {},
|
|
|
|
|
floor3AGVGroup: null,
|
|
|
|
|
floor3AGV: null,
|
|
|
|
|
floor3AGVData: {
|
|
|
|
@ -57,10 +69,15 @@ let agvData = {
|
|
|
|
|
z: 0,
|
|
|
|
|
rotate: 0
|
|
|
|
|
},
|
|
|
|
|
floor4AGVGroup: null,
|
|
|
|
|
floor4AGV: null,
|
|
|
|
|
floor3AGVGroupLocation: {},
|
|
|
|
|
floor5CCAGVGroup: null,
|
|
|
|
|
floor5CCAGV: null,
|
|
|
|
|
floor5CCAGVGroupLocation: {},
|
|
|
|
|
floor5CCAGVData: {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
rotate: 0
|
|
|
|
|
},
|
|
|
|
|
floor5BFAGVGroup: null,
|
|
|
|
|
floor5BFAGV: null,
|
|
|
|
|
floor5BFAGVGroupLocation: {},
|
|
|
|
@ -70,18 +87,75 @@ let agvData = {
|
|
|
|
|
rotate: 0
|
|
|
|
|
},
|
|
|
|
|
floor5CTUGroup: null,
|
|
|
|
|
floor5CTU: null
|
|
|
|
|
floor5CTU: null,
|
|
|
|
|
floor5CTUGroupLocation: {},
|
|
|
|
|
floor5CTUData: {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
rotate: 0
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getFloor5BFAGV = () => {
|
|
|
|
|
let loadAGVEnum = {
|
|
|
|
|
'beifushiAGV005': 'floor5BFAGV',
|
|
|
|
|
'chacheshiAGV005': 'floor5CCAGV',
|
|
|
|
|
'CTU005': 'floor5CTU',
|
|
|
|
|
'chacheshiAGV002': 'floor2AGV',
|
|
|
|
|
'chacheshiAGV003': 'floor3AGV',
|
|
|
|
|
}
|
|
|
|
|
let loadAGVGroupEnum = {
|
|
|
|
|
'beifushiAGV005': 'floor5BFAGVGroup',
|
|
|
|
|
'chacheshiAGV005': 'floor5CCAGVGroup',
|
|
|
|
|
'CTU005': 'floor5CTUGroup',
|
|
|
|
|
'chacheshiAGV002': 'floor2AGVGroup',
|
|
|
|
|
'chacheshiAGV003': 'floor3AGVGroup',
|
|
|
|
|
}
|
|
|
|
|
let LoadAGVDataEnum = {
|
|
|
|
|
'beifushiAGV005': 'floor5BFAGVData',
|
|
|
|
|
'chacheshiAGV005': 'floor5CCAGVData',
|
|
|
|
|
'CTU005': 'floor5CTUData',
|
|
|
|
|
'chacheshiAGV002': 'floor2AGVData',
|
|
|
|
|
'chacheshiAGV003': 'floor3AGVData',
|
|
|
|
|
}
|
|
|
|
|
let LoadAGVLocationEnum = {
|
|
|
|
|
'beifushiAGV005': 'floor5BFAGVGroupLocation',
|
|
|
|
|
'chacheshiAGV005': 'floor5CCAGVGroupLocation',
|
|
|
|
|
'CTU005': 'floor5CTUGroupLocation',
|
|
|
|
|
'chacheshiAGV002': 'floor2AGVGroupLocation',
|
|
|
|
|
'chacheshiAGV003': 'floor3AGVGroupLocation',
|
|
|
|
|
}
|
|
|
|
|
let axisEnum = {
|
|
|
|
|
'beifushiAGV005':{
|
|
|
|
|
z : 11.6
|
|
|
|
|
},
|
|
|
|
|
'chacheshiAGV002': {
|
|
|
|
|
// z : 11.6
|
|
|
|
|
},
|
|
|
|
|
'chacheshiAGV003': {
|
|
|
|
|
// z : 11.6
|
|
|
|
|
},
|
|
|
|
|
'chacheshiAGV005': {
|
|
|
|
|
// z : 11.6
|
|
|
|
|
},
|
|
|
|
|
'CTU005': {
|
|
|
|
|
x:-5,
|
|
|
|
|
z : -20
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
const loadAGV = (r) => {
|
|
|
|
|
r.forEach(e => {
|
|
|
|
|
let agvName = loadAGVEnum[e]
|
|
|
|
|
let agvGroupName = loadAGVGroupEnum[e]
|
|
|
|
|
let agvDataName = LoadAGVDataEnum[e]
|
|
|
|
|
let agvLocationName = LoadAGVLocationEnum[e]
|
|
|
|
|
let mtlLoader = new MTLLoader()
|
|
|
|
|
mtlLoader.load(`/model/beifushiAGV005/beifushiAGV005.mtl`,
|
|
|
|
|
mtlLoader.load(`/model/${e}/${e}.mtl`,
|
|
|
|
|
materials => {
|
|
|
|
|
materials.preload()
|
|
|
|
|
let loader = new OBJLoader()
|
|
|
|
|
loader.setMaterials(materials)
|
|
|
|
|
loader.load(
|
|
|
|
|
`/model/beifushiAGV005/beifushiAGV005.obj`,
|
|
|
|
|
`/model/${e}/${e}.obj`,
|
|
|
|
|
object => {
|
|
|
|
|
object.children[0].geometry.computeBoundingBox()
|
|
|
|
|
let axis = new THREE.Vector3()
|
|
|
|
@ -89,40 +163,61 @@ const getFloor5BFAGV = () => {
|
|
|
|
|
axis.multiplyScalar(0.5)
|
|
|
|
|
axis.applyMatrix4(object.children[0].matrixWorld)
|
|
|
|
|
|
|
|
|
|
agvData.floor5BFAGVGroup = new THREE.Group()
|
|
|
|
|
agvData[agvGroupName] = new THREE.Group()
|
|
|
|
|
console.log(object)
|
|
|
|
|
agvData.floor5BFAGVGroup.add(object)
|
|
|
|
|
axis.z += 11.6
|
|
|
|
|
agvData.floor5BFAGVGroup.position.set(axis.x, axis.y, axis.z)
|
|
|
|
|
agvData.floor5BFAGVGroupLocation = axis
|
|
|
|
|
agvData[agvGroupName].add(object)
|
|
|
|
|
let axisDis = axisEnum[e]
|
|
|
|
|
Object.keys(axisDis || {}).forEach(v=>{
|
|
|
|
|
axis[v] += axisDis[v]
|
|
|
|
|
})
|
|
|
|
|
agvData[agvGroupName].position.set(axis.x, axis.y, axis.z)
|
|
|
|
|
agvData[agvLocationName] = axis
|
|
|
|
|
object.position.set(-axis.x, -axis.y, -axis.z)
|
|
|
|
|
agvData.floor5BFAGVData.x = axis.x
|
|
|
|
|
agvData.floor5BFAGVData.z = axis.z
|
|
|
|
|
scene.add(agvData.floor5BFAGVGroup)
|
|
|
|
|
agvData[agvDataName].x = axis.x
|
|
|
|
|
agvData[agvDataName].z = axis.z
|
|
|
|
|
scene.add(agvData[agvGroupName])
|
|
|
|
|
|
|
|
|
|
object.name = 'tishengji_tuopan'
|
|
|
|
|
// scene.add(object)
|
|
|
|
|
|
|
|
|
|
agvData.floor5BFAGV = object
|
|
|
|
|
agvData[agvName] = object
|
|
|
|
|
// 更新渲染器
|
|
|
|
|
renderer.render(scene, camera)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
getFloor5BFAGV()
|
|
|
|
|
// loadAGV(['chacheshiAGV002','chacheshiAGV003','chacheshiAGV005','beifushiAGV005','CTU005'])
|
|
|
|
|
loadAGV(['CTU005'])
|
|
|
|
|
|
|
|
|
|
let AGVGroupEnum = {
|
|
|
|
|
'5BFAGV': 'floor5BFAGVGroupLocation'
|
|
|
|
|
'5BFAGV': 'floor5BFAGVGroupLocation',
|
|
|
|
|
'5CCAGV': 'floor5CCAGVGroupLocation',
|
|
|
|
|
'5CTU': 'floor5CTUGroupLocation',
|
|
|
|
|
'2AGV': 'floor2AGVGroupLocation',
|
|
|
|
|
'3AGV': 'floor3AGVGroupLocation',
|
|
|
|
|
}
|
|
|
|
|
let AGVDataEnum = {
|
|
|
|
|
'5BFAGV': 'floor5BFAGVData'
|
|
|
|
|
'5BFAGV': 'floor5BFAGVData',
|
|
|
|
|
'5CCAGV': 'floor5CCAGVData',
|
|
|
|
|
'5CTU': 'floor5CTUData',
|
|
|
|
|
'2AGV': 'floor2AGVData',
|
|
|
|
|
'3AGV': 'floor3AGVData',
|
|
|
|
|
}
|
|
|
|
|
let groupEnum = {
|
|
|
|
|
'5BFAGV': 'floor5BFAGVGroup'
|
|
|
|
|
'5BFAGV': 'floor5BFAGVGroup',
|
|
|
|
|
'5CCAGV': 'floor5CCAGVGroup',
|
|
|
|
|
'5CTU': 'floor5CTUGroup',
|
|
|
|
|
'2AGV': 'floor2AGVGroup',
|
|
|
|
|
'3AGV': 'floor3AGVGroup',
|
|
|
|
|
}
|
|
|
|
|
let floorEnum = {
|
|
|
|
|
'5BFAGV': 'floor5Data'
|
|
|
|
|
'5BFAGV': 'floor5Data',
|
|
|
|
|
'5CCAGV': 'floor5Data',
|
|
|
|
|
'5CTU': 'floor5Data',
|
|
|
|
|
'2AGV': 'floor2Data',
|
|
|
|
|
'3AGV': 'floor3Data',
|
|
|
|
|
}
|
|
|
|
|
let rotateF = (e) => {
|
|
|
|
|
e %= 360
|
|
|
|
@ -138,6 +233,12 @@ let rotateF = (e) => {
|
|
|
|
|
const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
|
|
|
|
|
let s = 1
|
|
|
|
|
newLocation %= 360
|
|
|
|
|
if((item === '2AGV' || item === '3AGV'|| item === '5CCAGV') && type === 'rotate'){
|
|
|
|
|
newLocation -= 90
|
|
|
|
|
}
|
|
|
|
|
if((item === '5CTU' ) && type === 'rotate'){
|
|
|
|
|
newLocation += 90
|
|
|
|
|
}
|
|
|
|
|
let AGVGroupLocationData = AGVGroupEnum[item]
|
|
|
|
|
let AGVLocationData = AGVDataEnum[item]
|
|
|
|
|
let group = groupEnum[item]
|
|
|
|
@ -288,7 +389,9 @@ setInterval(() => {
|
|
|
|
|
if (agvData.floor5BFAGVGroup) {
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
setTimeout(() =>{
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1 = Math.random()
|
|
|
|
|
// let num1 = 0.6
|
|
|
|
|
// let num1 = 0.4
|
|
|
|
@ -299,7 +402,62 @@ setInterval(() => {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5BFAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1 = Math.random()
|
|
|
|
|
// let num1 = 0.6
|
|
|
|
|
// let num1 = 0.4
|
|
|
|
|
if (num1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1 = Math.random()
|
|
|
|
|
// let num1 = 0.6
|
|
|
|
|
// let num1 = 0.4
|
|
|
|
|
if (num1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1 = Math.random()
|
|
|
|
|
// let num1 = 0.6
|
|
|
|
|
// let num1 = 0.4
|
|
|
|
|
if (num1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
},200000000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() =>{
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1 = Math.random()
|
|
|
|
|
// let num1 = 0.6
|
|
|
|
|
// let num1 = 0.4
|
|
|
|
|
if (num1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
},20000000)
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
agvData,
|
|
|
|
|