University of Duisburg-Essen Chair of Dynamics and Control Univ.-Prof. Dr.-Ing. Dirk Söffker ———————————————————————————————— Safe Systems Replay and Visualization of driving scenarios in inland vessel-shipping Mukesh Thenraj Xu Fengkai Advisor Abderahman Bejaoui, M.Sc. Univ.-Prof. Dr.-Ing. Dirk Söffker December 2021 ———————————————————————————————— Declaration I declare that the work is up to the official supervision by the person responsible for the task was written independently. The sources used and the resources used are given in full. Verbatim parts of text and images and drawings are marked in each case. Place, Date signature Copyright Agreement The present work was created with the intensive cooperation of the named supervisors People in the context of research work in the Chair of Control, Regulation and Control System dynamics (SRS) of the University of Duisburg-Essen. The ones contained in this work Solutions and ideas are therefore not only subject to the copyright of those to be qualified Person, but jointly with the named group of people. The personal, private as well as the use in the research context of the chair SRS is unaffected.. Place, Date signature I Contents 1 Introduction 1.1 Motivation 1.2 problem Statement 1.3 Steps and structure of work 2 2 3 4 2 Map Visualization using ENC data 2.1 Definition of ENC-data 2.2 Converting ENC-data to shapefile 2.3 Layers in Shapefile 2.3.1 Fairway Layer 2.3.2 Land Layer 2.3.3 Bridge Layer 2.3.4 Harbour Layer 2.3.5 Lake Layer 2.3.6 Canal Layer 2.4 Database consisting the infrastructure data 2.4.1 Comma-separated values (CSV) 2.5 Setting Thresholds 2.6 Publish Information to Rviz 4 5 6 8 9 9 10 10 11 11 12 12 13 14 3 Dynamic Visualization with AIS data 3.1 Background of model motion 3.2 Kinematics 3.3 AIS data 3.4 Processing big Data 3.5 Converting static to Dynamic 3.5.1 pose and position 3.5.2 How to realize history of path 3.6 Multi-node visualization with time sequence synchronization 3.7 Auto code generator for multiple ros nodes 16 16 17 18 18 18 18 19 19 19 4 Results 20 References 21 II List of Figures 1.1 2.1 structure of work. Representation of Duisburg port (778 km - 781 km) using electronic navigational chart. 2.2 Converting ENC to Shapefile. 2.3 Visualisation of the polygon ”HRBBSN” of the considered area Duisburg. 2.4 Visualisation of the layer ”Fairway” of the considered area Duisburg. 2.5 Visualisation of the layer ”LNDARE” of the considered area Duisburg. 2.6 Visualisation of the layer ”BRIDGE” of the considered area Krefeld. 2.7 Visualisation of the layer ”HRBBSN” of the considered area Krefeld. 2.8 Open points. 2.9 Visualization of the area Krefeld (760 km), left from Atlas map 2.10 Layers of Bridges, Harbours, and Fairway published by single noded ROS 2.11 Krefeld (760 km -769 km) image published by Rviz using the implemented tool. 3.1 pose 3.2 kinematic model 3.3 Structure of AIS-data 3.4 History of path 4 6 7 8 9 10 10 11 13 14 15 16 17 17 18 19 III List of Tables 2.1 Structure of CSV file 12 1 Replay and Visualization of driving scenarios in inland vessel-shipping Abstract *motivation in 1-2 sentence *Background of our problem *How we solve the project *keywords: Chapter 1. Introduction 1 2 Introduction The flow of trade between nations and regions is expanding all the time as the social economy develops, and the aggregate number of ships in the social economy grows. Then the volume of vessel traffic on numerous key rivers, straits, and ports increases, resulting in an increase in all types of marine traffic incidents. Now is the time for everyone to rethink how to handle crowded waterways and ports. Germany’s overall water transportation flow has increased dramatically in recent years. These vital waterway transportation hubs, such as those along the coast and on the Rhine, have made significant contributions to the economic and social growth of our country. [HY15] However, because to a lack of data on human decision behavior, there are unsettling inconsistencies between sophisticated marine technology equipment. To address these issues, captain’s behavior for remote controlled vessels must be analyzed. Forecasting captain’s behavior in different situations and in different places is a crucial part of Visualization of driving scenarios in inland vessel-shipping. It lays the theoretical groundwork for increasing traffic efficiency and safety while also enhancing the channel’s navigational capacity. There have been a many new approaches in recent years. Many approaches for studying ship traffic flow forecasting models have emerged in recent years, including linear regression analysis, particle swarm optimization, maximum likelihood estimation, support vector machine, and neural network. [WZC+ 17] In this method Electronic navigational chart (ENC) is used instead of Google API to visualize the static map of Rhine river. It’s because ENC has more advantage over Google API’s. ENC is an open source once the data is downloaded it can be used without internet and without GPS. But google map is not an open source and network connection or GPS must be need to use the service. ENC offers separate layers for bridges, lands, fairways, canals, lakes, harbours, etc. But in google maps these features are not available. Rviz is used instead of Gazebo to show the visualization of static map and driving scenarios. Because Rviz is specific tool designed for visualization. 1.1 Motivation According to previous researches, the human decision-making process is highly non-linear, therefore non-linear models would be more ideal for constructing advanced decisionmaking models than linear models. Even as technological advancements contribute more and more to the creation of autonomous systems that assign the operators the exclusive function of supervisors, the Interaction between captain-vessel-interaction has become a major problem in inland vessel-shipping and safety analysis. This tendency may be Chapter 1. Introduction 3 justified by the fact that the great majority of accidents are caused by a mix of circumstances, all of which invariably include human error and/or improper behavior. In many circumstances, such as when human erroneous behaviors are paired with inadequate or restricted protection and safety measures, the environmental and casualty repercussions of catastrophes are staggering. On the other hand, working at the level of human contribution rather than the machine component is the most effective strategy to increase the dependability of the human-machine system. [KYK08] This issue has been approached from several angles: • Illustration of captain’s behavior for remote controlled vessels. • Supervision of captain-vessel-interaction. • Knowledge base including captain’s behavior in different situations and in different places. • Collecting of different possible captain’s behaviors/actions sequences. • Visualization of driving scenarios based on complex areal and action data. • visualization of vessel movement in different places for a 365 days. 1.2 problem Statement Developing a tool box that could process the large amount of AIS-data automatically and visualize different vessel’s behaviours in different places for 365 days. Develop the kinematic model to understand the motion of ship. Develop the tool box to show the path of the ship so that the operator can easily verify the path of the different ships. Finally analyze the result of movement of ship obtain from the tool. Chapter 2. Map Visualization using ENC data 1.3 4 Steps and structure of work Figure 1.1: structure of work. Structure of the report, with short explanations.ch-2 and ch-3 what we do.(cf. Figure 1.1) 2 Map Visualization using ENC data For nautical charts, the S57 format is utilized, particularly for ENC electronic chart displays used in ships. S57 files are usually found in a folder with other files. The extension ”.000” is usually used for S-57 (ENC) files. A file with the .000 extension is Chapter 2. Map Visualization using ENC data 5 a type of electronic navigational chart (ENC) that provides vector format data based on the S-57 object model and is specified by the International Hydrographic Organisation (IHO). It includes navigational data including sea depth, soundings, contours, and other details. All of this information is stored in a vector format within the file and is completely independent of how it is shown by S57 readers. S57 files can be opened using software like ESRI ArcGIS, OpenCPN, and APIs like GDAL. 2.1 Definition of ENC-data To ensure the safety of navigation assistance Electronic navigation chart (ENC) is widely used. Electronic navigation chart consist of geographical information about lands, bridges, fairways, waterways, canals, lakes and other areas. ENC database is created by national hydrographic office. ENC is created according to the standards of International Hydrographic Organisation (IHO). ENC data is mainly used in electronic chart system. ENC data is mostly encode in data formats like ISO/IEC 8211. This format cannot be used so it has to be converted according to the system requirement. ENC provides different information and automation features like possible danger, Routes,Maritime limits, Depth,Nature of seabed, Elevation and Configuration and characteristic of coast , etc. [PPK+ 13] There are different types of ENC data which are available. Some are suitable for oceans and some are suitable for inland waterways. Inland Electro Navigation Chart (IENC) are developed specifically for inland areas like rivers, canals, lakes and others. By using ENC information of the selected areas can be obtained and its visualisation can be realized.(cf. Figure 2.1) Chapter 2. Map Visualization using ENC data 6 Figure 2.1: Representation of Duisburg port (778 km - 781 km) using electronic navigational chart. [ITZ22] The ENC data of the Rhine river can be obtained from Electronic Waterway Information Service (ELWIS). Which provides the Enc data for all the rivers in Germany. 2.2 Converting ENC-data to shapefile The ENC file will be in .000 format which is not useful to visualise. A python-Code is developed and allows to convert the shape-files to useful data. With the help of python tool the shapefile can be converted into polygon consist of points. For this we can use python packages such as fiona,ogr,os,GDAL/ogr.(cf. Figure 2.2) Chapter 2. Map Visualization using ENC data 7 Figure 2.2: Converting ENC to Shapefile. Geospatial Data Abstraction Library , also known as GDAL is a library of tools used for manipulating geospatial data. GDAL works on both raster and vector data types, and is an incredible useful tool to be familiar with when working with geospatial data. GDAL is a translator library for raster and vector geospatial data formats. [FW+ 22] GDAL is used for opening the ENC files. Fiona enables to create shapefile it is designed to be simple and dependable. It focuses on reading and writing data in standard Python IO style.(cf. Figure 2.3) Chapter 2. Map Visualization using ENC data 8 Figure 2.3: Visualisation of the polygon ”HRBBSN” of the considered area Duisburg. 2.3 Layers in Shapefile A shapefile is a basic, non-topological format for recording geographic feature geometric location and attribute information. Points, lines, and polygons can be used to represent geographic features in a shapefile (areas). [Fou20] A single S-57 file may contain more than 100 layers. For instance, the airport (AIRARE) object class can have the AIRARE, CATAIR, CONDTN, CONVIS, NOBJNM, OBJNAM, STATUS, INFORM, NINFOM, NTXTDS, PICREP, SCAMAX, SCAMIN, TXTDSC, RECDAT, RECIND, SORDAT, and SORIND attributes.Layers, sometimes known as web layers, are logical groups of geographic data used to build maps and scenes, as well as the foundation for geographic analysis. A building layer, for example, might represent a collection of campus buildings and include attributes that specify each structure’s qualities, such as the building’s name, kind of building, size, and other possible attributes. Some important layers in shapefile’s are BRIDGE, CANALS, FAIRWY, HRBBSN, LAKARE and LNDARE. [Com21] Chapter 2. Map Visualization using ENC data 2.3.1 9 Fairway Layer Fairway is a channel either from offshore, in a river, or in a harbor that has enough depth to accommodate the draft of large vessels. They encoded using the object class FAIRWY.(cf. Figure 2.4) Figure 2.4: Visualisation of the layer ”Fairway” of the considered area Duisburg. 2.3.2 Land Layer Land areas that are never covered by water must be encoded using the object class LNDARE. Rivers, canals, lakes, basins and docks, which are not navigable at compilation scale, must be encoded on top of LNDARE. LNDARE is usually of type area; it may, however, be of type point for example a small island, rock that does not cover, or of type line for example islet, offshore bar, isthmus (a narrow strip of land with sea on either side, forming a link between two larger areas of land.). There must be no LNDARE object in the area covering the waterway.(cf. Figure 2.5) Chapter 2. Map Visualization using ENC data 10 Figure 2.5: Visualisation of the layer ”LNDARE” of the considered area Duisburg. 2.3.3 Bridge Layer Bridges are encoded using the object class ”BRIDGE”. If it is required to encode a bridge, it must be done using the object class BRIDGE.(cf. Figure 2.6) Figure 2.6: Visualisation of the layer ”BRIDGE” of the considered area Krefeld. 2.3.4 Harbour Layer A harbour is an area of the sea at the coast which is partly enclosed by land or strong walls, so that boats can be left there safely. If it is required to encode a harbour facility, it Chapter 2. Map Visualization using ENC data 11 must be done using the object class ”HRBBSN”. Depending on the navigational purpose, harbour facilities are defined by: an area including docks,basins, and dockside equipment; or a point.(cf. Figure 2.7) Figure 2.7: Visualisation of the layer ”HRBBSN” of the considered area Krefeld. 2.3.5 Lake Layer A lake is a body of water located in a basin and surrounded by land, separate from any river or other outlet that feeds or drains the lake. Lakes are not part of the ocean and are located on land. If it is required to encode a lake that is not navigable at compilation scale, it must be done using the object class ”LAKARE”. If the lake is navigable at compilation scale, it must be encoded using the object classes ”DEPARE”. [Org18a] 2.3.6 Canal Layer Canals, often known as artificial waterways, are canals or engineered channels constructed for drainage management (such as flood control and irrigation) or the conveyance of water transport vehicles (e.g. water taxi). They can be thought of as artificial rivers because they carry unimpeded, calm surface flow under air pressure. A canal usually has a succession of dams and locks that generate low-speed current reservoirs.. If it is required to encode a canal that is not navigable at compilation scale, it must be done using the object class ”CANALS”. If the canal is navigable at compilation scale, it must be encoded using the object classes DEPARE or DRGARE. [Org18b] Chapter 2. Map Visualization using ENC data 2.4 12 Database consisting the infrastructure data Shapefiles must be converted to Comma-separated values (CSV) files. CSV is one of the alternative file for storing spatial data. Python tool can be used to convert shapefile to CSV file. The conversion of a shapefile to a .csv-file results two separate latitude and longitude from a single shapefile. Latitude contains information about Y axis and longitude contains information about X axis. 2.4.1 Comma-separated values (CSV) A comma-separated values (CSV) file is a text file with values separated by a comma. A data record is represented by each line in the file. Each record has one or more fields, which are separated by commas. The name for this file format comes from the use of the comma as a field separator. A CSV file typically carries tabular data (numbers and text) in plain text, with the same number of fields on each line. The CSV file format isn’t completely standard. The basis is to use commas to separate fields, however commas in the data or embedded line breaks must be treated differently. Some implementations forbid such content, while others encircle the field with quotation marks, necessitating escape if quotation marks are present in the data. Any spreadsheet program, such as Microsoft Excel, Open Office, Google Sheets, and others, can open CSV files. A simple text editor can also be used to open a CSV file. Because it is simple and compatible with most platforms, it is a widely used and popular file format for storing and accessing data. However, there are significant drawbacks to this simplicity. CSV can only store a single sheet in a file and does not support formatting or formulae. The distinction between CSV and XLS file formats is that CSV is a plain text format with values separated by commas (Comma Separated Values), but XLS is an Excel Sheets binary file format that contains information about all of the worksheets in a file, including both content and formatting. [Ltd22] Table 2.1: Structure of CSV file Longitude (X) Latitude (Y) 0 6.6605373 51.5629905 1 6.6604835 51.5629696 2 6.6604384 51.5629515 3 6.6603295 51.5629197 4 6.6602702 51.5629041 Chapter 2. Map Visualization using ENC data 2.5 13 Setting Thresholds For selecting the particular area a threshold in latitude (Y) and longitude (X) has to be generated according to the size of the area. Without setting thresholds the areas will look like unfinished and opening points will be created. These open points are created because in latitude and longitude CSV files the points are not in correct sequence. So we must select threshold accordingly to avoid this problem.(cf. Figure 2.8) Figure 2.8: Open points. For some areas setting thresholds along either longitude (X) or latitude (Y) is necessary. But for some other areas both X and Y points must be needed to set threshold along both latitude (Y) and longitude (X). Thresholds are also useful in selecting only necessary things we need. For example in areas there will be more than 70 bridge layers it will take long time to visualize each bridge and selecting the bridge needed in the considered area. But by setting the threshold for particular area the bridge of the considered area can be easily selected by in that area by removing unwanted other bridges which are larger or smaller than the threshold.(cf. Figure 2.9) Chapter 2. Map Visualization using ENC data 14 Figure 2.9: Visualization of the area Krefeld (760 km), left from Atlas map [ITZ22], right the visualisation with the Tool in Rviz. 2.6 Publish Information to Rviz A ROS node is essentially a compute process. It’s an executable program that runs inside the tool. It enables the realization of a large number of nodes packages. To connect with other nodes, ROS nodes use the ROS client library. A Topic can be published or subscribed to by nodes. A Service can be provided by a node or used by it. It’s worth noting that no two nodes can have the same name. At some point of time many instances has to run on same node, a prefix or suffix needed to be given, or declare them anonymous. The utilization of nodes in ROS has a number of advantages for the overall system. Because crashes are localized to specific nodes, there is more fault tolerance. The main mechanism used by ROS nodes to communicate is by sending and receiving messages. The messages are organized into specific categories called topics. Nodes may publish messages on a particular topic or subscribe to a topic to receive information. [Hab18] Chapter 2. Map Visualization using ENC data 15 Figure 2.10: Layers of Bridges, Harbours, and Fairway published by single noded ROS Each node can publish information about one part only. For example in one node we can publish information about only one bridge or harbour or fairway.(cf. Figure 2.10) Multiple ROS nodes act together to give information about one particular areas. These multiple Ros nodes can be run separately one by one. But it will take lot of time so these multiple ROS nodes can be operated under one single ROS launch file. ROS launch is a tool for easily launching multiple ROS nodes. The settings to set and nodes to launch, as well as the machines on which they should be run, are specified in one or more XML configuration files with the .launch extension. Area Krefeld (760 km) consist of many layers like BRIDGE, FAIRWY, HRBBSN and LNDARE (Bridges, Fairway, Harbour and Land). All this information cannot be published under one single node. To overcome this problem a launch file has to be created and path of all layers in area krefeld should be added under one launh file. (see figure 2.11) Chapter 3. Dynamic Visualization with AIS data 16 Figure 2.11: Krefeld (760 km -769 km) image published by Rviz using the implemented tool. Algorithm 1 Publishing static map information to Rviz Initialization in ROS: Step1:Identify subscribers(Rviz) and publishers(points and lines) and establish communication Step2:Establishing the framework of visualization Step3:Establish the name-space in which the ROS node will run Data input: Read ENC data from CSV for i = 0; i + +; i <length of CSV do Publish the information of static map to Rviz end for 3 3.1 Dynamic Visualization with AIS data Background of model motion *Here we can explain about motion of the ship with figure.(see figure 3.1 ) Chapter 3. Dynamic Visualization with AIS data Figure 3.1: pose 3.2 Kinematics How to realize kinematic model. (see figure 3.2 ) Figure 3.2: kinematic model 17 Chapter 3. Dynamic Visualization with AIS data 3.3 18 AIS data *Here we can explain about what is AIS-data. *How is AIS-data collected *Which information item we can found in the AIS-data. (latitude,longitude,cog,time stamp,cog,ship id etc.) *In which fields we are using AIS-data. (traffic monitoring,collision detection and monitoring ship movement) *How does AIS work in our vessel *structure of AIS-data with one image.(see figure 3.3 ) [!htb] Figure 3.3: Structure of AIS-data 3.4 Processing big Data *Here we can explain explain about how to get AIS-data for specific date and time we want. *Tools we are used to process the big data. 3.5 Converting static to Dynamic *How to write code to realize kinematic model 3.5.1 pose and position *explain the idea of the code Chapter 3. Dynamic Visualization with AIS data 3.5.2 19 How to realize history of path *explain the idea of the code *A picture with multiple pose (given below is just sample with one)(see figure 3.4 ) Figure 3.4: History of path 3.6 Multi-node visualization with time sequence synchronization *we explain about Time interval calculation and ros task scheduling mechanism. *How to get relative time interval between each points and use the time interval for our synchronisation. *How to avoid blocking (600 nodes going to run at a some time how we solve this problem and synchronisation for all nodes). 3.7 Auto code generator for multiple ros nodes *why we need to create such a tool *How to create and use such a tool *How to generate many ros node automatically Chapter 4. Results 4 Results 20 REFERENCES 21 References [Com21] Community, Esri. ArcMap: Creating a layer package. August 2021 [Fou20] Foundation., OpenStreetMap. Map data from OpenStreetMap, ODbL 1.0. Juni 2020 [FW+ 22] Frank Warmerdam, Even R. [u. a.]. Open Source Geospatial Foundation. Juli 1998-2022 [Hab18] HabibOladepo. ROS Graph Concepts. Dezember 2018 [HY15] Haiyan, Wang ; Youzhen, Wang: Vessel traffic flow forecasting with the combined model based on support vector machine. In: 2015 International Conference on Transportation Information and Safety (ICTIS) IEEE, 2015, S. 695–698 [ITZ22] ITZBund. https://atlas.wsv.bund.de. 2022 [KYK08] Kim, Choong N. ; Yang, Kyung H. ; Kim, Jaekyung: Human decision-making behavior and modeling effects. In: Decision Support Systems 45 (2008), Nr. 3, S. 517–527 [Ltd22] Ltd, BigCommerce P. Ecommerce How Tos. Februar 2003 - 2022 [Org18a] Organization, International H. ENC Product Specification - S-57 Appendix B.1. Januar 2018 [Org18b] Organization, International H. ENC Product Specification - S-57 Appendix B.1. Januar 2018 [PPK+ 13] Park, Daewon ; Park, Jaeyang ; Kwon, Doowy ; Kwon, Hyuk-Chul ; Park, Suhyun: Design of data structure for system ENC kernel. In: 2013 International Conference on IT Convergence and Security (ICITCS) IEEE, 2013, S. 1–3 [WZC+ 17] Wang, Chengbo ; Zhang, Xinyu ; Chen, Xiang ; Li, Ruijie ; Li, Gaocai: Vessel traffic flow forecasting based on BP neural network and residual analysis. In: 2017 4th International Conference on Information, Cybernetics and Computational Social Systems (ICCSS) IEEE, 2017, S. 350–354