GithubHelp home page GithubHelp logo

Unexpected latency behaviour about rmw HOT 7 CLOSED

ros2 avatar ros2 commented on September 2, 2024
Unexpected latency behaviour

from rmw.

Comments (7)

tfoote avatar tfoote commented on September 2, 2024

At first glance you're using spin_some in the publish loop and then sleeping until the next publish. I would expect that you then are only giving rclcpp the opportunity to check for incoming messages each time you publish, which thus causes your latency to be correlated to your publish frequency.

I'd suggest refactoring to make sure to have spin active all the time by putting it in a dedicated thread. Or even simpler would be to setup a timer to trigger your publish events and then you can just call spin in the main thread.

from rmw.

Alex031544 avatar Alex031544 commented on September 2, 2024

Hello,

thanks for your replay. This makes sense and was very helpful. Now the latencies are constant over the frequency. This is totally what we expected. But there is a new observation: During the transmission data losses occur over a longer time. This leak time increases with the frequency and occurs only with WLAN connections. Have you an idea why this happens?

Obeservations

D-Link DIR-645 (LAN)

  • 25 Hz
    cfg01_025hz_400s_01
  • 50 Hz
    cfg01_050hz_200s_01
  • 100 Hz
    cfg01_100hz_100s_01
  • 200 Hz
    cfg01_200hz_050s_01
  • 400 Hz
    cfg01_400hz_025s_01

TP-Link M7350 (5 GHz WLAN)

  • 25 Hz
    cfg05_025hz_400s_01
  • 50 Hz
    cfg05_050hz_200s_01
  • 100 Hz
    cfg05_100hz_100s_01
  • 200 Hz
    cfg05_200hz_050s_01
  • 400 Hz
    cfg05_400hz_025s_01

TP-Link M7350 (2G4 Hz WLAN)

  • 25 Hz
    cfg06_025hz_400s_01
  • 50 Hz
    cfg06_050hz_200s_01
  • 100 Hz
    cfg06_100hz_100s_01
  • 200 Hz
    cfg06_200hz_050s_01
  • 400 Hz
    cfg06_400hz_025s_01

Setup

Now I seperate the sender and receiver tasks in two classes. The sender has an own thread for his work, while the receiver only bind the callback function to the topic. The spin comes directly before the class-destructors inside the main function:

    // initialize ROS2
    rclcpp::init(argc, argv);
    // initialize a node
    auto node = rclcpp::node::Node::make_shared(flzNodeName);

    // take a reference time stamp
    auto t_start = std::chrono::steady_clock::now();

    auto *iomReceiver = new test::IomReceiver( node, flzNo, t_start );
    auto *iomSender = new test::IomSender( node, flzNo, t_start, freq );

    rclcpp::spin(node);

    delete iomReceiver;
    delete iomSender;

The QoS-profile is again rmw_qos_profile_sensor_data.

from rmw.

dirk-thomas avatar dirk-thomas commented on September 2, 2024

When using best-effort I would expect messages to be lost when being sent over a wireless connection. If packet collision happens the message will not be resend and therefore never be received. If you switch to reliable that should not happen.

from rmw.

Alex031544 avatar Alex031544 commented on September 2, 2024

Yes this is clear. But what I don't see why this happens in that way. The network has totally only this two "members" and only this data exchange. Over a longer period with some hundred messaged all goes perfectly. And then comes a short period of collisions? Why, all of a sudden, collisions? Maybe there is something black magic from the router?

To solve this by setting the profile to be reliable truly is a way. But on our 400 Hz measurement this will lead to hold maybe up to 80 messages. Is it right to say this will additionally increase the data traffic? If it is so I think maybe it is a good thing to think about the reasons for this. Because the bandwidth is limited and we go to have up to 10 IOMs in a further development step.

from rmw.

dirk-thomas avatar dirk-thomas commented on September 2, 2024

You might want to run wireshark on that interface and look at the exchanged packets. A lot of stuff is going on in a (wireless) network even if it is "idle" from the user point of view.

from rmw.

Alex031544 avatar Alex031544 commented on September 2, 2024

Yeah - I think we should examine this. Sad, that the small modern mobile routers don't support a good QoS-set-up to avoid disturbing parallel communications. (DIR-645 <> DIR510L / TP-Link M7350)

On a DIR-645 it's possible to set up priorities and it seems to lead to better results.

from rmw.

mikaelarguedas avatar mikaelarguedas commented on September 2, 2024

@Alex031544 I'm going to close this due to the low activity for a while. If you want to share the results of your investigation, please feel free to comment here and we can reopen this if needed

from rmw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.