Skip to content

Install RBT: Parking

OPTIONAL

Parking occupancy service

Finds the free parking spaces of every camera whose parking configuration (the "Parking" tab of the camera form) is ready and enabled, from the vehicle footprints (the projections of the detected vehicles onto the ground) found by FALPRS. Results are shown on the "Result" view of the same tab.

Requires FALPRS 1.2.0 or later: the service uses its detectVehicleFootprints method.

The service needs no npm dependencies (Node.js 20.10 or later).

  1. Make the config file and edit it

    shell cd /opt/rbt/server/services/parking cp config.sample.json config.json

    • api.internal - internal API of the server, as api.internal of the server config
    • falprs.url - LPRS API of FALPRS, falprs.authToken - its token if FALPRS requires one, falprs.timeout - seconds
    • listen - address the service serves the processed frames to FALPRS and processing requests to the server on, 127.0.0.1 by default: set an external address only when FALPRS runs on another host; the server reaches it at service of the parking section of the server config (see below), keep them in sync
    • frameBaseUrl - how FALPRS reaches that address
    • camerasRefresh - how often the list of cameras to process is refreshed, seconds (300)
    • cameraTimeout - timeout of requests to the internal API, seconds

    The processing interval of cameras (interval, minInterval) and the storage of the processed frames (storage: tmpfs or gridfs; tmpfs by default when the tmpfs backend is configured, gridfs otherwise) are set in the parking section of the server config.

    Camera frames may be JPEG, PNG, BMP or WebP. The service sends every processed frame to api.internal as base64 in the request body, so the request is a third larger than the frame: a 1920x1080 PNG takes several megabytes, a 4K one up to 20. Make sure the server accepts such requests, otherwise processing fails with parking/result answered 413 (nginx) or 400 (PHP drops the body):

    • nginx: client_max_body_size of the server or of location = /internal.php at least 20M (the sample install/nginx/rbt sets 100M)
    • PHP-FPM: post_max_size at least 20M in /etc/php/8.3/fpm/php.ini, then systemctl restart php8.3-fpm

    To let users process a camera right now with the "Process now" button of the "Result" view, set service of the parking section of the server config to the URL the server reaches the service at (its listen address, e.g. http://127.0.0.1:5081). The service answers POST /process/:cameraId on that address, so when listen is an external address, restrict access to it to the server and FALPRS.

  2. Add user and group (if not yet):

    shell groupadd rbt useradd -g rbt -s /bin/true -d /dev/null rbt

  3. Make logging dir:

    shell mkdir -p /var/log/rbt_parking_service/ chown -R rbt:rbt /var/log/rbt_parking_service/

  4. Make logrotate:

    shell echo '/var/log/rbt_parking_service/*.log { daily missingok rotate 7 compress notifempty copytruncate dateext dateformat -%Y-%m-%d }' | tee /etc/logrotate.d/rbt_parking

  5. Install and start the systemd unit:

    shell ln -sf /opt/rbt/server/services/parking/parking.service /etc/systemd/system/rbt_parking.service systemctl daemon-reload systemctl enable --now rbt_parking