如何从 C++ 文件运行答案集编程文件? [英] How do I run an Answer Set Programming file from a C++ File?
问题描述
我可以使用哪些方法从我的 C++ 代码的主函数运行 ASP 文件?
What methods are there that I can use to run an ASP file from the main function of my C++ code?
我正在做一个项目,我希望使用 C++ 文件控制模拟的海龟机器人,并使用 ASP 代码构建机器人可以用来实现指定目标的行动计划.
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.
我使用的是 Ubuntu 14.04、SPARC(一个 ASP 求解器)、ROS indigo 和 Gazebo.
I'm using Ubuntu 14.04, SPARC (an ASP solver), ROS indigo, and gazebo.
推荐答案
SPARC 是用 Java 实现的我是否正确 (这个链接)?
Am I correct that SPARC is implemented in Java (this link)?
如果是这种情况,有很多选择:
If this is the case, there are quite a few options:
- 您可以使用 Java 本机接口直接从 C++ 代码与 SPARC 工具交互立>
- 其他选项是创建一个单独的进程来自 C++ 代码并通过标准输出/文件与它通信
- 您可以在 Java 中实现 ROS 节点,它接受请求并使用 SPARC 作为库来处理它们.在这种情况下,您的 C++ 不关心确切的 SPARC 实现
- 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
简历:
我建议您尝试最后一个选项.它比其他 2 个选项稍微困难一些,但它非常适合 ROS 基础架构.
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.
这篇关于如何从 C++ 文件运行答案集编程文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!