Robotics StackExchange | Archived questions

calculate distance with rplidar a3m1

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])

Asked by gurselturkeri on 2022-06-12 06:14:21 UTC

Comments

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

Asked by mustafakurban on 2022-06-12 09:31:04 UTC

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?

Asked by blbeggs on 2022-06-12 11:13:54 UTC

Answers