我正在尝试编写一个批处理脚本来创建新的终结器终端,然后在每个终端中运行一个进程。我希望他们继续在后台运行,直到我决定杀死他们。
我希望第一个运行 10 秒,然后同时创建一堆其他终结器进程。
这第一部分很有效,但现在我希望最后能够按 Enter 并向我启动的每个进程发送一个 SIGINT。我想不出适用于此目的的命令。
#!/bin/sh
echo "Running Teleop... (MAY TAKE SEVERAL SECONDS TO INITIALIZE)"
terminator -T "gazebo" -e "roslaunch cob_bringup_sim robot.launch
robot:=cob4-8 robot_env:=ipa-apartment; bash" &
#wait 10 secons before starting nav and rviz otherwise will get error
((sleep 10) &&
(terminator -T "navigation" -e "roslaunch cob_navigation_global
2dnav_ros_dwa.launch robot:=cob4-5 robot_env:=ipa-apartment; bash" &
terminator -T "rviz" -e "roslaunch cob_navigation_global rviz.launch;
bash" &
terminator -T "arm_controller" -e "roslaunch cob_moveit_bringup
demo.launch rviz_tutorial:=true robot:=cob4-8; bash" &
terminator -T "control_nodes" -e "cd catkin_ws; rosrun first_pkg
control_nodes; bash" &
terminator -T "controller" -e "cd catkin_ws; rosrun first_pkg
controller; bash" &
terminator -T "joystick" -e "rosrun joy joy_node; bash" &
#spawn objects
terminator -T "spawn_objects_launch" -e "roslaunch
cob_default_env_config upload_object_locations.launch robot_env:=ipa-
apartment; rosrun cob_bringup_sim spawn_object.py tomato_sauce;
bash")) &
(
echo Press any key to to shutdown all processes
read varname
echo Shutting down...
#terminating all child processes
)
这些是 ROS 命令,但我认为在这种情况下它们与通用命令没有区别。我意识到代码非常混乱,如果您看到它有任何其他问题,我会很高兴听到它。谢谢!