calculate distance with rplidar a3m1

asked 2022-06-12 06:14:21 -0500

gurselturkeri gravatar image

updated 2022-06-12 06:15:11 -0500

how can i measurement object distance between -180 and 180 degree. I cant adjust ranges value.

    import rospy
from sensor_msgs.msg import LaserScan


class LazerVerisi():
    def  __init__(self):
        rospy.init_node("laser")
        rospy.Subscriber("scan",LaserScan,self.laserCB)
        rospy.spin()

    def laserCB(self,msg):
        front = list(msg.ranges[0:360])
edit retag flag offensive close merge delete

Comments

For example, to get the 170th degree distance; deg170 = np.array(lidar_data.ranges[179*4])

mustafakurban gravatar image mustafakurban  ( 2022-06-12 09:31:04 -0500 )edit

Currently your range values begin at 0° and end at 360° and you want your ranges array to start at -180° and end at +180°. Am I understanding the question correctly?

blbeggs gravatar image blbeggs  ( 2022-06-12 11:13:54 -0500 )edit