Displaying a single distance value from a sensor as a Laser_Scan on RVIZ

asked 2021-12-12 15:11:19 -0500

Dalecn gravatar image

updated 2022-02-13 16:41:26 -0500

lucasw gravatar image

So i create a scan which is published with the values below.

scan = LaserScan() 
scan.header.stamp = rospy.Time.now() 
scan.header.frame_id = 'sensor_frame' 
scan.scan_time = 0 
scan.range_max = 0.80 
scan.range_min = 0.03 
scan.angle_min = 0 
scan.angle_max = 0 
scan.ranges = [sensor_reading] * 1 #sensor_reading is in M
scan.intensities = [1] * 1

I know the scan is published with the name base_scan and when i check with rostopic echo /base_scan the scan comes up with all the set values. I then try and view the scan in RVIZ which is successfully receiving the scans as the sequence is going up but not displaying them. The only reason i could think that could be causing this is my values for some of the scan variables are wrong. Does anyone know why I cant see the point marked in RVIZ?

Edit: could this have something to do with frames as my robot is in the real world.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

If the sensor_frame is not connected to map, odom, base_link, etc., using static_transform_publisher and setting its location to base_link will work.

Also, it may not have been visualized if it was within the robot's footprint. It might be different if you increase scan.range_max or multiply sensor_reading by 2.

miura gravatar image miura  ( 2021-12-13 19:25:25 -0500 )edit