Delay in subscribing scan messages in C++

I noticed that when i am using the subscriber, my robot reacts too late to detect the wall. It sometimes work, and often it doesn’t due to it not being able to find the AF_inet address or being delayed by streams of message. Please advise on what may i do to speed up the program?

I fixed the problem:

Adding loop rate works and declaring my subscriber in the private section rather than in the function fixed it.

Sorry for the troubles.

1 Like