Compare commits

...

1 Commits
v0.0.1 ... main

Author SHA1 Message Date
support.gseps 9b7579c8b8 Commit message 2024-06-05 11:56:36 +09:00
10 changed files with 15951 additions and 265 deletions

View File

@ -1,9 +1,9 @@
{ {
"amqp_url": "127.0.0.1", "amqp_url": "25.10.82.120",
"amqp_port": 5672, "amqp_port": 5672,
"amqp_vhost": "/", "amqp_vhost": "/",
"amqp_id": "username", "amqp_id": "sdt",
"amqp_pw": "password", "amqp_pw": "251327",
"amqp_queue": "gseps-mq", "amqp_queue": "gseps-mq",
"amqp_ReadyQ": "gseps-ready", "amqp_ReadyQ": "gseps-ready",
"AccessKey": "AKIAQB3AM4WP76ND6Z6C", "AccessKey": "AKIAQB3AM4WP76ND6Z6C",
@ -13,7 +13,7 @@
"gseps_stage_bucket":"stage-gs-eps-frontend", "gseps_stage_bucket":"stage-gs-eps-frontend",
"BucketKey": "sdt/mv_bottom_ash_particle_size", "BucketKey": "sdt/mv_bottom_ash_particle_size",
"S3BucketName": "gseps-data", "S3BucketName": "gseps-data",
"image_save_path": "/home/sdt/Workspace/gseps-edge/image_bucket", "image_save_path": "/home/sdt/Workspace/gseps_edge/image_acquisition/capture/",
"laser_save_path": "/home/sdt/Workspace/gseps_edge/laser/laser_value", "laser_save_path": "/home/sdt/Workspace/gseps_edge/laser/laser_value",
"fail_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/fail_message.log", "fail_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/fail_message.log",
"success_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/acquisition.log", "success_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/acquisition.log",

View File

@ -0,0 +1,23 @@
{
"amqp_url": "127.0.0.1",
"amqp_port": 5672,
"amqp_vhost": "/",
"amqp_id": "username",
"amqp_pw": "password",
"amqp_queue": "gseps-mq",
"amqp_ReadyQ": "gseps-ready",
"AccessKey": "AKIAQB3AM4WP76ND6Z6C",
"SecretKey": "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",
"Boto3SignatureVersion": "s3v4",
"Boto3RegionName": "ap-northeast-2",
"gseps_stage_bucket":"stage-gs-eps-frontend",
"BucketKey": "sdt/mv_bottom_ash_particle_size",
"S3BucketName": "gseps-data",
"image_save_path": "/home/sdt/Workspace/gseps-edge/image_bucket",
"laser_save_path": "/home/sdt/Workspace/gseps_edge/laser/laser_value",
"fail_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/fail_message.log",
"success_log_file": "/home/sdt/Workspace/gseps_edge/image_acquisition/logs/acquisition.log",
"capture_single_time_interval": 1,
"capture_batch_time_interval": 120,
"laser_device_path": "/dev/ttyS0"
}

View File

@ -8,5 +8,5 @@ spec:
package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.) package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.)
runtime: python3.8 runtime: python3.8
stackbase: stackbase:
tagName: v0.0.1 # Stackbase(gitea)에 릴리즈 태그명 입니다. tagName: v0.0.2 # Stackbase(gitea)에 릴리즈 태그명 입니다.
repoName: gseps-image-acquisition # Stackbase(gitea)에 저장될 저장소 이릅니다. repoName: gseps-image-acquisition # Stackbase(gitea)에 저장될 저장소 이릅니다.

96
js_light.py Normal file
View File

@ -0,0 +1,96 @@
import time
import serial
import argparse
#======Serial Variable=======
# SERIAL_PATH = "/dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0"
SERIAL_PATH = "/dev/ttyS1"
BAUD_RATE = 19200
PARITY='N'
STOP_BITS=1
BYTE_SIZE=8
TIMEOUT=1
#============================
ser = serial.Serial(port=SERIAL_PATH, baudrate=BAUD_RATE, parity=PARITY, stopbits=STOP_BITS, bytesize=BYTE_SIZE, timeout=3)
def light_control(args):
global ser
ch_list=[0, 16, 17, 18, 19]
bright = int(args.brightness)
# if(ch_num == 0):
# print("Channel range : 1~4 // not 0 ")
try:
# START=(5 & 0xFF).to_bytes(1, byteorder='big')
# CH_NUM=(ch_list[ch_num] & 0xFF).to_bytes(1, byteorder='big')
# BLIGHT=(bright & 0xFF).to_bytes(1, byteorder='big')
# CHK_SUM=(ch_list[ch_num] + bright & 0xFF).to_bytes(1, byteorder='big')
# ser.write(START)
# ser.write(CH_NUM)
# ser.write(BLIGHT)
# ser.write(CHK_SUM)
data = b'\x05\x10\x00\x10'
# result = ser.write(data)
ser.write(data)
# print(result)
except Exception as e:
print(e)
return True
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--brightness', help='adjustment led brightness', required=True)
args = parser.parse_args()
light_control(args)
# print(light_control(ser,1,30))
# time.sleep(1)
# print(light_control(ser,1,0))
# time.sleep(1)
# print(light_control(ser,1,100))
# time.sleep(1)
# print(light_control(ser,1,0))
# time.sleep(1)
# print(light_control(ser,1,240))
#
#
# #for i in range(500):
# while True:
# for i in range(0,50):
# light_control(ser,1,i*5)
# time.sleep(0.02)
#
# for i in range(0,50):
# light_control(ser,1,255-i*5)
# time.sleep(0.02)
# print(i)
# turn_on = [b"\x05", b"\x10", b'\xF0', b'\x00']
# turn_off = [b'\x05', b'\x10', b'\x00', b'\x10']
#
# rqt_status = [b'\x05', b'\x14', b'\x00', b'\x14']
# remote_on = [b'\x05', b'\x29', b'\x01', b'\x2A']
#
# try:
# result = ser.write(b''.join(turn_off))
# print(result)
# time.sleep(2)
# result = ser.write(b''.join(turn_on))
# print(result)
# except Exception as e:
# print(f"Error {e}")
# port.close()

View File

@ -4,7 +4,7 @@ import argparse
#======Serial Variable======= #======Serial Variable=======
# SERIAL_PATH = "/dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0" # SERIAL_PATH = "/dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0"
SERIAL_PATH = "/dev/ttyUSB1" SERIAL_PATH = "/dev/ttyUSB0"
BAUD_RATE = 19200 BAUD_RATE = 19200
PARITY='N' PARITY='N'
STOP_BITS=1 STOP_BITS=1
@ -13,7 +13,7 @@ TIMEOUT=1
#============================ #============================
ser = serial.Serial(port=SERIAL_PATH, baudrate=BAUD_RATE, parity=PARITY, stopbits=STOP_BITS, bytesize=BYTE_SIZE, timeout=TIMEOUT) ser = serial.Serial(port=SERIAL_PATH, baudrate=BAUD_RATE, parity=PARITY, stopbits=STOP_BITS, bytesize=BYTE_SIZE, timeout=TIMEOUT)
print(ser)
def light_control(args, ch_num:int): def light_control(args, ch_num:int):
global ser global ser

File diff suppressed because it is too large Load Diff

4542
logs/gseps.log.1 Normal file

File diff suppressed because it is too large Load Diff

4540
logs/gseps.log.2 Normal file

File diff suppressed because it is too large Load Diff

4543
logs/gseps.log.3 Normal file

File diff suppressed because it is too large Load Diff

15
main.py
View File

@ -283,11 +283,8 @@ def check_distance():
exit() exit()
except Exception as e: except Exception as e:
print(e)
ser.close() ser.close()
#logger.error(traceback.format_exc())
# raise # raise
#print(e)
logger.error(f"Error : {e}") logger.error(f"Error : {e}")
continue continue
@ -386,7 +383,7 @@ def main():
laser_value = check_distance() laser_value = check_distance()
event_flag = 0 event_flag = 0
if 50 <= laser_value < 500: if 230 <= laser_value < 240:
laser_count = 0 laser_count = 0
event_flag = 1 event_flag = 1
logger.info(f"Capture Start at {laser_value}") logger.info(f"Capture Start at {laser_value}")
@ -436,8 +433,8 @@ def main():
cam2_image_path = os.path.join(image_save_path, cam2_image_name) cam2_image_path = os.path.join(image_save_path, cam2_image_name)
cv2.imwrite(cam1_image_path, img_numpy) cv2.imwrite(cam1_image_path, img_numpy)
cv2.imwrite(cam2_image_path, img_numpy_2) cv2.imwrite(cam2_image_path, img_numpy_2)
print('cam1 path: ',cam1_image_path) #print('cam1 path: ',cam1_image_path)
print('cam2 path: ',cam2_image_path) #print('cam2 path: ',cam2_image_path)
# Upload image to MinIO(inference server) # Upload image to MinIO(inference server)
image_list = [cam1_image_path, cam2_image_path] image_list = [cam1_image_path, cam2_image_path]
@ -451,7 +448,7 @@ def main():
if publisher.check_server_state(): if publisher.check_server_state():
publisher.pub(image_info) publisher.pub(image_info)
print(image_info) #print(image_info)
############## CHANGE ####################### ############## CHANGE #######################
# Logger Contents Change // MinIO => S3 # # Logger Contents Change // MinIO => S3 #
@ -483,8 +480,8 @@ def main():
sdt_s3.Bucket('gseps-daily').upload_file(f'{LASER_SAVE_PATH}/{laser_save_hour}.csv', f'{folder}/laser/{laser_save_hour}.csv') sdt_s3.Bucket('gseps-daily').upload_file(f'{LASER_SAVE_PATH}/{laser_save_hour}.csv', f'{folder}/laser/{laser_save_hour}.csv')
laser_history = pd.DataFrame() laser_history = pd.DataFrame()
#if hour == 0: if hour == 0:
# upload_to_s3('gseps') upload_to_s3('gseps')
laser_count += 1 laser_count += 1
time.sleep(0.3) time.sleep(0.3)