Hello,
I am testing the Ping360 sonar using ROS 2 in a small test setup where the walls are approximately 0.25m away from the sensor.
I have written a Python node that subscribes to the /scan topic. I implemented a simple logic to filter out noise but keep short-range data (greater than 0.1m).
Here is the code I am using:
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import LaserScan
import math
class SonarAciOkuyucu(Node):
def __init__(self):
super().__init__('sonar_aci_okuyucu')
# Subscribe to /scan topic
self.subscription = self.create_subscription(
LaserScan,
'/scan',
self.listener_callback,
10)
self.subscription
self.get_logger().info('ANGLE BASED READING STARTED')
def listener_callback(self, msg):
# BLIND SPOT FILTER (10 cm)
KOR_NOKTA = 0.1
simdiki_aci_rad = msg.angle_min
# Scan all points in the packet
for i, mesafe in enumerate(msg.ranges):
# Convert Radian to Degree
derece = math.degrees(simdiki_aci_rad)
# Normalize angle 0-360
if derece < 0:
derece += 360
elif derece >= 360:
derece -= 360
# --- FILTERING ---
# 1. Is distance valid?
# 2. Is distance > 0.1m?
# 3. Is distance < max range?
if (mesafe > KOR_NOKTA) and (mesafe < msg.range_max):
# PRINT TO SCREEN
# Expecting around 0.25m for the test
print(f"[ {int(derece):03d} Deg ] --> Distance: {mesafe:.3f} meters")
# Increment angle for next point
simdiki_aci_rad += msg.angle_increment
def main(args=None):
rclpy.init(args=args)
node = SonarAciOkuyucu()
try:
rclpy.spin(node)
except KeyboardInterrupt:
pass
finally:
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
The datasheet states that the Minimum Range is 0.75m.
My Question: With the default driver settings, is it physically possible for the Ping360 to return a valid measurement at 0.25m that my code can read? Or will the hardware dead zone (transducer ringing) mask everything below 0.75m, making it impossible for this code to detect the walls at 0.25m unless I tune parameters like transmit_duration?
Thanks!
