my question is, how to run and train an reinforcement learning Agent on a raspberry pi.
I am having a Simulink model which uses an DDPG-agent from the reinforcement learning toolbox to learn a Sine-wave (on a raspberry and locally). I upload the Simulink model (sine_learning.slx. Raspberry_USB.slx).
The Raspberry reads a Sine-wave and outputs an action. The learning process should cause an convergence of the action with the sine-wave.
I have upladed the files used to train the model (with and without raspberry connection).
Only 1 file is run to train the net:
createSineAgent.m to train an agent locally
createUSBSineAgent.m to train on the raspberry.
The referenced Simulink models are sine_learning.slx and Raspberry_USB.slx. Two other files define the net-form and other training parameters.
The model is trained on a computer by exchanging the Serial-Read with a sine-wave-Simulink-block . During this the RL-agent is saved as a ".mat" file.
Now i want to execute this model on the raspberry. Running "create_USBAgent.m" directly does not seem to work. The training process is no initialized.
I heard i need to deploy the RL-Agent .
I followed this instruction and generated an evaluatePolicy_mex.mexw64 file (according to - "C/C++ code for table, deep neural network, or linear basis function policies using MATLAB® Coder™" - see link
My question is, how can this Mex-file replace the network on the raspberry? Also is it possible to deploy an RLAgent on the board which continues to learn and improve its policy?
Alternatively, are there other ways to achieve my goal (running and training an RLAgent on a raspberry)?
Thank you for any tip or hint!!