Real Robot Laser Scan update rate

Hi,

I am doing 5 Days ROS2 in Python using RealRobot.
Rosject: ROS2 Basics Python Real Robot Project

What is the expected rate for a subscriber of a LaserScan message on /scan topic from real robot to receive the message?

I am getting like 1 message every 3 seconds (vs 2 message every 1 second in simulator).
see below for the topic hz for real robot.

image

Hey Charly,

The subscriber does not need a “rate” - it just needs to respond to the message every time it comes.

You need to work with whatever rate the robot is sending at, but your subscriber logic does not need to change that much for varying rates, except that perhaps you need to move more slowly at lower sending rates so that your robot does not crash.

Hi,

Thanks for the reply. the rate I’m referring to is the rate subscriber callback is called.
Is this related to how often the laserscan message is published by the real robot?
I just did a real robot session, I noticed that the Laser Scan messages come in like pattern in the pic below.


My subscriber callback:

def on_laser_scan_received(self, msg):
        now = time.time() * 1000
        self.get_logger().info('=================on_laser_scan_received. timediff {}'.format(
            now - self.last_laser_msg_time))
        self.last_laser_msg_time = now
        self.laser_scan_msg = msg

Because of such a low rate, the code that controls the robot movement most of the time is using outdated sensor data.

Hi, did that rate come from echoing the scan once connected to the real robot?

I just tried it and it was around 7hz:

 rostopic hz scan
subscribed to [/scan]
average rate: 7.501
	min: 0.124s max: 0.136s std dev: 0.00393s window: 8
average rate: 7.448
	min: 0.124s max: 0.146s std dev: 0.00518s window: 15
average rate: 7.525
	min: 0.123s max: 0.146s std dev: 0.00566s window: 23
average rate: 7.519
	min: 0.110s max: 0.146s std dev: 0.00700s window: 30
average rate: 7.513
	min: 0.110s max: 0.147s std dev: 0.00706s window: 38
average rate: 7.510
	min: 0.110s max: 0.148s std dev: 0.00727s window: 45
average rate: 7.505
	min: 0.110s max: 0.149s std dev: 0.00777s window: 53

Hi,

The rate (0.3) i got is without any other terminal running echo. I’m using ros2, by the way. There is ros1 to ros2 bridge running.
The screenshot in my 2nd post is the wall find server log.
Do you mind trying using ros2 rosject?
Am i the only one having this issue?
Is this related to the qos of the subscription?

Thank you for letting me know about this. I will check this and report back.

From the top of my head, it might be an issue that your virtual machine connection isn’t able to handle all of the topics being bridged to ROS 2. An alternative would be to use the parameter_bridge instead of the dynamic_bridge, which bridges only the topics you are interested in. I will check this and if so, update the instructions to reflect it.

Thank you

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.