{"id":681,"date":"2026-06-11T13:55:43","date_gmt":"2026-06-11T05:55:43","guid":{"rendered":"https:\/\/projectleon.net\/make\/blog\/fleet-tracking-lora-leaflet-map-multiple-ugv-farsi\/"},"modified":"2026-06-11T13:55:44","modified_gmt":"2026-06-11T05:55:44","slug":"fleet-tracking-lora-leaflet-map-multiple-ugv-farsi","status":"publish","type":"post","link":"https:\/\/projectleon.net\/make\/blog\/fleet-tracking-lora-leaflet-map-multiple-ugv-farsi\/","title":{"rendered":"\u0633\u0627\u062e\u062a \u0633\u06cc\u0633\u062a\u0645 \u0631\u062f\u06cc\u0627\u0628\u06cc \u0646\u0627\u0648\u06af\u0627\u0646 \u0628\u0627 LoRa \u0648 \u0646\u0642\u0634\u0647 Leaflet: \u0646\u0645\u0627\u06cc\u0634 \u0686\u0646\u062f UGV \u0631\u0648\u06cc \u0646\u0642\u0634\u0647 (\u0641\u0627\u0631\u0633\u06cc)"},"content":{"rendered":"<div class='hero-image-container' style='margin-bottom:28px;border-radius:14px;overflow:hidden;box-shadow:0 4px 18px rgba(0,0,0,0.08)'>\n<img src='https:\/\/projectleon.net\/make\/wp-content\/uploads\/2026\/06\/post126-fleet-tracking.jpg' alt='\u0631\u062f\u06cc\u0627\u0628\u06cc \u0646\u0627\u0648\u06af\u0627\u0646 LoRa Leaflet \u0646\u0642\u0634\u0647 \u0686\u0646\u062f UGV' style='width:100%;height:auto;display:block' loading='eager'\/>\n<\/div>\n<div class='beginner-intro' style='background:#f0f7ff;border-right:4px solid #2e5fb6;padding:16px 20px;border-radius:10px;margin-bottom:22px'>\n<h2 style='margin-top:0'>\u0633\u06cc\u0633\u062a\u0645 \u0631\u062f\u06cc\u0627\u0628\u06cc \u0646\u0627\u0648\u06af\u0627\u0646 \u0686\u06cc\u0633\u062a\u061f (\u0645\u0628\u062a\u062f\u06cc)<\/h2>\n<p>\u062a\u0635\u0648\u0631 \u06a9\u0646\u06cc\u062f \u06f5 UGV \u06cc\u0627 AGV \u062f\u0631 \u06cc\u06a9 \u0645\u062d\u0648\u0637\u0647 \u062f\u0627\u0631\u06cc\u062f \u0648 \u0645\u06cc\u200c\u062e\u0648\u0627\u0647\u06cc\u062f \u0647\u0645\u06cc\u0634\u0647 \u0628\u062f\u0627\u0646\u06cc\u062f \u0647\u0631 \u06a9\u062f\u0627\u0645 \u06a9\u062c\u0627\u0633\u062a. \u0627\u06cc\u0646 \u06cc\u06a9 <strong>\u0633\u06cc\u0633\u062a\u0645 \u0631\u062f\u06cc\u0627\u0628\u06cc \u0646\u0627\u0648\u06af\u0627\u0646<\/strong> \u0627\u0633\u062a. \u0647\u0631 UGV \u06cc\u06a9 \u06af\u0631\u0647 LoRa \u062f\u0627\u0631\u062f \u06a9\u0647 \u0645\u0648\u0642\u0639\u06cc\u062a GPS \u0631\u0627 \u0647\u0631 \u06f3\u06f0 \u062b\u0627\u0646\u06cc\u0647 \u0627\u0631\u0633\u0627\u0644 \u0645\u06cc\u200c\u06a9\u0646\u062f.<\/p>\n<p>\u06cc\u06a9 <strong>Gateway LoRa<\/strong> (Raspberry Pi + SX1278) \u062a\u0645\u0627\u0645 \u0627\u06cc\u0646 \u067e\u06a9\u062a\u200c\u0647\u0627 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u0645\u06cc\u200c\u06a9\u0646\u062f \u0648 \u0628\u0647 \u06cc\u06a9 \u0633\u0631\u0648\u0631 Node.js \u0645\u06cc\u200c\u0641\u0631\u0633\u062a\u062f. \u0633\u0631\u0648\u0631 \u062f\u0627\u062f\u0647 \u0631\u0627 \u062f\u0631 \u062d\u0627\u0641\u0638\u0647 \u0646\u06af\u0647 \u0645\u06cc\u200c\u062f\u0627\u0631\u062f \u0648 \u0627\u0632 \u0637\u0631\u06cc\u0642 WebSocket \u0628\u0647 \u0645\u0631\u0648\u0631\u06af\u0631 \u0645\u06cc\u200c\u0641\u0631\u0633\u062a\u062f. <strong>Leaflet.js<\/strong> \u0646\u0642\u0634\u0647 OpenStreetMap \u0631\u0627 \u062f\u0631 \u0645\u0631\u0648\u0631\u06af\u0631 \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648 \u0645\u0648\u0642\u0639\u06cc\u062a \u0647\u0631 UGV \u0631\u0627 \u0628\u0627 \u06cc\u06a9 \u0622\u06cc\u06a9\u0648\u0646 \u0628\u0647\u200c\u0631\u0648\u0632 \u0645\u06cc\u200c\u06a9\u0646\u062f \u2014 \u0628\u062f\u0648\u0646 \u0646\u06cc\u0627\u0632 \u0628\u0647 Refresh!<\/p>\n<\/div>\n<div style='border:1px solid #d8d8d8;padding:18px 20px;border-radius:12px;background:#fafafa;margin-bottom:22px'>\n<h2 style='margin-top:0'>\u0645\u062d\u0635\u0648\u0644\u06cc \u06a9\u0647 \u0645\u06cc\u200c\u0633\u0627\u0632\u06cc\u062f<\/h2>\n<p>\u062f\u0627\u0634\u0628\u0648\u0631\u062f \u0646\u0642\u0634\u0647 \u0632\u0646\u062f\u0647 \u0686\u0646\u062f UGV \u0628\u0627 LoRa \u0648 Leaflet.js.<\/p>\n<ul>\n<li><strong>\u062a\u0639\u062f\u0627\u062f UGV:<\/strong> \u062a\u0627 \u06f2\u06f5\u06f5 \u06af\u0631\u0647 (\u0628\u0627 ID \u06cc\u06a9 \u0628\u0627\u06cc\u062a\u06cc)<\/li>\n<li><strong>\u0628\u0647\u200c\u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc:<\/strong> \u0647\u0631 \u06f3\u06f0 \u062b\u0627\u0646\u06cc\u0647<\/li>\n<li><strong>\u0646\u0642\u0634\u0647:<\/strong> Leaflet.js \u0631\u0627\u06cc\u06af\u0627\u0646 \u0628\u0627 OSM<\/li>\n<\/ul>\n<\/div>\n<p><svg viewBox='0 0 860 200' width='100%' xmlns='http:\/\/www.w3.org\/2000\/svg' style='background:#fff;border:1px solid #e0e0e0;border-radius:12px;margin-bottom:22px'>\n<!-- UGV\u0647\u0627 -->\n<circle cx='100' cy='120' r='18' fill='#e53935'\/><text x='100' y='124' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#fff'>UGV1<\/text>\n<circle cx='160' cy='80' r='18' fill='#3a60c0'\/><text x='160' y='84' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#fff'>UGV2<\/text>\n<circle cx='80' cy='50' r='18' fill='#4caf50'\/><text x='80' y='54' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#fff'>UGV3<\/text>\n<!-- \u062e\u0637\u0648\u0637 LoRa -->\n<line x1='118' y1='120' x2='300' y2='100' stroke='#ff9800' stroke-width='1.5' stroke-dasharray='5,3'\/>\n<line x1='178' y1='80' x2='300' y2='100' stroke='#ff9800' stroke-width='1.5' stroke-dasharray='5,3'\/>\n<line x1='98' y1='50' x2='300' y2='100' stroke='#ff9800' stroke-width='1.5' stroke-dasharray='5,3'\/>\n<!-- Gateway -->\n<rect x='280' y='80' width='80' height='40' rx='8' fill='#546e7a' stroke='#37474f' stroke-width='2'\/>\n<text x='320' y='105' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#fff'>Gateway<\/text>\n<line x1='360' y1='100' x2='440' y2='100' stroke='#555' stroke-width='2'\/>\n<!-- Server -->\n<rect x='440' y='80' width='80' height='40' rx='8' fill='#1a237e' stroke='#3a60c0' stroke-width='2'\/>\n<text x='480' y='105' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#fff'>Node.js<\/text>\n<!-- \u0646\u0642\u0634\u0647 -->\n<line x1='520' y1='100' x2='600' y2='100' stroke='#555' stroke-width='2' stroke-dasharray='4,2'\/>\n<rect x='600' y='60' width='230' height='80' rx='8' fill='#b3d9f5' stroke='#3a60c0' stroke-width='2'\/>\n<text x='715' y='95' text-anchor='middle' font-size='11' font-family='Tahoma'>\u0646\u0642\u0634\u0647 Leaflet.js<\/text>\n<text x='715' y='112' text-anchor='middle' font-size='9' font-family='Tahoma'>WebSocket \u0632\u0646\u062f\u0647<\/text>\n<text x='430' y='185' text-anchor='middle' font-size='12' font-family='Tahoma' fill='#888'>\u0646\u0627\u0648\u06af\u0627\u0646 UGV \u2014 LoRa \u2192 Gateway \u2192 Node.js \u2192 Leaflet \u0646\u0642\u0634\u0647<\/text>\n<\/svg><\/p>\n<h2>\u06a9\u062f Node.js \u2014 \u0633\u0631\u0648\u0631 Gateway<\/h2>\n<pre style='background:#1e1e1e;color:#d4d4d4;padding:14px;border-radius:10px;overflow-x:auto;font-size:13px'><code class='language-javascript'>\nconst express = require('express');\nconst { SerialPort } = require('serialport');\nconst WebSocket = require('ws');\nconst { ReadlineParser } = require('@serialport\/parser-readline');\n\nconst app = express();\nconst wss = new WebSocket.Server({ port: 8080 });\nconst fleet = {};  \/\/ { ugvId: { lat, lon, timestamp } }\n\n\/\/ \u0633\u0631\u06cc\u0627\u0644 Gateway LoRa (RPi + SX1278):\nconst port = new SerialPort({ path: '\/dev\/ttyUSB0', baudRate: 9600 });\nconst parser = port.pipe(new ReadlineParser({ delimiter: '\\n' }));\n\n\/\/ \u0641\u0631\u0645\u062a \u067e\u06a9\u062a LoRa \u0627\u0632 UGV: \"ID:01,35.744800,51.375300\"\nparser.on('data', (line) => {\n    const parts = line.trim().split(',');\n    if(parts.length === 3 && parts[0].startsWith('ID:')) {\n        const id = parts[0].split(':')[1];\n        const lat = parseFloat(parts[1]);\n        const lon = parseFloat(parts[2]);\n        if(!isNaN(lat) && !isNaN(lon)) {\n            fleet[id] = { lat, lon, ts: Date.now() };\n            \/\/ \u0627\u0631\u0633\u0627\u0644 \u0628\u0647 \u0647\u0645\u0647 \u0645\u0631\u0648\u0631\u06af\u0631\u0647\u0627:\n            wss.clients.forEach(c => {\n                if(c.readyState === WebSocket.OPEN)\n                    c.send(JSON.stringify({ id, lat, lon }));\n            });\n        }\n    }\n});\n\n\/\/ \u0635\u0641\u062d\u0647 \u0646\u0642\u0634\u0647:\napp.get('\/', (req, res) => res.sendFile(__dirname + '\/map.html'));\napp.get('\/api\/fleet', (req, res) => res.json(fleet));\napp.listen(3000, () => console.log('Fleet tracker: http:\/\/localhost:3000'));\n<\/code><\/pre>\n<h2>\u06a9\u062f Leaflet HTML \u2014 \u0646\u0642\u0634\u0647 \u0632\u0646\u062f\u0647<\/h2>\n<pre style='background:#1e1e1e;color:#d4d4d4;padding:14px;border-radius:10px;overflow-x:auto;font-size:13px'><code class='language-html'>\n&lt;!-- map.html --&gt;\n&lt;link rel=\"stylesheet\" href=\"https:\/\/unpkg.com\/leaflet\/dist\/leaflet.css\"&gt;\n&lt;script src=\"https:\/\/unpkg.com\/leaflet\/dist\/leaflet.js\"&gt;&lt;\/script&gt;\n&lt;div id=\"map\" style=\"height:100vh\"&gt;&lt;\/div&gt;\n&lt;script&gt;\nconst map = L.map('map').setView([35.7448, 51.3753], 15);\nL.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png').addTo(map);\n\nconst colors = ['red','blue','green','orange','purple'];\nconst markers = {};\n\nconst ws = new WebSocket('ws:\/\/localhost:8080');\nws.onmessage = (e) =&gt; {\n    const d = JSON.parse(e.data);\n    if(!markers[d.id]) {\n        const ci = Object.keys(markers).length % colors.length;\n        markers[d.id] = L.marker([d.lat, d.lon], {\n            title: 'UGV ' + d.id\n        }).addTo(map).bindPopup('UGV ' + d.id);\n    } else {\n        markers[d.id].setLatLng([d.lat, d.lon]);\n    }\n};\n&lt;\/script&gt;\n<\/code><\/pre>\n<h2>\u0686\u06a9\u200c\u0644\u06cc\u0633\u062a \u0633\u06cc\u0633\u062a\u0645<\/h2>\n<table style='width:100%;border-collapse:collapse;margin-bottom:18px'>\n<thead>\n<tr style='background:#e8f0fe'>\n<th style='padding:9px;border:1px solid #ddd;text-align:right'>\u0628\u0631\u0631\u0633\u06cc<\/th>\n<th style='padding:9px;border:1px solid #ddd;text-align:right'>\u062a\u0648\u0636\u06cc\u062d<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style='padding:8px;border:1px solid #ddd'>Gateway \u067e\u06a9\u062a UGV \u0631\u0627 \u0645\u06cc\u200c\u06af\u06cc\u0631\u062f\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>Serial Monitor RPi<\/td>\n<\/tr>\n<tr style='background:#fafafa'>\n<td style='padding:8px;border:1px solid #ddd'>Node.js \u067e\u0627\u0631\u0633 \u0645\u06cc\u200c\u06a9\u0646\u062f\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>console.log fleet<\/td>\n<\/tr>\n<tr>\n<td style='padding:8px;border:1px solid #ddd'>\u0646\u0642\u0634\u0647 \u0631\u0648\u06cc \u0645\u0631\u0648\u0631\u06af\u0631 \u0628\u0627\u0632 \u0645\u06cc\u200c\u0634\u0648\u062f\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>http:\/\/localhost:3000<\/td>\n<\/tr>\n<tr style='background:#fafafa'>\n<td style='padding:8px;border:1px solid #ddd'>\u0645\u06a9\u0627\u0646\u200c\u0647\u0627 \u0628\u0647\u200c\u0631\u0648\u0632 \u0645\u06cc\u200c\u0634\u0648\u0646\u062f\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>WebSocket test<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><svg viewBox='0 0 860 200' width='100%' xmlns='http:\/\/www.w3.org\/2000\/svg' style='background:#fff;border:1px solid #e0e0e0;border-radius:12px;margin-bottom:22px'>\n<rect x='40' y='75' width='155' height='60' rx='12' fill='#f7d794' stroke='#a06d00' stroke-width='2'\/>\n<rect x='245' y='75' width='155' height='60' rx='12' fill='#8bd3dd' stroke='#1f6f78' stroke-width='2'\/>\n<rect x='450' y='75' width='155' height='60' rx='12' fill='#b7e4a0' stroke='#3a7a1e' stroke-width='2'\/>\n<rect x='655' y='75' width='165' height='60' rx='12' fill='#e8f4ff' stroke='#3a60c0' stroke-width='2'\/>\n<line x1='195' y1='105' x2='245' y2='105' stroke='#555' stroke-width='2.5' stroke-dasharray='6,3'\/>\n<line x1='400' y1='105' x2='450' y2='105' stroke='#555' stroke-width='2.5'\/>\n<line x1='605' y1='105' x2='655' y2='105' stroke='#555' stroke-width='2.5' stroke-dasharray='4,2'\/>\n<text x='117' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>UGV\u0647\u0627 GPS<\/text>\n<text x='117' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>LoRa TX<\/text>\n<text x='322' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>RPi Gateway<\/text>\n<text x='322' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>SX1278 RX<\/text>\n<text x='527' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>Node.js<\/text>\n<text x='527' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>WebSocket<\/text>\n<text x='737' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>Leaflet \u0646\u0642\u0634\u0647<\/text>\n<text x='737' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>\u0632\u0646\u062f\u0647<\/text>\n<text x='430' y='175' text-anchor='middle' font-size='13' font-family='Tahoma' fill='#666'>\u0646\u0627\u0648\u06af\u0627\u0646 \u2014 LoRa GPS \u2192 Node.js \u2192 WebSocket \u2192 Leaflet \u0646\u0642\u0634\u0647<\/text>\n<\/svg><\/p>\n<h2>\u0648\u06cc\u062f\u0626\u0648\u0647\u0627\u06cc \u0622\u0645\u0648\u0632\u0634\u06cc<\/h2>\n<div style='display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:18px;margin:20px 0'>\n<iframe width='100%' height='315' src='https:\/\/www.youtube.com\/embed\/mLrXOSCPf5E' title='LoRa GPS Fleet Tracking System Tutorial' frameborder='0' allow='accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture' allowfullscreen><\/iframe><br \/>\n<iframe width='100%' height='315' src='https:\/\/www.youtube.com\/embed\/KzR-MUP5kQ8' title='Leaflet.js Real-time Map Node.js WebSocket' frameborder='0' allow='accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture' allowfullscreen><\/iframe>\n<\/div>\n<h2>\u0645\u0646\u0627\u0628\u0639 \u0628\u06cc\u0634\u062a\u0631<\/h2>\n<ul>\n<li><a href='https:\/\/www.aparat.com\/result\/%D8%B1%D8%AF%DB%8C%D8%A7%D8%A8%DB%8C_%D9%84%D9%88%D8%B1%D8%A7_%D9%86%D9%82%D8%B4%D9%87' target='_blank'>\u0622\u067e\u0627\u0631\u0627\u062a: \u0631\u062f\u06cc\u0627\u0628\u06cc \u0644\u0648\u0631\u0627 \u0646\u0642\u0634\u0647 \u0641\u0627\u0631\u0633\u06cc<\/a><\/li>\n<li><a href='https:\/\/leafletjs.com\/examples\/quick-start\/' target='_blank'>Leaflet.js: Quick Start Guide<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0622\u0645\u0648\u0632\u0634 \u0633\u0627\u062e\u062a \u0633\u06cc\u0633\u062a\u0645 \u0631\u062f\u06cc\u0627\u0628\u06cc \u0646\u0627\u0648\u06af\u0627\u0646 \u0686\u0646\u062f UGV \u0628\u0627 LoRa Gateway\u060c Node.js\u060c \u0648 \u0646\u0642\u0634\u0647 Leaflet.js \u0631\u0648\u06cc \u0645\u0631\u0648\u0631\u06af\u0631\u061b \u0647\u0631 UGV \u0645\u0648\u0642\u0639\u06cc\u062a GPS \u0631\u0627 \u0647\u0631 \u06f3\u06f0\u062b\u0627\u0646\u06cc\u0647 \u0627\u0631\u0633\u0627\u0644 \u0645\u06cc\u200c\u06a9\u0646\u062f.<\/p>\n","protected":false},"author":1,"featured_media":680,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[19,16],"tags":[47,471,44,472,50,470,363,473],"class_list":["post-681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials-2","category-ugv","tag-gps","tag-leaflet","tag-lora","tag-node-js","tag-50","tag-470","tag-363","tag--ugv"],"_links":{"self":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/comments?post=681"}],"version-history":[{"count":1,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/681\/revisions"}],"predecessor-version":[{"id":682,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/681\/revisions\/682"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media\/680"}],"wp:attachment":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/categories?post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/tags?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}