Open
Description
[en]
First of all, thank you for this awesome project.
I use cyglidar_d1 for jetson nano.
And I write subscriber code with python3(below code).
By the way, below code is too slow.
The data received from the subscriber code(i print the data on console) comes in three to four seconds later than the actual data measured.
I don't know how to fix this code.
[ko]
안녕하세요.
현재 cyglidar_d1 을 jetson nano - ros1 melodic 환경에서 테스트를 해 보았습니다.
그리고 아래 코드처럼 python3 로 subscriber 코드를 작성하였습니다.
그런데 실제 측정하는 데이터가 subscriber code 에서 출력되는 데이터와 3~4초 정도의 딜레이가 존재했습니다.
여러가지를 수정하며 테스트를 해 보았지만 명확한 이유를 찾지 못하고 있습니다.
아래 코드를 사용하고 있을 때 jetson 의 cpu 사용량이 104%, roslaunch 의 cpu 사용량이 40%정도로 찍힙니다.
혹시 위의 글이 원인이 될 수 있을까요?
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import PointCloud2, PointField
import sensor_msgs.point_cloud2 as pc2
import ctypes
import struct
import numpy as np;
from std_msgs.msg import Header
import time
import datetime
# BEGIN MEASUREMENT
def scan_callback(msg):
gen = pc2.read_points_list(msg, skip_nans=True)
int_data = list(gen)
count = 0
for i in range(0,9600):
x = int_data[i].x
y = int_data[i].y
z = int_data[i].z
distance = np.sqrt(x ** 2 + y ** 2 + z ** 2)
if distance < 0.5 and distance != 0.0 :
#print("{0}: {1}".format(i,distance))
count = count+1
time = datetime.datetime.now()
print(count/9600.0 *100, time)
print("—")
rospy.init_node('range_ahead')
scan_sub = rospy.Subscriber('scan_3D', PointCloud2, scan_callback)
rospy.spin()
thank you for reading this issue
Metadata
Metadata
Assignees
Labels
No labels