|
@@ -0,0 +1,40 @@
|
|
|
+package main
|
|
|
+
|
|
|
+import (
|
|
|
+ "cicv-data-closedloop/aarch64/pjibot_delivery/common/config"
|
|
|
+ "cicv-data-closedloop/common/config/c_log"
|
|
|
+ "cicv-data-closedloop/common/util"
|
|
|
+)
|
|
|
+
|
|
|
+func main() {
|
|
|
+ // 定义一个字符串切片来存储转换后的结果
|
|
|
+ envVars := []string{
|
|
|
+ "C_INCLUDE_PATH=/usr/include/drm:",
|
|
|
+ "USER=root",
|
|
|
+ "ROS_PACKAGE_PATH=/opt/ros/melodic/share",
|
|
|
+ "LD_LIBRARY_PATH=/opt/ros/melodic/lib:/opt/ros/melodic/lib/aarch64-linux-gnu",
|
|
|
+ "ROS_ETC_DIR=/opt/ros/melodic/etc/ros",
|
|
|
+ "SHLVL=1",
|
|
|
+ "HOME=/root",
|
|
|
+ "ROS_PYTHON_VERSION=2",
|
|
|
+ "PCMANFM_OUTLINE_MODE=on",
|
|
|
+ "CPLUS_INCLUDE_PATH=/usr/include/drm:",
|
|
|
+ "ROS_DISTRO=melodic",
|
|
|
+ "ROS_VERSION=1",
|
|
|
+ "PKG_CONFIG_PATH=/opt/ros/melodic/lib/pkgconfig",
|
|
|
+ "PATH=/opt/ros/melodic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/go/bin",
|
|
|
+ "ROS_ROOT=/opt/ros/melodic/share/ros",
|
|
|
+ "ROSLISP_PACKAGE_DIRECTORIES=",
|
|
|
+ "ROS_MASTER_URI=http://192.168.1.104:11311",
|
|
|
+ "PYTHONPATH=/opt/ros/melodic/lib/python2.7/dist-packages",
|
|
|
+ "ROS_HOSTNAME=192.168.1.104",
|
|
|
+ "CMAKE_PREFIX_PATH=/opt/ros/melodic",
|
|
|
+ }
|
|
|
+ // 1 启动父命令
|
|
|
+ c_log.GlobalLogger.Info("record 环境变量为:", config.RosbagEnvs)
|
|
|
+
|
|
|
+ cmd, _ := util.ExecuteWithEnvAndDirAsync(config.RosbagEnvs, config.CloudConfig.BagDataDir, config.RosbagPath, command...)
|
|
|
+ recordProcessPid := cmd.Process.Pid
|
|
|
+ recordSubProcessPid, _ := util.GetSubProcessPid(recordProcessPid)
|
|
|
+ c_log.GlobalLogger.Info("获取进程 ", recordProcessPid, " 的子进程的pid:", recordSubProcessPid)
|
|
|
+}
|