vita-epfl / CrowdNav

[ICRA19] Crowd-aware Robot Navigation with Attention-based Deep Reinforcement Learning
MIT License
585 stars 169 forks source link

Using a trained torch model in C++? #7

Closed tcjcxy30 closed 5 years ago

tcjcxy30 commented 5 years ago

Hi: My goal is to test these architectures in a C++ written evaluation project to compare with my method. So basically what I need to do is somehow run this trained models in the C++ project, as simple as possible? Does torch have C++ interface? Or I call python function normally in C++? I read some answers in google but no clear, so can you give some advice? thank you.

ChanganVR commented 5 years ago

Hi,

Sorry for the late reply. I was traveling for the last month. Calling a trained model from C++ codes is doable and it was actually what we did for the real world deployment. Once the robot reads the sensory data, it sends it to a certain IP:PORT in the local wireless network. And a client (workstation) is listening for that signal, once the client receives the signal, it does some preprocessing (detection & tracking) so it can have coordinates of each human in the observation, and then it can compute the states for both the robot and human and pass it to the pytorch model, which returns an action.

When I did the real-world experiment, torch didn't have C++ interface, so what I did it to use the python embedding functionality. This solution is easy, but not so elegant and fast since the underlying model still runs in python.

Let me know if you have any further questions.