简体   繁体   English

从 python 脚本运行 C++ 可执行文件

[英]Running C++ executable from python script

we are currently working on robot Pepper, more specific we are trying to prepare Pepper as welcome manager.我们目前正在开发机器人 Pepper,更具体地说,我们正在尝试将 Pepper 准备为欢迎经理。 So when robot gets input from human to go to a certain location, he should start specific dialog for that location and moving to that location.因此,当机器人从人类输入 go 到某个位置时,他应该为该位置启动特定对话并移动到该位置。 We did the navigation part in ROS and human-interaction part in Python using Python and Naoqi SDK. Now we want to run C++ exe that starts navigation in Python script.我们使用 Python 和 Naoqi SDK 在 ROS 中完成了导航部分,在 Python 中完成了人机交互部分。现在我们要运行 C++ exe 以在 Python 脚本中启动导航。 What is the simplest way to do that?最简单的方法是什么?

Relaying MA's answer here:在此转发 MA 的回答:

subprocess , eg subprocess.run(["your_exe", "first_arg"]) .进程,例如subprocess.run(["your_exe", "first_arg"]) You can also do things like capture stdout/stderr from the subprocess, check return code, wait for subprocess to complete.您还可以执行诸如从子进程捕获 stdout/stderr、检查返回码、等待子进程完成等操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM