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

wait for fmu before mode registration #47

Merged
merged 1 commit into from
Jul 22, 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
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) ||
Copy link
Member Author

Choose a reason for hiding this comment

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

The mode executor could check if its owned mode is set to skip the message check?
This would require adding a getter to the Mode class though

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's only used for unit tests

!messageCompatibilityCheck(node(), {ALL_PX4_ROS2_MESSAGES}, _topic_namespace_prefix))
{
return false;
}

Expand Down
Loading