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