R-Car/Connected Car SDK startup guide

=R-Car Connected Car SDK Outline=

Concept
It's a development toolkit for connected car application, developers working with the R-Car system-on-chip (SoC) family can create applications, such as predictive safety infotainment applications that link dynamic data from the vehicle and the cloud in real time with algorithms developed based on big data in the cloud. This enables out-of-the-box development of innovative applications instead of the traditional approach of simply connecting the vehicle to the cloud, making cloud services available in the vehicle



System Architecture
Connected Car SDK consists of a simulator (PC application) that generates vehicle information, an Edge controller that integrates and manages sensor information in R-Car, a Vehicle Server (Option) that pools data, and Cloud data analysis (Option).



=R-Car initial installation=

Key components

 * Target board : R-Car Starter Kit Premier/Pro (aka. h3ulcb/m3ulcb)
 * http://elinux.org/R-Car/Boards/H3SK
 * https://elinux.org/R-Car/Boards/M3SK
 * Display : 1920 x 1080 pixel @60Hz
 * Cables : HDMI cable x1, AC adopter x1(5V, >2.5A), Ethernet cable x3(R-Car Starterkit, PC and Internet), USB cable
 * Storage : SD card (>8GB, Class 10)


 * Target software
 * AGL version : EE-5.0.3(Electric eel v5.0.3)
 * Chromium version : m 67.0.3375.0


 * IPL : download link
 * [[File:IPL_for_h3ulcb.zip]]
 * [[File:IPL_for_m3ulcb.zip]]


 * IPL : how to write
 * https://elinux.org/R-Car/Boards/H3SK#Flashing_firmware
 * https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware

AGL/Chromium environment(option)

 * Download and Build AGL Source Code
 * https://wiki.automotivelinux.org/agl-distro/source-code
 * Building AGL & Chromium
 * https://github.com/Igalia/meta-browser/wiki

Setting U-boot parameters

 * 1) Insert the micro SD-card to the target board. And Boot up.
 * 2) Stop auto boot hitting any key.
 * 3) set u-boot environment variable.

=> setenv bootargs 'console=ttySC0,115200 root=/dev/mmcblk0p1 rootwait rw rootfstype=ext4' => setenv bootargs 'console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait rw rootfstype=ext4' => setenv bootcmd 'run load_ker; run load_dtb; booti 0x48080000 - 0x48000000' => setenv load_ker 'ext4load mmc 0:1 0x48080000 /boot/Image' => setenv load_dtb 'ext4load mmc 0:1 0x48000000 /boot/Image-r8a7796-m3ulcb.dtb' => setenv ethaddr xx:xx:xx:xx:xx:xx => saveenv => run bootcmd
 * For h3ulcb

=> setenv bootargs 'console=ttySC0,115200 root=/dev/mmcblk0p1 rootwait rw rootfstype=ext4' => setenv bootargs 'console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait rw rootfstype=ext4' => setenv bootcmd 'run load_ker; run load_dtb; booti 0x48080000 - 0x48000000' => setenv load_ker 'ext4load mmc 0:1 0x48080000 /boot/Image' => setenv load_dtb 'ext4load mmc 0:1 0x48000000 /boot/Image-r8a7796-m3ulcb.dtb' => setenv ethaddr xx:xx:xx:xx:xx:xx => saveenv => run bootcmd
 * For m3ulcb

Create a partition on a micro SD-card
Recommended environment for Creating an Image


 * Tested OS: Ubuntu 14.04LTS, 16.04LTS
 * 8GB/Class10 SD-card at least
 * tar version: 1.28 at least

For example, if the micro SD-card is /dev/sdg: Type the commands where you got “Command(m for help):” as below.

$ sudo fdisk /dev/sdg Welcome to fdisk (util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): o Created a new DOS disklabel with disk identifier 0x96e5850d. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1-4, default 1): First sector (2048-31291391, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-31291391, default 31291391): Created a new partition 1 of type 'Linux' and of size 14,9 GiB. Command (m for help): w The partition table has been altered. Calling ioctl to

Format the micro SD-card
Initialize the ext4 partition using “mke2fs”; for example, if the micro SD-card is associated with /dev/sdg1: Confirm whether the command is success or not. If you get “done” like following, the command is successful.

$ sudo mke2fs -t ext4 /dev/sdg1 --snip-- Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done

Node installation
Download the node.js programs and extract to root folder Refer to: https://nodejs.org/ja/download/

After extracted, command “npm install” at    /v2c-edge-1.50/ /vehicle-information-service-spec/

Network setting
In order to reproduce the situation where only the connection to the Internet is disconnected while maintaining LAN communication in the network failure area, execute a shell script that adds a virtual network interface and changes the routing table when EdgeController is executed. This shell script is assumed for that R-Car is in the LAN where the DHCP server exists, and connects to the Internet via the default gateway. Most of routers have a DHCP server function, so the R-Car is inside the router, and it corresponds to the general environment where the router is the default gateway. When the LAN where R-Car is placed is 192.168.0.0/24, the default gateway is 192.168.0.1, the IP address set for R-Car is 192.168.0.8(example), and the network interface of R-Car is eth0, use the following command: enabling set the IP address and default gateway. ifconfig eth0 netmask 255.255.255.0 ip route add default via 192.168.0.1 dev eth0 If not connect to the internet, please confirm the setting of /etc/resolv.conf

=SETUP of Edge Controller(Data management framework in R-Car)=

Download Edge controller

 * 1) Coppy all of Zip files to R-Car

Extract Edge controller into R-Car
export directory path of micro SD-card $ SDCARD= mount your SD to your rootfs $ mount /dev/sdg1 $SDCARD remove all data in SDCARD $ sudo rm -rf ${SDCARD:-bad_dir}/* extract all data in SDCARD $ sudo gunzip xxx.tar.gz $ tar -xvf xxx.tar Root have: $ /v2c-edge-1.50/ /vehicle-information-service-spec / /node_module/

Execute Edge controller in R-Car
$ node vehicle-information-service-spec/visSvr.js
 * Vehicle Server(option) execution

Make v2c-edge the current directory and then execute node program $ cd v2c-edge-1.50 $ node index.js +When getting an SSL error, try again with updating the date by "date" command
 * Node execution for Edge controller

Edge controller setting
Edge controller configuration is as below.

- v2c-edge-1.50/public/static/edge_config.js * EDGE_IP: Edge IP address (ex: 192.168.0.8) * USER_ID: User name (please ask to Renesas)

- v2c-edge-1.45/public/static/js/config.js * userId1:  User name (please ask to Renesas) * edgeIP: Edge IP address (ex: 192.168.0.8) * useYardPond: When changing from the metric method to the yard method: “true”, If no: “false” * useFahrenheit: When changing from Celsius to Fahrenheit: “true”, If no: “false”

=SETUP of Vehicle Server(Option: HTTP server in R-Car)=

How to subscribe
Connect to the VIS server by WebSocket then connect to the following URL: IP address is the same as Edge controller. ws://XXXX:8087 (XXXX: IP address)
 * Connect to Vehicle (HTTP) server

When receiving data from the Vehicle server server continuously, the Subscribe request is sent in JSON of the following format to the created WebSocket connection. { action: "subscribe", path: "Signal.Vehicle.Speed", filters: "", requestId: "reqid-facb08d1-076c-47ed-8e2e-5a9d794eb494" }
 * Subscribe request

Set each item as follows.
 * action
 * When subscribing, specify "subscribe".
 * path
 * Specify the data path to subscribe. The path name specified here specifies the Genivi VSS path described in the JSON format specification.
 * requestId
 * A unique string for each request is generated and set as a UUID or random number so that each request can be identified. There are no particular restrictions on the format or length.

Receiving Reply Message to Subscribe Request As soon as the Subscribe request is accepted, a JSON response message will be returned { action: "subscribe", requestId: "reqid-facb08d1-076c-47ed-8e2e-5a9d794eb494", subscriptionId: "subid-16583f3a2be272", timestamp: "1535517106878" }

The requestId is the specified ID when sending the request. The subscriptionId is an ID determined by the Vehicle Server server to identify this Subscribe. The subscribed data will come with this subscriptionId.

Receive subscribed data For the data path registered with Subscribe, as soon as the latest value arrives at the Vehicle Server, the value is delivered to the client in the following format:

{ action: "subscription", subscriptionId: "subid-16583f3a2be272", value: 0, timestamp: 1535517561503 } The value contains the latest value. In this example, the speed is acquired as 0 m / s. Able to stop Subscribe by using the Unsubscribe command.

= Sample script code for R-Car=

$ sleep 10 /sbin/ifconfig eth0 [IP address: ex:192.168.0.8] netmask 255.255.255.0 /sbin/ip route add default via [gateway address: ex: 192.168.0.1] dev eth0 date -s 20190XXXX cd /v2c-edge-1.50; node index.js & cd /vehicle-information-service-spec; node visSvr.js & sleep 10 echo "nameserver 8.8.8.8" >> /etc/resolv.conf chromium --no-sandbox --kiosk http://localhost:8088/cluster/#/

=SETUP of Vehicle simulator(PC application)=

Download simulator

 * 1) Download and install to your PC (Evaluation period is 1 month for trial)
 * 2) Run the unity program "SDK.exe"


 * Connect Simulator to R-Car Starter Kit (Interface)
 * Target board:R-Car Starter Kit Premier/Pro (aka. h3ulcb/m3ulcb)
 * Peripheral interface : Ethernet

Simulator KEY BINDING LIST
1	Fine-Rainy-Snow DAY 2	Day-Night 3	City-Oval 4	 5	 6	 A	AirBag (ON-OFF) B	 C	 D	DRIVE mode E	 F	Fine day (2nd) G	 H	Temperature Down I	 J	 K	 L	Light (High beam-Low beam) M	 N	 O	Door (Open-Lock) P	Parking Q	RESET R	REAR mode S	 T	Trunk (Open-Close) U	 V	 W	Wiper (non-fast) X	Move right for Info display Y	 Z	Move left for Info display ↑	ACCEL →	RIGHT ←	LEFT ↓	BRAKE

How to use
After executing the simulator, first press the 'g' button to display the setting screen, and enter the following URL for the WebSocket connection destination in the upper left. ws://XXXX:8088/vehicle (XXXX: IP address of R-Car M3)
 * 1) IP address setting

Run the simulator again and turn on the "SendVehicleParam" check in the setting item displayed with the 'g' button then start to send the running data from the simulator to the edge.
 * 1) Then press the Save URL button. You need to re-launch the simulator to reflect this change

=Vehicle Information (Simulator)=

Vehicle format
Refer to Excel format for detailed vehicle data(json_format.xlsx). Following data is sample. $ {   "Ver":"001", "Timestamp":1515574198504, "geometry":{ "coordinates":{ "Altitude":54.6, "Longitude":139.76562, "Latitude":35.68895} },   "RunningStatus":{ "Vehicle":{"Speed":5010}, "Engine":{"Speed":1009}, "SteeringWheel":{"Angle":1} },   "Body":{ "Door":{ "FrontLeft":{"IsOpen":false}} } }
 * Vehicle information

As a signal of Genivi VSS, as an extension of the Private node or less, it was set as below Private.V2C.Events.Event1 ... 5 Defined in json_format.xlsx
 * Event data
 * Simulator have Event data in addition to Vehicle information

Vehicle data
Please download the spread sheet from below link

http://xxxxxxxxxx

=Xen installation (Option)=

Download Xen environment
Under preparation

= Web Application= DataPlayer, ClusterUI, HUD are HTML application, so it can be run on the browser

http://XXXX:8088/player http://XXXX:8088/cluster http://XXXX:8088/hud http://XXXX:8088/navi (XXXX:IP address of R-Car)
 * DataPlayer
 * ClusterUI
 * HUD
 * NavigationUI

=Partner solution=