Skip to content

Conversation

@faizan-185
Copy link

Reduced CPU usage by enabling intra-process communication and by switching to sensor Qos.

Without intra-process comms, messages traverse the RMW and DDS layers even when publisher and subscriber are in the same process. Also there is a chance of aggressive default QoS on internal bus.

  1. uncomment this -> options.use_intra_process_comms(true);
  2. Use SensorDataQoS instead of Default Qos.
  3. I have also reduced the number of threads, but 'std::thread::hardware_concurrency()' can be configurable by using an env or something.

try {
auto qos = QoS(
1000).best_effort().durability_volatile();
auto qos = rclcpp::SensorDataQoS();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What for? It's queue size is 5, which may be small.


rclcpp::NodeOptions options;
// options.use_intra_process_comms(true);
options.use_intra_process_comms(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested it? Does it work if the router and uas in the different processes (i mean if that scenario continue to work)?

{
// return std::max<size_t>(16, std::min<size_t>(std::thread::hardware_concurrency(), 4));
return std::clamp<size_t>(std::thread::hardware_concurrency(), 4, 16);
return std::clamp<size_t>(std::thread::hardware_concurrency(), 2, 8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to introduce UAS_MAXPROC env var, but it must be >= 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants