请问如何进行一个开机就自己启动相对应的脚本程序啊?目前有哪些办法?
您好,可以参考开发手册的自启动章节
以下链接是配置自启动的方式:-
https://developer.horizon.ai/api/v1/fileData/documents\_pi/System\_Configuration/System\_Configuration.html#id6
可以先把用户手册都大概看一下。
我按用户手册的改了rc.local, 添加了以下内容,用来自动启动样例中的人体跟踪程序
“”“
chmod a=rx,u+ws /usr/bin/sudo
chown sunrise:sunrise /home/sunrise
which “hrut_count” >/dev/null 2>&1
if [ $? -eq 0 ]; then
hrut_count 0
fi
source /opt/ros/foxy/setup.bash
source /opt/tros/setup.bash
source /userdata/myRobot/install/setup.bash
cd /root
export CAM_TYPE=usb
nohup ros2 launch body_tracking hobot_body_tracking_without_gesture.launch.py>body.log&
”“”
但是报错了,同样的这个脚本,如果用手动启动是没问题的。
body.log报错的部分内容如下:
“”“
[hobot_usb_cam-1]
[hobot_usb_cam-1] >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
[hobot_usb_cam-1] This error state is being overwritten:
[hobot_usb_cam-1]
[hobot_usb_cam-1] ‘rcutils_expand_user failed, at /home/kairui/cc_ws_release/tros_ws/src/tros/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:248’
[hobot_usb_cam-1]
[hobot_usb_cam-1] with this new error message:
[hobot_usb_cam-1]
[hobot_usb_cam-1] ‘Failed to get logging directory, at /home/kairui/cc_ws_release/tros_ws/src/tros/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:93’
[hobot_usb_cam-1]
[hobot_usb_cam-1] rcutils_reset_error() should be called after error handling to avoid this.
[hobot_usb_cam-1] <<<
[hobot_usb_cam-1] [ERROR] [1663816716.248946494] [rclcpp]: rcl context unexpectedly not shutdown during cleanup
[body_tracking-4]
[body_tracking-4] >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
[body_tracking-4] This error state is being overwritten:
[body_tracking-4]
[body_tracking-4] ‘rcutils_expand_user failed, at /home/kairui/cc_ws_release/tros_ws/src/tros/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:248’
[body_tracking-4]
[body_tracking-4] with this new error message:
[body_tracking-4]
[body_tracking-4] ‘Failed to get logging directory, at /home/kairui/cc_ws_release/tros_ws/src/tros/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:93’
[body_tracking-4]
[body_tracking-4] rcutils_reset_error() should be called after error handling to avoid this.
”“”
请问下,是什么问题,应该如何改
好的,谢谢