The heart of MPXE is the harness program. This is the program that will interact with clients over websocket connections, as well as manage running projects.
Web socket Interface
Input:
start project
due to the asynchronous nature of this, once the project is started up, the harness should send a response indicating the project was started.
stop project
query entire data store
set data store state
Output:
State of the data store
To begin with, we can prototype by just always periodically spewing the entire data store via web socket
Ideally, later on we can only send updates
It would be great if we could ‘query’ this, so by sending a web socket ‘request’ message we could trigger a send of the entire data store
CAN messages
send them raw. Any client can decode them on their own.
Components
There are four main components to the harness
Data store: stores the state of every project. Memory is shared between it and each project, so both the harness and the project can read from and write to the same memory.
Web socket interface: sends the state of the data store periodically, and receives commands from clients.
Project manager: manages allocating memory for projects and spinning them up via make command.
Log manager: gathers and parses output from the projects, including CAN messages.
Automated testing
Testing can be done via python script: the script should use the python library we define for interacting with the harness via websockets, and can make assertions to the reactions of the system. An example flow could be:
start pedal board
start MCI
Set throttle to 50%
Assert MCI output is 50%
etc.
Steps for starting a project
Starting up a project would look something like this:
Web socket interface receives command to start up a project
Project manager allocates memory in data store for project
Project manager runs
system("make run PROJECT=blablabla PLATFORM=x86")
and pipes output to log managerProject manager sets up message queue for project to talk to project manager
Each driver gets key to the message queue project manager set up
Log manager taps into virtual CAN bus to collect those messages
Project updates data store and sends a message via message queue
Web socket interface sends web sockets upon data store being updated
Log manager sends CAN messages over web socket upon receiving them