Difference between revisions of "R-Car/Connected Car SDK startup guide"

From eLinux.org
Jump to: navigation, search
(Node installation)
(10 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
== System Architecture ==
 
== 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).
 
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=
 
== Hardware components ==
 
  
 
[[File:HW_components.jpg|300px| ]]<br/>
 
[[File:HW_components.jpg|300px| ]]<br/>
  
Display : 1920 x 1080 pixel @60Hz<br>
+
=R-Car initial installation=
Cables : HDMI cable x1, AC adopter x1(5V, >2.5A), Ethernet cable x3(R-Car Starterkit, PC and Internet), USB cable<br>
+
== Key components ==
Storage : SD card (>8GB, Class 10)<br>
+
*Target board : R-Car Starter Kit Premier/Pro (aka. h3ulcb/m3ulcb)<br>
 
 
== Included contents info ==
 
 
 
*Target board:R-Car Starter Kit Premier/Pro (aka. h3ulcb/m3ulcb)<br>
 
 
**http://elinux.org/R-Car/Boards/H3SK<br>
 
**http://elinux.org/R-Car/Boards/H3SK<br>
 
**https://elinux.org/R-Car/Boards/M3SK<br>
 
**https://elinux.org/R-Car/Boards/M3SK<br>
*AGL version : EE-5.0.3(Electric eel v5.0.3)<br>
+
*Display : 1920 x 1080 pixel @60Hz<br>
*Chromium version : m 67.0.3375.0<br>
+
*Cables : HDMI cable x1, AC adopter x1(5V, >2.5A), Ethernet cable x3(R-Car Starterkit, PC and Internet), USB cable<br>
 +
*Storage : SD card (>8GB, Class 10)<br>
  
== Write IPL to Target ==
+
*Target software
*Please download the IPL:<br>
+
**AGL version : EE-5.0.3(Electric eel v5.0.3)<br>
 +
**Chromium version : m 67.0.3375.0<br>
 +
 
 +
*IPL : download link<br>
 
**[[File:IPL_for_h3ulcb.zip]]<br>
 
**[[File:IPL_for_h3ulcb.zip]]<br>
 
**[[File:IPL_for_m3ulcb.zip]]<br>
 
**[[File:IPL_for_m3ulcb.zip]]<br>
  
*See below to write IPL.<br>
+
*IPL : how to write<br>
 
**https://elinux.org/R-Car/Boards/H3SK#Flashing_firmware<br>
 
**https://elinux.org/R-Car/Boards/H3SK#Flashing_firmware<br>
 
**https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware
 
**https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware
  
==AGL environment(option) ==
+
==AGL/Chromium environment(option) ==
  
 
*Download and Build AGL Source Code<br>
 
*Download and Build AGL Source Code<br>
Line 41: Line 38:
 
*Building AGL & Chromium<br>
 
*Building AGL & Chromium<br>
 
**https://github.com/Igalia/meta-browser/wiki<br>
 
**https://github.com/Igalia/meta-browser/wiki<br>
*elinux page for h3ulcb/m3ulcb<br>
 
**http://elinux.org/R-Car/Boards/H3SK<br>
 
**http://elinux.org/R-Car/Boards/M3SK<br>
 
  
 
== Setting U-boot parameters ==
 
== Setting U-boot parameters ==
Line 70: Line 64:
 
  => run bootcmd
 
  => run bootcmd
  
== Create a partition on a micro SD-card ==
+
== Setting SD-card ==
 +
=== Create a partition on a micro SD-card ===
 
Recommended environment for Creating an Image
 
Recommended environment for Creating an Image
  
 
* Tested OS: Ubuntu 14.04LTS, 16.04LTS<br>
 
* Tested OS: Ubuntu 14.04LTS, 16.04LTS<br>
* '''8GB/Class10 SD-card at least'''.<br>
+
* ''8GB/Class10 SD-card at least''<br>
 
* tar version: 1.28 at least<br>
 
* tar version: 1.28 at least<br>
  
Line 100: Line 95:
 
   Calling ioctl() to
 
   Calling ioctl() to
  
== Format the micro SD-card ==
+
=== Format the micro SD-card ===
  
 
Initialize the ext4 partition using “mke2fs”; for example, if the micro SD-card is associated with /dev/sdg1:<br>
 
Initialize the ext4 partition using “mke2fs”; for example, if the micro SD-card is associated with /dev/sdg1:<br>
Line 118: Line 113:
  
 
After extracted, command “npm install” at  
 
After extracted, command “npm install” at  
     /v2c-edge-1.50/
+
     /v2c-edge-1.60/
 
     /vehicle-information-service-spec/
 
     /vehicle-information-service-spec/
 
  
 
== Network setting ==
 
== Network setting ==
Line 148: Line 142:
 
  $ tar -xvf xxx.tar
 
  $ tar -xvf xxx.tar
 
Root have:
 
Root have:
  $ /v2c-edge-1.50/
+
  $ /v2c-edge-1.60/
 
   /vehicle-information-service-spec /
 
   /vehicle-information-service-spec /
 
   /node_module/
 
   /node_module/
Line 158: Line 152:
 
*Node execution for Edge controller
 
*Node execution for Edge controller
 
Make v2c-edge the current directory and then execute node program
 
Make v2c-edge the current directory and then execute node program
  $ cd v2c-edge-1.50
+
  $ cd v2c-edge-1.60
 
  $ node index.js
 
  $ node index.js
 
+When getting an SSL error, try again with updating the date by "date" command
 
+When getting an SSL error, try again with updating the date by "date" command
Line 165: Line 159:
 
Edge controller configuration is as below.
 
Edge controller configuration is as below.
  
- v2c-edge-1.50/public/static/edge_config.js
+
- v2c-edge-1.60/public/static/edge_config.js
 
   * EDGE_IP: Edge IP address (ex: 192.168.0.8)
 
   * EDGE_IP: Edge IP address (ex: 192.168.0.8)
 
   * USER_ID: User name (please ask to Renesas)
 
   * USER_ID: User name (please ask to Renesas)
Line 174: Line 168:
 
   * useYardPond: When changing from the metric method to the yard method: “true”, If no: “false”
 
   * 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”
 
   * useFahrenheit: When changing from Celsius to Fahrenheit: “true”, If no: “false”
 
 
  
 
=SETUP of Vehicle Server(Option: HTTP server in R-Car)=
 
=SETUP of Vehicle Server(Option: HTTP server in R-Car)=
Line 226: Line 218:
 
Able to stop Subscribe by using the Unsubscribe command.
 
Able to stop Subscribe by using the Unsubscribe command.
  
== Sample script ==
+
= Sample script code for R-Car=
  
 
  $ sleep 10
 
  $ sleep 10
Line 234: Line 226:
 
  date -s 20190XXXX
 
  date -s 20190XXXX
 
   
 
   
  cd /v2c-edge-1.50;
+
  cd /v2c-edge-1.60;
 
  node index.js &
 
  node index.js &
 
  cd /vehicle-information-service-spec;
 
  cd /vehicle-information-service-spec;
Line 242: Line 234:
 
   
 
   
 
  chromium --no-sandbox --kiosk http://localhost:8088/cluster/#/
 
  chromium --no-sandbox --kiosk http://localhost:8088/cluster/#/
 
  
 
=SETUP of Vehicle simulator(PC application)=
 
=SETUP of Vehicle simulator(PC application)=

Revision as of 02:16, 2 August 2019

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

Tool sdk concept.jpg

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).

HW components.jpg

R-Car initial installation

Key components

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

AGL/Chromium environment(option)

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.
  • 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
=> 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

Setting SD-card

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.60/
   /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=<define your sd card directory>

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.60/
  /vehicle-information-service-spec /
  /node_module/

Execute Edge controller in R-Car

  • Vehicle Server(option) execution
$ node vehicle-information-service-spec/visSvr.js
  • Node execution for Edge controller

Make v2c-edge the current directory and then execute node program

$ cd v2c-edge-1.60
$ node index.js

+When getting an SSL error, try again with updating the date by "date" command

Edge controller setting

Edge controller configuration is as below.

- v2c-edge-1.60/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 Vehicle (HTTP) server

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)

  • Subscribe request

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"
}

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.60;
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

  1. IP address setting

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. Then press the Save URL button. You need to re-launch the simulator to reflect this change

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.


Vehicle Information (Simulator)

Vehicle format

Refer to Excel format for detailed vehicle data(json_format.xlsx). Following data is sample.

  • Vehicle information
$ {
   "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}}
   }
}
  • Event data
    • Simulator have Event data in addition to 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

Command sequence

Sdk cmd sequence.jpg

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

  • DataPlayer
http://XXXX:8088/player
  • ClusterUI
http://XXXX:8088/cluster
  • HUD
http://XXXX:8088/hud
  • NavigationUI
http://XXXX:8088/navi

(XXXX:IP address of R-Car)


Partner solution