October 15, 2024

EVS – park mode

The Android Automotive Working System (AAOS) 14 introduces important developments, together with a Encompass View Parking Digital camera system. This characteristic, a part of the Exterior View System (EVS), offers a complete 360-degree view across the car, enhancing parking security and ease. This text will information you thru the method of configuring and launching the EVS on AAOS 14.

Construction of the EVS System in Android 14

The Exterior View System (EVS) in Android 14 is a complicated integration designed to boost driver consciousness and security by way of a number of exterior digicam feeds. This technique consists of three major parts: the EVS Driver utility, the Supervisor utility, and the EVS App. Every part performs an important position in capturing, managing, and displaying the photographs vital for a complete view of the car’s environment.

EVS Driver Software

The EVS Driver utility serves because the cornerstone of the EVS system, liable for capturing photographs from the car’s cameras. These photographs are delivered as RGBA picture buffers, that are important for additional processing and show. Sometimes, the Driver utility is supplied by the car producer, tailor-made to make sure compatibility with the precise {hardware} and digicam setup of the car.

To assist builders, Android 14 features a pattern implementation of the Driver utility that makes use of the Linux V4L2 (Video for Linux 2) subsystem. This instance demonstrates tips on how to seize photographs from USB-connected cameras, providing a sensible reference for creating suitable Driver purposes. The pattern implementation is positioned within the Android supply code at packages/companies/Automobile/cpp/evs/sampleDriver.

Supervisor Software

The Supervisor utility acts because the middleman between the Driver utility and the EVS App. Its major obligations embrace managing the linked cameras and shows inside the system.

Key Duties:

  • Digital camera Administration: Controls and coordinates the assorted cameras linked to the car.
  • Show Administration: Manages the show items, guaranteeing the right photographs are proven based mostly on the enter from the Driver utility.
  • Communication: Facilitates communication between the Driver utility and the EVS App, guaranteeing a clean information move and integration.

EVS App

The EVS App is the central part of the EVS system, liable for assembling the photographs from the assorted cameras and displaying them on the car’s display screen. This utility adapts the displayed content material based mostly on the car’s gear choice, offering related visible data to the driving force.

As an illustration, when the car is in reverse gear (VehicleGear::GEAR_REVERSE), the EVS App shows the rear digicam feed to help with reversing maneuvers. When the car is in park gear (VehicleGear::GEAR_PARK), the app showcases a 360-degree view by stitching photographs from 4 cameras, providing a complete overview of the car’s environment. In different gear positions, the EVS App stops displaying photographs and stays within the background, able to activate when the gear modifications once more.

The EVS App achieves this dynamic performance by subscribing to alerts from the Car {Hardware} Abstraction Layer (VHAL), particularly the VehicleProperty::GEAR_SELECTION. This enables the app to regulate the displayed content material in real-time based mostly on the present gear of the car.

Communication Interface

Communication between the Driver utility, Supervisor utility, and EVS App is facilitated by way of the IEvsEnumerator HAL interface. This interface performs an important position within the EVS system, guaranteeing that picture information is captured, managed, and displayed precisely. The IEvsEnumerator interface is outlined within the Android supply code at {hardware}/interfaces/automotive/evs/1.0/IEvsEnumerator.hal.

EVS subsystem replace

Evs supply code is positioned in: packages/companies/Automobile/cpp/evs. Please be sure you use the newest sources as a result of there have been some bugs within the later model that trigger Evs to not work.

cd  packages/companies/Automobile/cpp/evs
git checkout important
git pull
mm
adb push out/goal/product/rpi4/vendor/bin/hw/android.{hardware}.automotive.evs-default /vendor/bin/hw/
adb push out/goal/product/rpi4/system/bin/evs_app /system/bin/

EVS Driver Configuration

To start, we have to configure the EVS Driver. The configuration file is positioned at /vendor/and many others/automotive/evs/evs_configuration_override.xml.

Right here is an instance of its content material:

<configuration>
    <!-- system configuration -->
    <system>
        <!-- variety of cameras obtainable to EVS -->
        <num_cameras worth="2"/>
    </system>
 
    <!-- digicam machine data -->
    <digicam>
 
        <!-- digicam machine begins -->
        <machine id='/dev/video0' place='rear'>
            <caps>
                <!-- record of supported controls -->
                <supported_controls>
                    <management identify="BRIGHTNESS" min='0' max='255'/>
                    <management identify="CONTRAST" min='0' max='255'/>
                    <management identify="AUTO_WHITE_BALANCE" min='0' max='1'/>
                    <management identify="WHITE_BALANCE_TEMPERATURE" min='2000' max='7500'/>
                    <management identify="SHARPNESS" min='0' max='255'/>
                    <management identify="AUTO_FOCUS" min='0' max='1'/>
                    <management identify="ABSOLUTE_FOCUS" min='0' max='255' step='5'/>
                    <management identify="ABSOLUTE_ZOOM" min='100' max='400'/>
                </supported_controls>
 
                <!-- record of supported stream configurations -->
                <!-- beneath configurations have been taken from v4l2-ctrl question on
                     Logitech Webcam C930e machine -->
                <stream id='0' width="1280" peak="720" format="RGBA_8888" framerate="30"/>
            </caps>
 
            <!-- record of parameters -->
            <traits>
                
            </traits>
        </machine>
        <machine id='/dev/video2' place='entrance'>
            <caps>
                <!-- record of supported controls -->
                <supported_controls>
                    <management identify="BRIGHTNESS" min='0' max='255'/>
                    <management identify="CONTRAST" min='0' max='255'/>
                    <management identify="AUTO_WHITE_BALANCE" min='0' max='1'/>
                    <management identify="WHITE_BALANCE_TEMPERATURE" min='2000' max='7500'/>
                    <management identify="SHARPNESS" min='0' max='255'/>
                    <management identify="AUTO_FOCUS" min='0' max='1'/>
                    <management identify="ABSOLUTE_FOCUS" min='0' max='255' step='5'/>
                    <management identify="ABSOLUTE_ZOOM" min='100' max='400'/>
                </supported_controls>
 
                <!-- record of supported stream configurations -->
                <!-- beneath configurations have been taken from v4l2-ctrl question on
                     Logitech Webcam C930e machine -->
                <stream id='0' width="1280" peak="720" format="RGBA_8888" framerate="30"/>
            </caps>
 
            <!-- record of parameters -->
            <traits>
               
            </traits>
        </machine>
    </digicam>
 
    <!-- show machine begins -->
    <show>
        <machine id='display0' place='driver'>
            <caps>
                <!-- record of supported inpu stream configurations -->
                <stream id='0' width="1280" peak="800" format="RGBA_8888" framerate="30"/>
            </caps>
        </machine>
    </show>
</configuration>

On this configuration, two cameras are outlined: /dev/video0 (rear) and /dev/video2 (entrance). Each cameras have one stream outlined with a decision of 1280 x 720, a body charge of 30, and an RGBA format.

Moreover, there may be one show outlined with a decision of 1280 x 800, a body charge of 30, and an RGBA format.

Configuration Particulars

The configuration file begins by specifying the variety of cameras obtainable to the EVS system. That is completed inside the <system> tag, the place the <num_cameras> tag units the variety of cameras to 2.

Every digicam machine is outlined inside the <digicam> tag. For instance, the rear digicam (/dev/video0) is outlined with numerous capabilities reminiscent of brightness, distinction, auto white stability, and extra. These capabilities are listed underneath the <supported_controls> tag. Equally, the entrance digicam (/dev/video2) is outlined with the identical set of controls.

Each cameras even have their supported stream configurations listed underneath the <stream> tag. These configurations specify the decision, format, and body charge of the video streams.

The show machine is outlined underneath the <show> tag. The show configuration contains supported enter stream configurations, specifying the decision, format, and body charge.

EVS Driver Operation

When the EVS Driver begins, it reads this configuration file to grasp the obtainable cameras and show settings. It then sends this configuration data to the Supervisor utility. The EVS Driver will watch for requests to open and browse from the cameras, working based on the outlined configurations.

EVS App configuration

Configuring the EVS App is extra complicated. We have to decide how the photographs from particular person cameras will probably be mixed to create a 360-degree view. Within the repository, the file packages/companies/Automobile/cpp/evs/apps/default/res/config.json.readme comprises an outline of the configuration sections:


  "automobile" :                      // This part describes the geometry of the automobile
    "width"  : 76.7,            // The width of the automobile physique
    "wheelBase" : 117.9,        // The space between the entrance and rear axles
    "frontExtent" : 44.7,       // The extent of the automobile physique forward of the entrance axle
    "rearExtent" : 40           // The extent of the automobile physique behind the rear axle
  ,
  "shows" : [                // This configures the dimensions of the surround view display
                               // The first display will be used as the default display
      "displayPort" : 1,        // Display port number, the target display is connected to
      "frontRange" : 100,       // How far to render the view in front of the front bumper
      "rearRange" : 100         // How far the view extends behind the rear bumper
    
  ],
  "graphic" :                  // This maps the automobile texture into the projected view house
    "frontPixel" : 23,          // The pixel row in CarFromTop.png at which the entrance bumper seems
    "rearPixel" : 223           // The pixel row in CarFromTop.png at which the again bumper ends
  ,
  "cameras" : [                 // This describes the cameras potentially available on the car
    
      "cameraId" : "/dev/video32",  // Camera ID exposed by EVS HAL
      "function" : "reverse,park",  // Set of modes to which this camera contributes
      "x" : 0.0,                    // Optical center distance right of vehicle center
      "y" : -40.0,                  // Optical center distance forward of rear axle
      "z" : 48,                     // Optical center distance above ground
      "yaw" : 180,                  // Optical axis degrees to the left of straight ahead
      "pitch" : -30,                // Optical axis degrees above the horizon
      "roll" : 0,                   // Rotation degrees around the optical axis
      "hfov" : 125,                 // Horizontal field of view in degrees
      "vfov" : 103,                 // Vertical field of view in degrees
      "hflip" : true,               // Flip the view horizontally
      "vflip" : true                // Flip the view vertically
    
  ]

The EVS app configuration file is essential for establishing the system for a selected automobile. Though the inclusion of feedback makes this instance an invalid JSON, it serves as an instance the anticipated format of the configuration file. Moreover, the system requires a picture named CarFromTop.png to symbolize the automobile.

Within the configuration, items of size are arbitrary however should stay constant all through the file. On this instance, items of size are in inches.  

The coordinate system is right-handed: X represents the best course, Y is ahead, and Z is up, with the origin positioned on the heart of the rear axle at floor stage. Angle items are in levels, with yaw measured from the entrance of the automobile, constructive to the left (constructive Z rotation). Pitch is measured from the horizon, constructive upwards (constructive X rotation), and roll is at all times assumed to be zero. Please remember that, unit of angles are in levels, however they’re transformed to radians throughout configuration studying. So, if you wish to change it in EVS App supply code, use radians.

This setup permits the EVS app to precisely interpret and render the digicam photographs for the encompass view parking system.

The configuration file for the EVS App is positioned at /vendor/and many others/automotive/evs/config_override.json. Beneath is an instance configuration with two cameras, entrance and rear, akin to our driver setup:


  "automobile": 
    "width": 76.7,
    "wheelBase": 117.9,
    "frontExtent": 44.7,
    "rearExtent": 40
  ,
  "shows": [
    
      "_comment": "Display0",
      "displayPort": 0,
      "frontRange": 100,
      "rearRange": 100
    
  ],
  "graphic": 
    "frontPixel": -20,
    "rearPixel": 260
  ,
  "cameras": [
    
      "cameraId": "/dev/video0",
      "function": "reverse,park",
      "x": 0.0,
      "y": 20.0,
      "z": 48,
      "yaw": 180,
      "pitch": -10,
      "roll": 0,
      "hfov": 115,
      "vfov": 80,
      "hflip": false,
      "vflip": false
    ,
    
      "cameraId": "/dev/video2",
      "function": "front,park",
      "x": 0.0,
      "y": 100.0,
      "z": 48,
      "yaw": 0,
      "pitch": -10,
      "roll": 0,
      "hfov": 115,
      "vfov": 80,
      "hflip": false,
      "vflip": false
    
  ]

Working EVS

Be certain that all apps are operating:

ps -A | grep evs
automotive_evs 3722    1   11007600   6716 binder_thread_read  0 S evsmanagerd
graphics      3723     1   11362488  30868 binder_thread_read  0 S android.{hardware}.automotive.evs-default
automotive_evs 3736    1   11068388   9116 futex_wait          0 S evs_app
 

To simulate reverse gear you possibly can name:

evs_app --test --gear reverse

And park:

evs_app --test --gear park

EVS app needs to be displayed on the display screen.

Troubleshooting

When configuring and launching the EVS (Exterior View System) for the Encompass View Parking Digital camera in Android AAOS 14, chances are you’ll encounter a number of points.

To debug that, you need to use logs from EVS system:

logcat  EvsDriver:D EvsApp:D evsmanagerd:D  *:S   

A number of USB Cameras – Picture Freeze

Throughout the initialization of the EVS system, we encountered a problem with the picture feed from two USB cameras. Whereas the feed from one digicam displayed easily, the feed from the second digicam both didn’t seem in any respect or froze after displaying just a few frames.

We found that the issue lay within the USB communication between the digicam and the V4L2 uvcvideo driver. Throughout the connection negotiation, the digicam reserved all obtainable USB bandwidth. To forestall this, the uvcvideo driver must be configured with the parameter quirks=128. This setting permits the driving force to allocate the USB bandwidth based mostly on the precise decision and body charge of the digicam.

To implement this answer, the parameter needs to be set within the bootloader, inside the kernel command line, for instance:

console=ttyS0,115200 no_console_suspend root=/dev/ram0 rootwait androidboot.{hardware}=rpi4 androidboot.selinux=permissive uvcvideo.quirks=128

After making use of this setting, the picture feed from each cameras ought to show easily, resolving the freezing concern.

Inexperienced body round digicam picture

Within the present implementation of the EVS system, the digicam picture is surrounded by a inexperienced body, as illustrated within the following picture:

To eradicate this inexperienced body, you might want to modify the implementation of the EVS Driver. Particularly, you need to edit the GlWrapper.cpp file positioned at cpp/evs/sampleDriver/aidl/src/.

Within the void GlWrapper::renderImageToScreen() operate, change the next traces:

-0.8, 0.8, 0.0f, // left high in window house 
 0.8, 0.8, 0.0f, // proper high 
-0.8, -0.8, 0.0f, // left backside 
 0.8, -0.8, 0.0f // proper backside

to

-1.0,  1.0, 0.0f,  // left high in window house
 1.0,  1.0, 0.0f,  // proper high
-1.0, -1.0, 0.0f,  // left backside
 1.0, -1.0, 0.0f   // proper backside

After making this variation, rebuild the EVS Driver and deploy it to your machine. The digicam picture ought to now be displayed full display screen with out the inexperienced body.

Conclusion

On this article, we delved into the intricacies of configuring and launching the EVS (Exterior View System) for the Encompass View Parking Digital camera in Android AAOS 14. We explored the important parts that make up the EVS system: the EVS Driver, EVS Supervisor, and EVS App, detailing their roles and interactions.

The EVS Driver is liable for offering picture buffers from the car’s cameras, leveraging a pattern implementation utilizing the Linux V4L2 subsystem to deal with USB-connected cameras. The EVS Supervisor acts as an middleman, managing digicam and show sources and facilitating communication between the EVS Driver and the EVS App. Lastly, the EVS App compiles the photographs from numerous cameras, displaying a cohesive 360-degree view across the car based mostly on the gear choice and different alerts from the Car HAL.

Configuring the EVS system entails establishing the EVS Driver by way of a complete XML configuration file, defining digicam and show parameters. Moreover, the EVS App configuration, outlined in a JSON file, ensures the right mapping and stitching of digicam photographs to supply an correct encompass view.

By understanding and implementing these configurations, builders can harness the total potential of the Android AAOS 14 platform to boost car security and driver help by way of an efficient Encompass View Parking Digital camera system. This complete setup not solely improves the parking expertise but additionally units a basis for future developments in automotive know-how.