مستندات این بخش نحوه ایجاد و مدیریت وسایل نقلیه در Fleet Engine را شرح می دهد. شما وسایل نقلیه ای را در محیط سرور Fleet Engine ایجاد می کنید تا وسایل نقلیه واقعی را در عملیات دنیای واقعی خود منعکس کنید. وسایل نقلیه Fleet Engine شما همچنین باید مطابق با وسایل مورد استفاده در سیستم backend شما باشد که برای تخصیص وسایل نقلیه و مسیریابی استفاده می کنید.
شما از یک روش ایجاد برای ایجاد یک منبع وسیله نقلیه، یا با استفاده از gRPC یا REST استفاده می کنید. نام فیلدها در این راهنما از نماد gRPC برای سادگی استفاده می کنند.
برای هر دو قابلیت کار بر حسب تقاضا و زمانبندی شده، شما یک وسیله نقلیه را با ارسال یک پیام درخواست با فیلدها ایجاد و به روز میکنید که به صورت زیر خلاصه میشود:
والد : رشتهای مرتبط با شناسه پروژه Google Cloud شما که برای پر کردن فیلد نام نمونه وسیله نقلیه استفاده میشود.
شناسه وسیله نقلیه : رشته منحصر به فردی که برای پر کردن فیلد name وسیله نقلیه استفاده می شود.
یک نمونه وسیله نقلیه با فیلدهای مورد نیاز آن. این فیلدها به قابلیت Fleet Engine که استفاده می کنید بستگی دارد.
اطلاعات موجود در بدنه درخواست با ماهیت درخواست متفاوت است. این جزئیات را در راهنمای مربوطه مشاهده کنید.
توکن های احراز هویت و مجوز
درخواست به Fleet Engine نیز باید اعتبار دسترسی صحیح را ارائه کند. مثالهای این راهنما دارای مفروضات زیر هستند:
نمونههای gRPC استفاده از کتابخانه مجوز برای جاوا را فرض میکنند.
مثالهای REST یک هدر درخواست HTTP را نشان میدهند که باید حاوی فیلد Authorization با مقدار Bearer <token> باشد که در آن <token> یک رمز وب JSON است که شما صادر میکنید .
فقط فیلدهای خروجی فیلدهایی که توسط سرویس به عنوان خروجی روش دیگری تنظیم می شوند و نمی توانند مستقیماً تنظیم شوند . یک فیلد مهم از این نوع، فیلد name است. Fleet Engine هر مقدار ارائه شده برای فیلد name وسیله نقلیه را در هر راهنمایی از Google AIP برای شناسه های مشخص شده توسط کاربر نادیده می گیرد. اگر مقادیری را برای این فیلدها ارائه کنید، Fleet Engine یک خطا برمیگرداند.
فیلدهای مورد نیاز وسایل نقلیه ایجاد شده در سرویس سفر درخواستی نیاز به تنظیم فیلدهای خاصی در ایجاد ایجاد دارند. وسایل نقلیه ایجاد شده در سرویس وظایف برنامهریزی شده، هیچ فیلد منبع مورد نیاز وسیله نقلیه ندارند.
فیلدهای اختیاری هر دو سرویس دارای فیلدهایی هستند که می توانید هنگام ایجاد یا پس از آن تنظیم کنید. اینها را می توان در راهنمای مرجع مربوطه برای سرویسی که استفاده می کنید پیدا کنید.
نام خودرو (فقط خروجی)
قسمت name دقیقاً برای سفرهای درخواستی و خدمات برنامه ریزی شده یکسان است. Fleet Engine بر اساس دو فیلدی که هنگام ایجاد وسیله نقلیه تنظیم کرده اید، فیلد را هنگام ایجاد وسیله نقلیه تعریف می کند:
والد : رشته ای مرتبط با شناسه پروژه Google Cloud شما از providers/{provider} که در آن {provider} شناسه پروژه Cloud شما است. هر وسیله نقلیه ای که برای یک پروژه خاص ایجاد می کنید، مسیر اصلی یکسانی خواهد داشت.
پروژه Cloud که در اینجا به آن اشاره میکنید باید شامل نقشهای حساب سرویس Fleet Engine برای سرویسی باشد که استفاده میکنید. برای لیستی از آن حساب های خدماتی به حساب های خدمات مراجعه کنید. Fleet Engine از دسترسی چندین پروژه Google Cloud پشتیبانی نمی کند.
شناسه وسیله نقلیه ، که باید در همه وسایل نقلیه ناوگان شما منحصر به فرد باشد و یک رشته معتبر یونیکد باشد. این شناسه منبع برای وسیله نقلیه است. هم سفرهای درخواستی و هم توقف های برنامه ریزی شده از این برای مرتبط کردن یک سفر یا یک کار با وسیله نقلیه ای که آن را تکمیل می کند، استفاده می کنند.
در سرویسهای مبتنی بر Google Cloud، همه APIها باید منابع را به صورت رشته نمایش دهند. برای جزئیات بیشتر به نامگذاری منابع در Fleet Engine مراجعه کنید.
شناسه های موجودیت منحصر به فرد
قالب و مقدار شناسه های موجودیت منحصر به فرد مورد استفاده در فراخوانی منابع برای Fleet Engine غیرشفاف است. اطمینان حاصل کنید که شناسه حاوی اطلاعات قابل شناسایی شخصی (PII) مانند شماره تلفن راننده نباشد.
استفاده مجدد از خودرو
پس از اینکه یک وسیله نقلیه تمام توقفهای یک برنامه سفر مشخص را انجام داد، برای استفاده مجدد در Fleet Engine به مدت 7 روز در دسترس باقی میماند، به این معنی که میتوانید در روزهای کاری بعدی از یک وسیله نقلیه مجدداً استفاده کنید بدون اینکه نیازی به ایجاد وسیلهای جدید داشته باشید. هر بار که از وسیله نقلیه استفاده مجدد می کنید، Fleet Engine در دسترس بودن آن را بازنشانی می کند، در این مرحله شمارش معکوس 7 روزه از نو شروع می شود.
روش توصیه شده برای در دسترس نگه داشتن یک وسیله نقلیه در Fleet Engine این است که مکان آن را در فواصل زمانی منظم به روز کنید. بهروزرسانیهای بیشتر فیلدهای دیگر موجودیت Vehicle نیز عمر آن را افزایش میدهد، مشروط بر اینکه مقدار فیلد جدید با مقدار موجود متفاوت باشد.
توجه: برخی از فیلدهای موجود در Vehicle مانند device_settings صرفاً اطلاعات اشکال زدایی هستند که توسط Fleet Engine وجود ندارد. به روز رسانی آنها عمر Vehicle را افزایش نمی دهد.
برای تجزیه و تحلیل سیستم بهبود یافته، بهتر است از جفت شدن شناسه راننده-خودرو هر روز دوباره استفاده کنید. این کار را با استفاده از همان شناسه وسیله نقلیه مرتبط با راننده برای توقف های برنامه ریزی شده قبلی یا سفرهای درخواستی انجام دهید.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eFleet Engine enables the creation and management of virtual vehicles that mirror real-world vehicles for dispatch and routing purposes.\u003c/p\u003e\n"],["\u003cp\u003eVehicles are created using gRPC or REST methods, requiring a unique vehicle ID and Google Cloud project association for identification.\u003c/p\u003e\n"],["\u003cp\u003eVehicle resources have output-only, required, and optional fields, with the \u003ccode\u003ename\u003c/code\u003e field being generated by Fleet Engine based on project ID and vehicle ID.\u003c/p\u003e\n"],["\u003cp\u003eAuthenticated requests to Fleet Engine are necessary, using either the Authorization library for gRPC or JSON Web Tokens for REST.\u003c/p\u003e\n"],["\u003cp\u003eVehicles remain available for reuse for 7 days after completing an itinerary, and regular updates to vehicle location or other fields extend this availability.\u003c/p\u003e\n"]]],["Fleet Engine manages vehicles through creation and management within its server environment, mirroring real-world operations and backend systems. Creating vehicles involves using `CreateVehicleRequest` (gRPC) or `providers.vehicle.create` (REST) for on-demand trips and `CreateDeliveryVehicleRequest` or `providers.deliveryVehicles.create` for scheduled tasks. Requests include a parent (Google Cloud project ID), a unique vehicle ID, and a vehicle instance with required fields. Fleet Engine sets the vehicle `name` field. Vehicles can be reused for up to 7 days after completing stops, extendable by updating location or other fields.\n"],null,["For general information about how vehicles work in Fleet Engine, see the\nfollowing guides in the Fleet Engine essential section:\n\n- [What is Fleet Engine?](/maps/documentation/mobility/fleet-engine/essentials)\n- [Introduction to vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles-intro)\n\nThe documentation in this section describes how to create and manage vehicles in\nFleet Engine. You create vehicles in the Fleet Engine server environment to\nmirror the actual vehicles in your real-world operation. Your Fleet Engine\nvehicles should also correspond to those used in your backend system that you\nuse for vehicle assignments and routing.\n\nYou use a create method to create a vehicle resource, either using gRPC or REST.\nThe field names in this guide use gRPC notation for simplicity. \n\nOn-demand trips\n\n- [`CreateVehicleRequest`](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#maps.fleetengine.v1.CreateVehicleRequest) (gRPC)\n- [`providers.vehicle.create`](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.vehicles/create) (REST)\n- `Vehicle` resource ([REST](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.vehicles), [gRPC](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#maps.fleetengine.v1.Vehicle))\n\nScheduled tasks\n\n- [`CreateDeliveryVehicleRequest`](/maps/documentation/mobility/fleet-engine/reference/tasks/rpc/maps.fleetengine.delivery.v1#maps.fleetengine.delivery.v1.CreateDeliveryVehicleRequest) (gRPC)\n- [`providers.deliveryVehicles.create`](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/create) (REST)\n- `DeliveryVehicle` ([REST](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles), [gRPC](/maps/documentation/mobility/fleet-engine/reference/tasks/rpc/maps.fleetengine.delivery.v1#maps.fleetengine.delivery.v1.DeliveryVehicle))\n| **Note:** The request messages and resource fields for the two Fleet Engine vehicle resources are largely parallel, even though some names vary between the two.\n\nVehicle requests\n\nFor both on-demand and scheduled task capabilities, you create and update a\nvehicle by issuing a request message with fields, summarized as follows:\n\n1. **The parent**: a string associated with your Google Cloud project ID, used to populate the name field of the vehicle instance.\n2. **The ID for the vehicle** : a unique string used to populate the `name`\n field of the vehicle.\n\n | **Note:** Vehicle ID strings have certain character restrictions. Avoid auto-incrementing IDs and ensure they contain no personally-identifiable information. For details on character restrictions, see the vehicle ID field for [CreateVehicleRequest](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#maps.fleetengine.v1.CreateVehicleRequest) or [CreateDeliveryVehicleRequest](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/issue-jwt).\n3. **A vehicle instance** with its required fields. These fields depend on the\n Fleet Engine capability you use.\n\nThe information in the request body varies with the nature of the request. See\nthose details under their respective guides.\n\nAuthentication and authorization tokens\n\nRequests to Fleet Engine must also provide the correct access credentials.\nThe examples in this guide have the following assumptions:\n\n- gRPC examples assume the use of the [Authorization library](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/issue-jwt#use-authorization) for Java.\n- REST examples illustrate an HTTP request header, which must contain the field `Authorization` with a value of `Bearer \u003ctoken\u003e` where `\u003ctoken\u003e` is a [JSON Web Token you issue](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/issue-jwt).\n\nFor more details, see the [Set up Fleet Engine](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet) guides.\n\nVehicle resource fields\n\nA vehicle resource has the following kinds of fields:\n\n- **Output only fields** . Fields that are set by the service as an output of another method and **cannot be directly set** . An important field of this type is the `name` field. Fleet Engine ignores any supplied value for the `name` field of the vehicle per guidance from Google AIP for [user-specified\n IDs](https://google.aip.dev/133#user-specified-ids). If you supply values for these fields, Fleet Engine returns an error.\n- **Required fields**. Vehicles created in the on-demand trip service require that certain fields be set on creation. Vehicles created in the scheduled tasks service have no required vehicle resource fields.\n- **Optional fields**. Both services have fields which you can set on creation or afterwards. These can be found in the respective reference guide for the service you use.\n\nVehicle name (output only)\n\nThe `name` field is exactly the same for on-demand trips and scheduled task\nservices. Fleet Engine defines the field when you create the vehicle, based on\ntwo fields you set at vehicle creation:\n\n- **The parent** : a string associated with your Google Cloud project ID of the\n form `providers/{provider}` where `{provider}` is the ID of your Cloud\n project. Each vehicle you create for a given project will have the same\n parent path.\n\n The Cloud project you reference here must also contain the Fleet Engine\n service account roles for the service you use. See [Service Accounts](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts) for\n a list of those service accounts. Fleet Engine does not support access from\n multiple Google Cloud projects.\n- **The ID for the vehicle** , which must be unique across all vehicles in your\n fleet and be a valid Unicode string. This is the *resource ID* for the\n vehicle. Both on-demand trips and scheduled stops use this to associate a\n trip or a task with the vehicle that completes it.\n\nIn Google Cloud-based services, all APIs must represent resources as strings.\nSee [Resource naming in Fleet Engine](/maps/documentation/mobility/fleet-engine/essentials#resource-naming) for more details.\n\nUnique entity identifiers\n\nThe format and value of the unique entity identifiers used in resource calls are\nopaque to Fleet Engine. Make sure that the identifier does not contain any\npersonally-identifiable information (PII), such as the driver's phone number.\n\nVehicle re-use\n\nAfter a vehicle completes all stops for a given itinerary, it remains available\nfor re-use in Fleet Engine for 7 days, which means you can reuse a vehicle on\nsubsequent business days without having to create a new one. Each time you\nreuse a vehicle, Fleet Engine resets its availability, at which point the\n7-day countdown begins anew.\n\nThe recommended approach to keep a vehicle available in Fleet Engine is to\nupdate its location at regular intervals. Updates to most other fields in the\n`Vehicle` entity will also extend its life, provided that the new field value is\ndifferent from the existing one.\n\nNOTE: Some fields on `Vehicle` entity like `device_settings` are purely debug\ninformation that are not persisted by Fleet Engine. Updating them does not\nextend the life of the `Vehicle` entity.\n\nFor improved system analytics, it's best to re-use the same driver-vehicle ID\npairing from day to day. Do this by using the same vehicle ID associated with\nthe driver for previous scheduled stops or on-demand trips.\n\nWhat's next\n\n- [Create a vehicle for on-demand trips](/maps/documentation/mobility/fleet-engine/essentials/vehicles/on-demand-create-vehicle)\n- [Create a vehicle for scheduled tasks](/maps/documentation/mobility/fleet-engine/essentials/vehicles/scheduled-tasks-create-vehicle)"]]