apollo
apollo copied to clipboard
关于障碍物模拟garage_perception.bash文件
System information OS Platform and Distribution (e.g., Linux Ubuntu 18.04): 18.04 Apollo installed from (source or binary): source Apollo version (3.5, 5.0, 5.5, 6.0): 9.0
我想问一个问题,例如我现在garage_perception.bash文件启动以后,除了ctrl+c ,还有没有其他方法可以将整个障碍物模拟进程杀掉。我目前是做了个网页,网页下发关闭命令后自动运行关闭代码,目前开启可以进行,关闭无法关闭,又没有什么解决办法 switch (start_val) { case 0: // 关闭脚本进程 // system("ps -ef | grep kaddobstacle.dag | grep -v grep | awk '{print $2}' | xargs -r kill -9"); system("xterm -e "bash -c 'ps -ef | grep -E (garage_perception.bash|garage_|replay_perception.py) | grep -v grep | awk '{print $2}' | xargs kill -9'" &"); // system("ps -ef | grep garage_perception.bash | grep -v grep | awk '{print $2}' | xargs -r kill -9"); // system("ps -ef | grep garage_ | grep -v grep | awk '{print $2}' | xargs -r kill -9"); // system("ps -ef | grep replay_perception.py | grep -v grep | awk '{print $2}' | xargs -r kill -9"); break; case 1: // 在新的终端中启动脚本 // system("cd modules/tools/perception && bash garage_perception.bash"); //下面装了xterm 安装方法 sudo apt-get install xterm system("xterm -e 'bash -c "cd modules/tools/perception && bash garage_perception.bash"' &"); break; default: break; }
Outside the docker container, you can start the script by running
docker exec -d apollo_dev_yuqi bash modules/tools/perception/garage_perception.bash
to stop it, you can run
docker exec apollo_dev_yuqi pkill -f 'garage_perception'
to stop the script. Make sure to change apollo_dev_yuqi
with your actual container name.
I used to build a webpage and send commands like you are doing, but I think the proper way of doing this is through docker exec
. Let me know if this helps.
在 docker 容器外部,您可以通过运行来启动脚本
docker exec -d apollo_dev_yuqi bash modules/tools/perception/garage_perception.bash
要停止它,你可以运行
docker exec apollo_dev_yuqi pkill -f 'garage_perception'
停止脚本。确保更改
apollo_dev_yuqi
为您的实际容器名称。我曾经像您一样构建一个网页并发送命令,但我认为正确的方法是通过
docker exec
.让我知道这是否有帮助。
好的,我现在的网页的程序是在apollo容器内,现在遇到了问题就是,他运行命令只能在同一个终端启动,然后就无法关闭void Kaddobstacle::DealJsonCmd_start(const Json& json) {
if (json.contains("cmd") && json["cmd"].is_number()) {
int start_val = json["cmd"].get
我看不懂您
void Kaddobstacle::DealJsonCmd_start(const Json& json) {
if (json.contains("cmd") && json["cmd"].is_number()) {
int start_val = json["cmd"].get();
switch (start_val) {
case 0:
// 关闭脚本进程
// system("pkill -9 -f xterm");
//如果不采用xterm模块的话,直接ctrl+C结束程序
system("docker exec apollo_dev_liyulin pkill -f 'garage_perception'");
break;
case 1:
// 在新的终端中启动脚本
system("gnome-terminal -- bash -c 'bash modules/tools/perception/garage_perception.bash'");
//下面装了xterm 安装方法 sudo apt-get install xterm
// system("xterm -e 'bash -c "cd modules/tools/perception && bash garage_perception.bash"' &");
break;
default:
break;
}
} else {
AERROR << "DealJson_Cmd_adsc invalid control command.";
}
}
这部分是什么,在哪运行。我是说您不需要做一个在Docker容器内的网页去执行命令,只需要在Docker容器外开一个terminal执行docker exec ...
就可以了。
我看不懂你
void Kaddobstacle::DealJsonCmd_start(const Json& json) { if (json.contains("cmd") && json["cmd"].is_number()) { int start_val = json["cmd"].get(); switch (start_val) { case 0: // 关闭脚本进程 // system("pkill -9 -f xterm"); //如果不采用xterm模块的话,直接ctrl+C结束程序 system("docker exec apollo_dev_liyulin pkill -f 'garage_perception'"); break; case 1: // 在新的终端中启动脚本 system("gnome-terminal -- bash -c 'bash modules/tools/perception/garage_perception.bash'"); //下面装了xterm 安装方法 sudo apt-get install xterm // system("xterm -e 'bash -c "cd modules/tools/perception && bash garage_perception.bash"' &"); break; default: break; } } else { AERROR << "DealJson_Cmd_adsc invalid control command."; } }
这部分,在哪运行。我是说你不需要在Docker容器内的网页去执行命令,只需要在Docker容器外开一个终端执行
docker exec ...
就可以了。
好的我再研究一下,感谢