Skip to content

set the priority of callback to high introduces some delay compared to simple MultiThreadedExecutor #427

@xibeisiber

Description

@xibeisiber

hi, I try to set one callback higher priority following the example cbg_executor . But It seems it introduces some delay compared to using MultiThreadedExecutor.

I publish on the topic "high_pong" at rate 100Hz. In the pong_node.cpp, I set the parameter "high_busyloop" to 1.0, and print the timestamp when receiving the msg.
Use the code in pong.cpp (setting high_prio_executor to ThreadPriority::HIGH), the output is (msg receiving interval is 1050ms):

Image

But if I simply use MultiThreadedExecutor and add the pong node:

  auto pong_node = std::make_shared<PongNode>();
  rclcpp::executors::MultiThreadedExecutor multi_executor1;
  multi_executor1.add_node(pong_node);
  multi_executor1.spin();
  rclcpp::shutdown();
  return 0;

the output is (msg receiving interval is 1000ms):

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions