How to start a ROS image_raw subscriber python code in boot up
I am a using ROS Noetic in ubuntu 20.04. I am creating an application to read camera and save . i have two launch files to read camera and publish to ros, then I created two python codes to subscribe this two topics and save to file.
First two nodes with publishing is starting on bootup with two scripts and this script files are calling from systemctl. This scripts are working and i am getting images in image_view.
I created two new services, which are calling scripts to start my python code to save videos. But when i am starting this script file from systemctl, i am getting error:
أكت 05 20:38:37 atc8110 dt_ros_usb_recording.sh[30768]: 2020-10-05 20:38:37 [DT] Ros CAM USB recording script is starting أكت 05 20:38:37 atc8110 dt_ros_usb_recording.sh[30814]: Unable to init server: Could not connect: Connection refused أكت 05 20:38:37 atc8110 python3[30814]: cannot open display: أكت 05 20:38:37 atc8110 dt_ros_usb_recording.sh[30768]: /home/atc8110/dt/services/record/usb/dt_ros_usb_recording.sh: line 15: 30814 Segmentation fault (core dumped) /usr/bin/python3 /home/atc8110/dt/services/record/usb/dt_ros_usb_recording.py
but when i am running this /usr/bin/python3 /home/atc8110/dt/services/record/usb/dt_ros_usb_recording.py from terminal. It is working perfectly
How to fix this ??