Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory used by DDS client #26095

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libraries/AP_DDS/AP_DDS_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,25 +611,25 @@ void AP_DDS_Client::main_loop(void)
//! @todo check for request to stop task
while (true) {
if (comm == nullptr) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "DDS Client: transport invalid, exiting");
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "%s transport invalid, exiting", msg_prefix);
return;
}

// check ping
const uint64_t ping_timeout_ms{1000};
const uint8_t ping_max_attempts{10};
if (!uxr_ping_agent_attempts(comm, ping_timeout_ms, ping_max_attempts)) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "DDS Client: No ping response, exiting");
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "%s No ping response, exiting", msg_prefix);
return;
}

// create session
if (!init_session() || !create()) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "DDS Client: Creation Requests failed");
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "%s Creation Requests failed", msg_prefix);
return;
}
connected = true;
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "DDS Client: Initialization passed");
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "%s Initialization passed", msg_prefix);

populate_static_transforms(tx_static_transforms_topic);
write_static_transforms();
Expand Down Expand Up @@ -668,7 +668,7 @@ void AP_DDS_Client::main_loop(void)

if (num_pings_missed > 2) {
GCS_SEND_TEXT(MAV_SEVERITY_ERROR,
"DDS Client: No ping response, disconnecting");
"%s No ping response, disconnecting", msg_prefix);
connected = false;
}
}
Expand Down
1 change: 0 additions & 1 deletion libraries/AP_DDS/AP_DDS_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class AP_DDS_Client
static ardupilot_msgs_msg_GlobalPosition rx_global_position_control_topic;
// outgoing transforms
tf2_msgs_msg_TFMessage tx_static_transforms_topic;
tf2_msgs_msg_TFMessage tx_dynamic_transforms_topic;
// incoming transforms
static tf2_msgs_msg_TFMessage rx_dynamic_transforms_topic;

Expand Down
4 changes: 3 additions & 1 deletion libraries/AP_DDS/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def build(bld):
idl_include_path = bld.srcnode.make_node(str(pathlib.PurePath(gen_path, "Idl"))).abspath()

for idl in idl_files:
container_prealloc_size = 8

idl_path = pathlib.PurePath(idl.abspath())
b = idl_path.name

Expand All @@ -85,7 +87,7 @@ def build(bld):
idl_folder = idl_path.parts[-3:-1]
dst_dir = pathlib.PurePath(gen_path, "generated", *idl_folder)
gen = [bld.bldnode.find_or_declare(str(dst_dir / name)) for name in [gen_h, gen_c]]
gen_cmd = f"{bld.env.MICROXRCEDDSGEN[0]} -cs -replace -d {dst_dir} -I {idl_include_path} {idl}"
gen_cmd = f"{bld.env.MICROXRCEDDSGEN[0]} -cs -replace -default-container-prealloc-size {container_prealloc_size} -d {dst_dir} -I {idl_include_path} {idl}"
bld(
# build IDL file
source=idl,
Expand Down
Loading