Skip to content

Commit

Permalink
Change default to synchronous (#571)
Browse files Browse the repository at this point in the history
* Change default to synchronous

Signed-off-by: Audrow Nash <[email protected]>
  • Loading branch information
audrow authored Jan 25, 2022
1 parent cfb433a commit e7c749a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This entails that any blocking call occurring during the write operation would b
It is important to note that this mode typically yields higher throughput rates at lower latencies, since the notification and context switching between threads is not present.
* `AUTO`: let Fast DDS select the publication mode. This implies using the publication mode set in the XML file or, failing that, the default value set in Fast DDS (which currently is set to `SYNCHRONOUS`).
If `RMW_FASTRTPS_PUBLICATION_MODE` is not set, then both `rmw_fastrtps_cpp` and `rmw_fastrtps_dynamic_cpp` behave as if it were set to `ASYNCHRONOUS`.
If `RMW_FASTRTPS_PUBLICATION_MODE` is not set, then both `rmw_fastrtps_cpp` and `rmw_fastrtps_dynamic_cpp` behave as if it were set to `SYNCHRONOUS`.
### Full QoS configuration
Expand Down
9 changes: 5 additions & 4 deletions rmw_fastrtps_shared_cpp/src/participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ rmw_fastrtps_shared_cpp::create_participant(
domainParticipantQos.name(enclave);

bool leave_middleware_default_qos = false;
publishing_mode_t publishing_mode = publishing_mode_t::ASYNCHRONOUS;
publishing_mode_t publishing_mode = publishing_mode_t::SYNCHRONOUS;
const char * env_value;
const char * error_str;
error_str = rcutils_get_env("RMW_FASTRTPS_USE_QOS_FROM_XML", &env_value);
Expand All @@ -207,16 +207,17 @@ rmw_fastrtps_shared_cpp::create_participant(
return nullptr;
}
if (env_value != nullptr) {
// Synchronous publishing
if (strcmp(env_value, "SYNCHRONOUS") == 0) {
publishing_mode = publishing_mode_t::SYNCHRONOUS;
} else if (strcmp(env_value, "ASYNCHRONOUS") == 0) {
publishing_mode = publishing_mode_t::ASYNCHRONOUS;
} else if (strcmp(env_value, "AUTO") == 0) {
publishing_mode = publishing_mode_t::AUTO;
} else if (strcmp(env_value, "ASYNCHRONOUS") != 0 && strcmp(env_value, "") != 0) {
} else if (strcmp(env_value, "") != 0) {
RCUTILS_LOG_WARN_NAMED(
"rmw_fastrtps_shared_cpp",
"Value %s unknown for environment variable RMW_FASTRTPS_PUBLICATION_MODE"
". Using default ASYNCHRONOUS publishing mode.", env_value);
". Using default SYNCHRONOUS publishing mode.", env_value);
}
}
}
Expand Down

0 comments on commit e7c749a

Please sign in to comment.