Skip to content

Commit

Permalink
wait for fmu before mode registration
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeLaine authored and bkueng committed Jul 22, 2024
1 parent 411b3b1 commit bfebd82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions px4_ros2_cpp/src/components/mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "px4_ros2/components/mode.hpp"
#include "px4_ros2/components/message_compatibility_check.hpp"
#include "px4_ros2/components/wait_for_fmu.hpp"

#include "registration.hpp"

Expand Down Expand Up @@ -55,8 +56,8 @@ bool ModeBase::doRegister()
{
assert(!_registration->registered());

if (!_skip_message_compatibility_check &&
!messageCompatibilityCheck(node(), {ALL_PX4_ROS2_MESSAGES}, topicNamespacePrefix()))
if (!_skip_message_compatibility_check && (!waitForFMU(node(), 15s) ||
!messageCompatibilityCheck(node(), {ALL_PX4_ROS2_MESSAGES}, topicNamespacePrefix())))
{
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion px4_ros2_cpp/src/components/mode_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "px4_ros2/components/mode_executor.hpp"
#include "px4_ros2/components/message_compatibility_check.hpp"
#include "px4_ros2/components/wait_for_fmu.hpp"

#include "registration.hpp"

Expand Down Expand Up @@ -50,7 +51,9 @@ bool ModeExecutorBase::doRegister()

assert(!_registration->registered());

if (!messageCompatibilityCheck(_node, {ALL_PX4_ROS2_MESSAGES}, _topic_namespace_prefix)) {
if (!waitForFMU(node(), 15s) ||
!messageCompatibilityCheck(node(), {ALL_PX4_ROS2_MESSAGES}, _topic_namespace_prefix))
{
return false;
}

Expand Down

0 comments on commit bfebd82

Please sign in to comment.