Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_DDS/tests/test_ap_dds_external_odom.cpp
Views: 1799
#include <AP_gtest.h>12#include <AP_DDS/AP_DDS_config.h>34#include <AP_DDS/AP_DDS_External_Odom.h>5#include "geometry_msgs/msg/TransformStamped.h"6#include <AP_HAL/AP_HAL.h>78#if AP_DDS_VISUALODOM_ENABLED910const AP_HAL::HAL &hal = AP_HAL::get_HAL();1112TEST(AP_DDS_EXTERNAL_ODOM, test_is_odometry_success)13{14geometry_msgs_msg_TransformStamped msg {};1516strncpy(msg.header.frame_id, "odom", strlen("odom") + 1);17strncpy(msg.child_frame_id, "base_link", strlen("base_link") + 1);18ASSERT_TRUE(AP_DDS_External_Odom::is_odometry_frame(msg));1920strncpy(msg.header.frame_id, "invalid", strlen("invalid") + 1);21strncpy(msg.child_frame_id, "base_link", strlen("base_link") + 1);22ASSERT_FALSE(AP_DDS_External_Odom::is_odometry_frame(msg));2324strncpy(msg.header.frame_id, "odom", strlen("odom") + 1);25strncpy(msg.child_frame_id, "invalid", strlen("invalid") + 1);26ASSERT_FALSE(AP_DDS_External_Odom::is_odometry_frame(msg));2728strncpy(msg.header.frame_id, "odom_with_invalid_extra", strlen("odom_with_invalid_extra") + 1);29strncpy(msg.child_frame_id, "base_link", strlen("base_link") + 1);30ASSERT_FALSE(AP_DDS_External_Odom::is_odometry_frame(msg));3132strncpy(msg.header.frame_id, "odom", strlen("odom") + 1);33strncpy(msg.child_frame_id, "base_link_with_invalid_extra", strlen("base_link_with_invalid_extra") + 1);34ASSERT_FALSE(AP_DDS_External_Odom::is_odometry_frame(msg));3536strncpy(msg.header.frame_id, "x", strlen("x") + 1);37strncpy(msg.child_frame_id, "base_link", strlen("base_link") + 1);38ASSERT_FALSE(AP_DDS_External_Odom::is_odometry_frame(msg));39}4041#endif // AP_DDS_VISUALODOM_ENABLED4243AP_GTEST_MAIN()444546