Support Topics
Support Theme / UC-win/Road After-sales service and technical support information
UC-win/Road SDK (development components)
FAQ Frequently Asked Questions

 Foreword
The UC-win/Road SDK is a software development kit for creating plugins that run on UC-win/Road, providing libraries and APIs. It can be used by universities, automotive companies, and other users for research and development, customization of functions, and more. In this section, we will introduce common questions and applications related to the SDK in a Q&A format, based on frequently asked questions from users.

 Version differences
Plugins developed using the SDK are displaying errors and exhibiting unrecognized behavior. What could be the cause of this?

■ Figure 1: Error messages displayed during execution

The error described above occurs because the versions of the UC-win/Road core and the UC-win/Road SDK are inconsistent. The versions of both products must be exactly the same; even slight differences will prevent normal operation. For example, if the UC-win/Road core is version 7.1.0 and the SDK is version 7.1.1, an error will occur. When this error occurs, please verify the versions of both products.

 Regarding Delphi versions
Currently, does the UC-win/Road SDK only support Delphi 2010?

The UC-win/Road SDK is developed using Embarcadero's Delphi, and the corresponding version of Delphi varies depending on the SDK version. Specifically, Version 8 is dedicated to Delphi XE2, while versions prior to Version 7 are dedicated to Delphi 2010. It is not possible to create or run plugins if the Delphi version does not match, so please be sure to confirm the required version. If you have Delphi XE2 or XE3, you can also use older versions of Delphi simultaneously. For details, please contact Embarcadero Corporation.

 Regarding assistance
Does the UC-win/Road SDK have Chinese documentation?

After installing the UC-win/Road SDK, a help file named "UC-winRoad_SDK_x.xx.xx.chm" is saved in the installation folder; currently, only an English version of the help file is available.

 Instructions for using the LOG function
Is it possible to save detailed data about the vehicle's behavior during driving simulations?

Yes, the UC-win/Road SDK includes a LOG output function called LogServer. Accessing the LogServer allows you to obtain information not only from the vehicle itself but also from surrounding traffic flow and vehicles generated by the system, as well as data on characteristic individuals.
When using LogServer for log output, the process is as follows (Figure 2). First, functions created by the plugin (callback functions) are registered in advance with UC-win/Road. In this state, a simulation is run, and calculations are performed on the environment, traffic flow, and characteristic individuals, followed by rendering of the three-dimensional space. Then, for each model that becomes the object of analysis, the corresponding callback function is called. As shown in Table 1, each object model has access to various data, which can be output as CSV format files or transmitted to other applications.

■ Figure 2: Considerations for LogServer
Examples of data that can be referenced within LogServer
Basic data Simulated time, model name, model ID, model category
Coordinates, attitude X coordinate, Y coordinate, Z coordinate, pitch angle, yaw angle, roll angle, vector
Power, speed Engine RPM, gear number, vehicle speed (km/h, m/s), and speed limit
Input Steering wheel angle, throttle opening, brake pressure, and whether or not it has autonomous driving capabilities
Distance Travel distance, distance to the road's starting point, and distance to the road's endpoint
■Table 1: Examples of data that can be referenced

In addition, the sample examples included with the UC-win/Road SDK utilize the LogServer function for cloud services. Please refer to these examples and use them in your development.
  • ControlVehicleInFrontPlugin
  • InteractionSample
  • LogExportPlugin

 Methods for controlling the direction, acceleration, and braking of your vehicle
Can UC-win/Road vehicle control be implemented using detected values from an external controller for steering, throttle, and braking?

Yes, it is possible. Within the SDK, for driving simulation purposes to control the vehicle, the user interface provides IF8MainDriver. IF8MainDriver can obtain various information about the current road being driven on, such as its route, position, and lane markings. In addition, functions are provided that allow users to write custom values to control steering, throttle, and braking (see Table 2). Example source code is provided below for reference. Furthermore, these controls are implemented through registration of TransientWorldMoveProc() type callback functions within plgTransientWorldMove, or by using Delphi's standard timer function (TTimer).

Vehicle control functions
SetSteering Steering angle controlled in a specified direction. 0.0 indicates straight movement. -1.0 represents the maximum steering angle to the left, and 1.0 represents the maximum steering angle to the right
SetThrottle The throttle opening range is specified as 0.0 to 1.0, with 1.0 representing fully open
SetBrake The braking force value is specified within the range of 0.0 to 1.0. A value of 1.0 represents the maximum braking force
■ Table 2: Vehicle control functions of the IF8MainDriver
var
   appService : IF8ApplicationService;
   driver : IF8MainDriver;
begin
Supports(ApplicationService, IF8ApplicationService, appSerice);
driver := appService.MainForm.driver;
if Assigned(driver) then
   begin
   driver.SetSteering(SteeringValue);
   driver.SetThrottle(Accelvalue);
   driver.SetBrake(Brakevalue);
   end;
end;

 Methods for displaying strings on the main screen
Is it possible to display arbitrary text on the main screen of UC-win/Road?

Yes. Within the UC-win/Road SDK, there are functions called PaintHUD that are prepared for various rendering operations using OpenGL on the main screen's display. By calling the text display library function within the SDK, further text display is possible. The following describes the relevant code. Furthermore, regarding the handling of PaintHUD, please refer to the SpeedMeterPlugin in the SDK's sample plugins.

procedure ????.PaintHUD;
   var
       sp : TPoint3D;
       wp : TPoint3D;
       cw : Integer;
   ch : Integer;
begin
cw := winRoadApplication.mainForm.openGL.Width;
ch := winRoadApplication.mainForm.openGL.Height;

F8TextResetSettings;
F8TextSetFontName( 'Sinsun' );
F8TextSetFontSize(40); // Pixel units
F8TextSetFontColor( clRed );

F8Text2DModeBegin(cw, ch); // Specifies the size of the screen
F8TextSetAlignment(_alignCenter); // Sets the default position of the string
F8TextStartFrom(0.5 * cw, 5); // Specifies the starting position for text writing

glDisable( GL_LIGHTING );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glColor4d( 0.0, 0.5, 1.0, 0.5 );

glBegin( GL_QUADS );
glVertex3f( 0.0, 0.0, -1.0 );
glVertex3f( 0.0, 2 * 40 + 10, -1.0 );
glVertex3f( cw, 2 * 40 + 10, -1.0 );
glVertex3f( cw, 0.0, -1.0 );
glEnd;

F8TextOut('Message Test'); // Draw

F8Text2DModeEnd; // End
glEnable( GL_LIGHTING );
glDisable( GL_COLOR_MATERIAL );
end;

 Concluding remarks
This support documentation covers common questions and various functions of the SDK. We are also considering providing information in different formats in the future.
In addition, detailed explanations are omitted here, but the sample codes for multiple products offer a wide range of functionalities; please refer to them as needed. The following books published by our company also contain various examples of development using the SDK, so please refer to them as well.


(Featured in the Autumn issue of Up&Coming '12)

FORUM8