Skip to content

Commit

Permalink
Take into account message count for message size
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Marques <[email protected]>
  • Loading branch information
RicardoM17 authored and vooon committed Aug 8, 2020
1 parent 00485f9 commit 74883f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mavros_extras/src/plugins/esc_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class ESCStatusPlugin : public plugin::PluginBase
_esc_info.esc_info.resize(_max_esc_count);
}

for (int i = 0; i < batch_size; i++)
for (int i = 0; i < std::min<ssize_t>(batch_size, ssize_t(_max_esc_count) - esc_index); i++)
{
_esc_info.esc_info[esc_index + i].header = _esc_info.header;
_esc_info.esc_info[esc_index + i].header = _esc_info.header;
_esc_info.esc_info[esc_index + i].failure_flags = esc_info.failure_flags[i];
_esc_info.esc_info[esc_index + i].error_count = esc_info.error_count[i];
_esc_info.esc_info[esc_index + i].temperature = esc_info.temperature[i];
Expand All @@ -120,7 +120,7 @@ class ESCStatusPlugin : public plugin::PluginBase

_esc_status.header.stamp = m_uas->synchronise_stamp(esc_status.time_usec);

for (int i = 0; i < batch_size; i++)
for (int i = 0; i < std::min<ssize_t>(batch_size, ssize_t(_max_esc_count) - esc_index); i++)
{
_esc_status.esc_status[esc_index + i].header = _esc_status.header;
_esc_status.esc_status[esc_index + i].rpm = esc_status.rpm[i];
Expand Down

0 comments on commit 74883f0

Please sign in to comment.