Browse Source

Merge remote-tracking branch 'origin/master'

master
修宁 6 months ago
parent
commit
43f6cdb497
  1. 82
      src/modules/cl2/Cl23dObject.ts

82
src/modules/cl2/Cl23dObject.ts

@ -356,39 +356,59 @@ export default class Cl23dObject extends THREE.Object3D {
groupPillar.add(ptrForkMesh) groupPillar.add(ptrForkMesh)
this.add(groupPillar) this.add(groupPillar)
// try { try {
// // 安全连接配置 // 安全连接配置
// const client = mqtt.connect('mqtt://127.0.0.1:9001', { const client = mqtt.connect('mqtt://127.0.0.1:9001', {
// path: '/mqtt', path: '/mqtt',
// clientId: 'virtual-' + item.id, clientId: 'virtual-' + item.id,
// clean: true, clean: true,
// connectTimeout: 10000, connectTimeout: 10000,
// username: 'user', username: 'user',
// password: 'user', password: 'user',
// unixSocket: true, unixSocket: true,
// keepalive: 60, keepalive: 60,
// }); });
const m20020 = {
"content": {
"CreateMonoTime": 233701185,
"CreateTime": 1750638957541,
"CurDirection": 1,
"CurLogicX": 13,
"CurLogicY": 10,
"CurOrientation": -3.1375624383367926,
"CurX": 13,
"CurY": 10,
"MarkerType": 1,
"SendTime": 1750638957541,
"SeqNo": 11,
"VehicleId": 10,
"X": 2652.477598132277,
"Y": 3944.4427159671854
},
"id": 20020
}
// 事件绑定 // 事件绑定
// client.on('connect', () => { client.on('connect', () => {
// console.log('Connected'); console.log('Connected');
// client.subscribe(['/wcs_server/' + item.id], { qos: 0 }); client.subscribe(['/wcs_server/' + item.id], { qos: 0 });
// client.publish('/agv_robot/status', 'online', { retain: true }); client.publish('/agv_robot/status', JSON.stringify(m20020), { retain: true });
// }); });
//
// client.on('message', (topic, msg) => { client.on('message', (topic, msg) => {
// console.log(`[${topic}] ${msg}`); console.log(`[${topic}] ${msg}`);
// const a = JSON.parse(msg.toString()); const a = JSON.parse(msg.toString());
// this.handleMessage(a); this.handleMessage(a);
//
// }); });
//
// client.on('error', (error) => { client.on('error', (error) => {
// console.error('Error:', error); console.error('Error:', error);
// }); });
// } catch (e) { } catch (e) {
// console.error(e) console.error(e)
// } }
} }

Loading…
Cancel
Save