What methods are there that I can use to run an ASP file from the main function of my C++ code?
I'm doing a project in which I am expected to control a simulated turtlebot using a C++ file, and use ASP code to construct an action plan that the robot can use to achieve a specified goal.
I'm using Ubuntu 14.04, SPARC (an ASP solver), ROS indigo, and gazebo.
Am I correct that SPARC is implemented in Java (this link)?
If this is the case, there are quite a few options:
- You can use Java Native Interface to interact with SPARC tool directly from c++ code
- Other option is to create a separate
process
from c++ code and communicate with it via stdout/files
- You can implement ROS node in Java which accepts requests and uses SPARC as a library to process them. In this case your c++ doesn't care about exact SPARC implementation
Resume:
I would suggest you to try the last option. It's slightly more difficult than other 2 options, but it fits perfectly into ROS infrastructure.