Coder Social home page Coder Social logo

knowgoio / knowgo-vehicle-simulator Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 4.0 19.08 MB

An interactive multi-platform Connected Car simulator for generating and streaming realistic vehicle telemetry.

Home Page: https://knowgoio.github.io/knowgo-vehicle-simulator/docs

License: MIT License

Java 0.39% Objective-C 0.31% Dart 80.97% CMake 5.58% C++ 9.69% C 0.32% HTML 0.67% Swift 0.39% Ruby 1.03% CSS 0.20% Dockerfile 0.45%
knowgo vehicle-simulator flutter-desktop flutter-app flutter-web vehicle-dynamics digital-twin flutter-mac flutter-windows connected-car

knowgo-vehicle-simulator's Introduction

KnowGo Vehicle Simulator Logo

knowgo-vehicle-simulator

Build Status GitHub issues GitHub GitHub release (latest by date) knowgo-vehicle-simulator DOI

An interactive multi-platform Connected Car simulator for generating and streaming realistic vehicle telemetry.

Overview

knowgo-vehicle-simulator has been developed to aid in the development and validation of data-driven Connected Car services and models that require easy access to realistic synthetic driving data, both for static and streaming applications. It was originally designed for generating event records for the KnowGo Car platform, but has been generalized so that it may be useful both to Connected Car service developers and researchers.

The vehicle simulator generates a single unique vehicle, which can be controlled either directly through the UI or through an optional REST API. This may be further interfaced with OEM-specific external data sources and models in order to permit the simulation state to act as an automotive digital twin. For fleet simulation workloads, multiple instances of the simulator may be run in parallel, with each generated vehicle being manually joined to a specified fleet.

Live Demo

A live demonstration of the Simulator is available here.

Installation

Installation from a binary release is recommended. Regular releases are made to various app stores, please refer to the one appropriate for your platform:

Get it from the Snap Store Get it from Microsoft Get it on Google Play

Releases can also be obtained directly from GitHub.

Deployment

For deployment of a self-contained web-based instance of the simulator, a number of deployment options have been provided:

Docker

Multi-arch images are provided under knowgo/knowgo-vehicle-simulator. The image can be run directly as:

$ docker run -p 8086:8086 knowgo/knowgo-vehicle-simulator

Kubernetes

To create a Kubernetes Deployment including a single instance of the simulator:

$ kubectl apply -f https://raw.githubusercontent.com/knowgoio/knowgo-vehicle-simulator/simulator-deployment.yaml

An optional Service exposing the simulator port on the cluster can also be applied:

$ kubectl apply -f https://raw.githubusercontent.com/knowgoio/knowgo-vehicle-simulator/simulator-service.yaml

Simulator UI

KnowGo Vehicle Simulator Screenshot

Documentation

For additional documentation and tutorials, please refer to the documentation.

Postman Collection for Simulator REST API

A Postman Collection and pre-configured environment for interacting with the Simulator REST API in a local simulation environment is available here.

Architecture

The Simulator itself consists of several different components:

  • The Vehicle Simulation model
  • An Event loop for generating vehicle events, run as either an Isolate or Web Worker depending upon the target platform.
  • An optional HTTP Server isolate for exposing a REST API with basic vehicle controls - starting/stopping the vehicle, updating the vehicle state, handling vehicle notifications, and querying vehicle events.

As the simulation state can not be shared directly across the isolates, the simulation model in the main isolate acts as the source of truth across the system:

  • Updates from the Event loop are applied to the simulation model periodically, in line with the event generation frequency: once per second by default.
  • The HTTP Server isolate maintains its own cached copy of the simulation state, which is updated with changes from the Event isolate, UI interaction, and the REST API. Changes received through the REST API are cached in the HTTP Server isolate and proxied back to the simulation model directly.
  • The UI in the main isolate is redrawn based on changes to the simulation model, triggered by UI interaction and updates from the Event loop or HTTP Server isolate.

An overview of the overall interactivity patterns for the different target platforms is provided in the table below:

Flutter Web Other Target Platforms
Web Worker-driven Simulation Flow Isolate-driven Simulation Flow

Implementation Status

  • Linux desktop
  • Windows desktop
  • macOS desktop
  • Web
  • Android
  • iOS

Event Publication

By default, generated events are only logged in the console. Events can be published to a custom notification endpoint, a KnowGo API backend, as well as MQTT and Kafka brokers (as well as any combination thereof). The specific configuration for each is outlined below.

Configuration

Configuration of the simulator can be tuned through a config.yaml file, which will be parsed and updated by configuration changes within the UI. The format of the file is:

sessionLogging: true
eventLogging: true

# Allow unauthenticated requests to REST API
allowUnauthenticated: true

# Optional endpoint to post generated events to
notificationUrl: http://myserver.com/endpoint

# Optional KnowGo Backend Configuration
knowgo:
  server: <knowgo-API-server>
  apiKey: <knowgo-API-Key>

# Optional Kafka Broker Configuration
kafka:
  broker: <kafka-broker-address>
  topic: <kafka-topic>

# Optional MQTT Broker Configuration
mqtt:
  broker: <MQTT-broker-address>
  topic: <MQTT-topic>

A number of environment variables can also be set:

Environment Variable Description Default value
KNOWGO_VEHICLE_SIMULATOR_CONFIG Path to config file <appDocDir>/knowgo_vehicle_simulator/config.yaml
KNOWGO_VEHICLE_SIMULATOR_LOGS Path to log directory <appDocDir>/knowgo_vehicle_simulator/logs
KNOWGO_VEHICLE_SIMULATOR_IP IP address to bind for REST API 0.0.0.0
KNOWGO_VEHICLE_SIMULATOR_PORT HTTP port to bind for REST API 8086
KNOWGO_SIGNING_KEY Signing and validation secret for API keys secret-key

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Licensed under the terms of the MIT license, the full version of which can be found in the LICENSE file included in the distribution.

knowgo-vehicle-simulator's People

Contributors

pmundt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

knowgo-vehicle-simulator's Issues

can not connect to hivemq

Hello sir
I want to connect knowgo to hivemq broker but when deploying knowgo on vps not connected, when installing on my windows everything is fine and connected to broker...
I checked firewall role and ufw and all of them is open.
in port scanner, scan my vps ports, i findout port 1883 not open in my vps, although in the firewall role group I have hivemq vps and port 1883 is open! CAN YOU help me...

Urgent! simulator with http request not longer working on Node-Red

Hello,

I have been using your simulator for the last approximately 3 weeks now and I was using a default node in Node-Red called http request to get/post information from the Rest API using the localhost:8086 URL and the specific endpoints mentioned on your website. This has worked great and all the requests were successful. Recently in the past couple of days I have discovered that the connection is not longer working. It gives me the following error when I try to access the URL from Node-Red although if I paste the link directly into the browser, the get result is successful as well as in Postman, the result is successful.
image
I will also attach my node settings and mention that for the KnowGo Vehicle Simulator I have the option for Unauthenticated REST API Access ticked but I have also tried generating a Bearer token and the result is still the same as in the image above.
image
The flow itself is a very simple one for testing containing an inject node, http request node and a debug node.
image
Other troubleshooting steps I have taken is reinstalling the simulator, reinstalling Node-Red, trying all sorts of steps mentioned online in regards to the ECONNREFUSED error message such as disabling firewall, flushing dns, trying to access Node-Red in incognito mode, also I checked the netstat command to look for the specific 8086 port used by the API and I couldn't find it using any of the additional options netstat has, and so on but none of these steps actually solved the issue.
Do you have any ideas as to why this has happened? It was working perfectly fine until now I was able to successfully call the API from Node-Red and I am not really sure what might have happened.
Thank you in advance.

Kind regards,
Adriana

Error installing app on android

Has anyone successfully downloaded and installed Knowgo on an Android device?
I tried on a Samsung S7 FE tablet and Samsung S20 FE smarthone and an error occurs.

Add CORS support

The HTTP router currently fails the OPTIONS pre-flight check and returns an unhandled method error. We need to add a CORS middleware to the shelf router in order to enable execution on the local simulator from the OpenAPI documentation.

REST Api server hangs up

When i try to Send a post Request "/simulator/events" script. For the first attempt, it works but when I try to send another request the application server hangs up. I am currently using the windows application. Please guide me which version of the application is most stable, Windows, Linux, or Android.I have tried to use the android version but I cannot send the API request to it from my laptop.Help will be greatly appreciated.

Regards,

Omar Zia

Access the simulator from another machine using REST api

I have tried running the simulator on ubuntu and android platforms but currently, I am unable to access the 8086 port on the host machines from any other machine on the network. Do you have any specific settings I have to do or this type of architecture is not possible?

Regards,

Omar Zia

REST API not working with docker container

So when i follow the instructions and launch a container, with 8086 forwarded, I can see and interact with the UI but I cannot use the API with the provided postman collection. No matter what I do, the server always returns 404. Here are some logs:

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/10/10 12:59:48 [notice] 1#1: using the "epoll" event method
2022/10/10 12:59:48 [notice] 1#1: nginx/1.21.1
2022/10/10 12:59:48 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) 
2022/10/10 12:59:48 [notice] 1#1: OS: Linux 5.10.102.1-microsoft-standard-WSL2
2022/10/10 12:59:48 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/10/10 12:59:48 [notice] 1#1: start worker processes
2022/10/10 12:59:48 [notice] 1#1: start worker process 32
2022/10/10 12:59:48 [notice] 1#1: start worker process 33
2022/10/10 12:59:48 [notice] 1#1: start worker process 34
2022/10/10 12:59:48 [notice] 1#1: start worker process 35
127.0.0.1 - - [10/Oct/2022:13:01:58 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37" "-"
127.0.0.1 - - [10/Oct/2022:13:02:01 +0000] "GET /flutter_service_worker.js?v=2208501651 HTTP/1.1" 200 8049 "http://localhost:8086/flutter_service_worker.js?v=2208501651" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.37" "-"
2022/10/10 13:05:59 [error] 34#34: *3 open() "/usr/share/nginx/html/exve/vehicles" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /exve/vehicles HTTP/1.1", host: "localhost:8086"
127.0.0.1 - - [10/Oct/2022:13:05:59 +0000] "GET /exve/vehicles HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
127.0.0.1 - - [10/Oct/2022:13:07:29 +0000] "GET / HTTP/1.1" 200 1723 "-" "PostmanRuntime/7.29.2" "-"
127.0.0.1 - - [10/Oct/2022:13:07:49 +0000] "GET /exve HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
2022/10/10 13:07:49 [error] 34#34: *5 open() "/usr/share/nginx/html/exve" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /exve HTTP/1.1", host: "localhost:8086"
127.0.0.1 - - [10/Oct/2022:13:08:30 +0000] "GET /simulator/events HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
2022/10/10 13:08:30 [error] 34#34: *5 open() "/usr/share/nginx/html/simulator/events" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /simulator/events HTTP/1.1", host: "localhost:8086"
2022/10/10 13:09:21 [error] 34#34: *5 open() "/usr/share/nginx/html/simulator/info" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /simulator/info HTTP/1.1", host: "localhost:8086"
127.0.0.1 - - [10/Oct/2022:13:09:21 +0000] "GET /simulator/info HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
127.0.0.1 - - [10/Oct/2022:13:09:40 +0000] "GET / HTTP/1.1" 200 1723 "-" "curl/7.78.0" "-"
127.0.0.1 - - [10/Oct/2022:13:09:40 +0000] "GET /simulator/info HTTP/1.1" 404 153 "-" "curl/7.78.0" "-"
2022/10/10 13:09:40 [error] 34#34: *6 open() "/usr/share/nginx/html/simulator/info" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /simulator/info HTTP/1.1", host: "localhost:8086"
2022/10/10 13:10:16 [error] 34#34: *5 open() "/usr/share/nginx/html/exve/vehicles/1/brakePedalPositions" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /exve/vehicles/1/brakePedalPositions HTTP/1.1", host: "localhost:8086"
127.0.0.1 - - [10/Oct/2022:13:10:16 +0000] "GET /exve/vehicles/1/brakePedalPositions HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
127.0.0.1 - - [10/Oct/2022:13:14:12 +0000] "GET /exve/vehicles/1/brakePedalPositions HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"
2022/10/10 13:14:12 [error] 34#34: *7 open() "/usr/share/nginx/html/exve/vehicles/1/brakePedalPositions" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /exve/vehicles/1/brakePedalPositions HTTP/1.1", host: "localhost:8086"
2022/10/10 13:14:56 [error] 34#34: *7 open() "/usr/share/nginx/html/exve/vehicles" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /exve/vehicles HTTP/1.1", host: "localhost:8086"
127.0.0.1 - - [10/Oct/2022:13:14:56 +0000] "GET /exve/vehicles HTTP/1.1" 404 153 "-" "PostmanRuntime/7.29.2" "-"

Simulator not working on Linux

Hello,

I am encountering an issue regarding the simulator on Ubuntu 20.04, specifically, the simulator does not open correctly (it only shows a white window). For me it works perfectly on Windows, so I do not quite understand what could be the issue. If you could provide some insights regarding this, it would be greatly appreciated. I have to mentioned also that the simulator was tested on Ubuntu 20.04 on two different pieces of hardware so I don't think it is a specific problem only for me.

Thank you in advance for your answer.

Best regards,
Victoria

REST api call

Hi,
I would like to know if there are any API calls to update the status of the simulated vehicle i.e. Parameters like acceleration, braking, steering angle, and others that are accessible through the interface. I have checked the documentation it describes a POST request(/simulator/events) but it requires a host of parameters that I don't have in my environment e.g lat , long, etc.If there is a way please let me know, your help will be much appreciated.

Cannot access the REST api on Android

I have installed the simulator on an android phone, But when I am trying to access it from my laptop using my phone's IP , I cannot access it, Can you help me figure this thing out.?Should I use port 8086 while accessing the android version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.