#include "config.h"
#include <gtest/gtest.h>
#include "ros_type_introspection/ros_introspection.hpp"
#include <sensor_msgs/JointState.h>
#include <sensor_msgs/NavSatStatus.h>
#include <sensor_msgs/Imu.h>
#include <sensor_msgs/Image.h>
#include <std_msgs/Int16MultiArray.h>
Go to the source code of this file.
Functions | |
std::vector< uint8_t > | buffer (ros::serialization::serializationLength(imu)) |
std::vector< uint8_t > | buffer (ros::serialization::serializationLength(multi_array)) |
std::vector< uint8_t > | buffer (ros::serialization::serializationLength(image)) |
parser | deserializeIntoFlatContainer ("imu", absl::Span< uint8_t >(buffer),&flat_container, 100) |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/header/seq")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 2016) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/header/stamp")) | |
EXPECT_EQ (flat_container.value[index].second.convert< double >(), double(1234.567)) | |
EXPECT_EQ (flat_container.value[index].second.convert< ros::Time >(), imu.header.stamp) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/orientation/x")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 11) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/orientation/y")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 12) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/orientation/z")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 13) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/orientation/w")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 14) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/angular_velocity/x")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 21) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/angular_velocity/y")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 22) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/angular_velocity/z")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 23) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/linear_acceleration/x")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 31) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/linear_acceleration/y")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 32) | |
EXPECT_EQ (flat_container.value[index].first.toStdString(),("imu/linear_acceleration/z")) | |
EXPECT_EQ (flat_container.value[index].second.convert< int >(), 33) | |
EXPECT_NO_THROW (parser.deserializeIntoFlatContainer("multi_array", absl::Span< uint8_t >(buffer),&flat_container, 100)) | |
EXPECT_NO_THROW (parser.deserializeIntoFlatContainer("image_raw", absl::Span< uint8_t >(buffer),&flat_container, 100)) | |
for (int i=0;i< 9;i++) | |
if (VERBOSE_TEST) | |
int | main (int argc, char **argv) |
parser | registerMessageDefinition ("imu", ROSType(DataType< sensor_msgs::Imu >::value()), Definition< sensor_msgs::Imu >::value()) |
parser | registerMessageDefinition ("multi_array", ROSType(DataType< std_msgs::Int16MultiArray >::value()), Definition< std_msgs::Int16MultiArray >::value()) |
parser | registerMessageDefinition ("image_raw", ROSType(DataType< sensor_msgs::Image >::value()), Definition< sensor_msgs::Image >::value()) |
multi_array data | resize (N) |
image data | resize (image.height *image.step) |
ros::serialization::OStream | stream (buffer.data(), buffer.size()) |
TEST (Deserialize, JointState) | |
TEST (Deserialize, NavSatStatus) | |
Variables | |
multi_array layout | data_offset = 42 |
FlatMessage | flat_container |
imu header | frame_id = "pippo" |
image | height = 480 |
sensor_msgs::Image | image |
sensor_msgs::Imu | imu |
int | index = 0 |
std_msgs::Int16MultiArray | multi_array |
const unsigned | N = 6 |
imu header stamp | nsec = 567*1000*1000 |
imu header stamp | sec = 1234 |
imu header | seq = 2016 |
image | step = 3*image.width |
imu orientation | w = 14 |
image | width = 640 |
imu orientation | x = 11 |
imu orientation | y = 12 |
imu orientation | z = 13 |
std::vector<uint8_t> buffer | ( | ros::serialization::serializationLength(imu) | ) |
std::vector<uint8_t> buffer | ( | ros::serialization::serializationLength(multi_array) | ) |
std::vector<uint8_t> buffer | ( | ros::serialization::serializationLength(image) | ) |
parser deserializeIntoFlatContainer | ( | "imu" | , |
absl::Span< uint8_t > | buffer, | ||
& | flat_container, | ||
100 | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
2016 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/header/stamp") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< double > | ()[index], |
double(1234.567) | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< ros::Time > | ()[index], |
imu.header. | stamp | ||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/orientation/x") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
11 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/orientation/y") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
12 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/orientation/z") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
13 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/orientation/w") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
14 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/angular_velocity/x") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
21 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/angular_velocity/y") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
22 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/angular_velocity/z") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
23 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/linear_acceleration/x") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
31 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/linear_acceleration/y") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
32 | |||
) |
EXPECT_EQ | ( | flat_container.value.first. | toStdString()[index], |
("imu/linear_acceleration/z") | |||
) |
EXPECT_EQ | ( | flat_container.value.second.convert< int > | ()[index], |
33 | |||
) |
EXPECT_NO_THROW | ( | parser. | deserializeIntoFlatContainer"multi_array", absl::Span< uint8_t >(buffer),&flat_container, 100 | ) |
EXPECT_NO_THROW | ( | parser. | deserializeIntoFlatContainer"image_raw", absl::Span< uint8_t >(buffer),&flat_container, 100 | ) |
for | ( | ) |
Definition at line 237 of file deserializer_test.cpp.
if | ( | VERBOSE_TEST | ) |
Definition at line 252 of file deserializer_test.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 459 of file deserializer_test.cpp.
parser registerMessageDefinition | ( | "imu" | , |
ROSType(DataType< sensor_msgs::Imu >::value()) | , | ||
Definition< sensor_msgs::Imu > | ::value() | ||
) |
parser registerMessageDefinition | ( | "multi_array" | , |
ROSType(DataType< std_msgs::Int16MultiArray >::value()) | , | ||
Definition< std_msgs::Int16MultiArray > | ::value() | ||
) |
parser registerMessageDefinition | ( | "image_raw" | , |
ROSType(DataType< sensor_msgs::Image >::value()) | , | ||
Definition< sensor_msgs::Image > | ::value() | ||
) |
multi_array data resize | ( | N | ) |
image data resize | ( | image.height *image. | step | ) |
ros::serialization::OStream stream | ( | buffer. | data(), |
buffer. | size() | ||
) |
TEST | ( | Deserialize | , |
JointState | |||
) |
Definition at line 15 of file deserializer_test.cpp.
TEST | ( | Deserialize | , |
NavSatStatus | |||
) |
Definition at line 170 of file deserializer_test.cpp.
multi_array layout data_offset = 42 |
Definition at line 400 of file deserializer_test.cpp.
FlatMessage flat_container |
Definition at line 248 of file deserializer_test.cpp.
Definition at line 222 of file deserializer_test.cpp.
image height = 480 |
Definition at line 439 of file deserializer_test.cpp.
sensor_msgs::Image image |
Definition at line 437 of file deserializer_test.cpp.
sensor_msgs::Imu imu |
Definition at line 217 of file deserializer_test.cpp.
index = 0 |
Definition at line 260 of file deserializer_test.cpp.
std_msgs::Int16MultiArray multi_array |
Definition at line 397 of file deserializer_test.cpp.
const unsigned N = 6 |
Definition at line 399 of file deserializer_test.cpp.
Definition at line 221 of file deserializer_test.cpp.
Definition at line 220 of file deserializer_test.cpp.
Definition at line 219 of file deserializer_test.cpp.
image step = 3*image.width |
Definition at line 440 of file deserializer_test.cpp.
imu orientation w = 14 |
Definition at line 227 of file deserializer_test.cpp.
image width = 640 |
Definition at line 438 of file deserializer_test.cpp.
imu linear_acceleration x = 11 |
Definition at line 224 of file deserializer_test.cpp.
imu linear_acceleration y = 12 |
Definition at line 225 of file deserializer_test.cpp.
imu linear_acceleration z = 13 |
Definition at line 226 of file deserializer_test.cpp.