10 int main(
int argc,
char** argv)
15 printf(
"Usage: rosbag_example rosbag_file.bag\n");
25 printf(
"rosbag::open thrown an exception:\n");
35 const std::string& topic_name = connection->topic;
36 const std::string& datatype = connection->datatype;
37 const std::string& definition = connection->msg_def;
44 std::map<std::string, FlatMessage> flat_containers;
45 std::map<std::string, RenamedValues> renamed_vectors;
48 std::vector<uint8_t>
buffer;
52 const std::string& topic_name = msg_instance.getTopic();
55 const size_t msg_size = msg_instance.size();
56 buffer.resize(msg_size);
58 msg_instance.write(
stream);
66 &flat_container, 100 );
72 printf(
"--------- %s ----------\n", topic_name.c_str() );
73 for (
auto it: renamed_values)
75 const std::string& key = it.first;
76 const Variant& value = it.second;
77 printf(
" %s = %f\n", key.c_str(), value.
convert<
double>() );
79 for (
auto it: flat_container.
name)
81 const std::string& key = it.first.toStdString();
82 const std::string& value = it.second;
83 printf(
" %s = %s\n", key.c_str(), value.c_str() );
std::vector< std::pair< StringTreeLeaf, std::string > > name
std::vector< const ConnectionInfo * > getConnections()
void open(std::string const &filename, uint32_t mode=bagmode::Read)
RosIntrospection::Parser parser
void applyNameTransform(const std::string &msg_identifier, const FlatMessage &container, RenamedValues *renamed_value)
int main(int argc, char **argv)
bool deserializeIntoFlatContainer(const std::string &msg_identifier, absl::Span< uint8_t > buffer, FlatMessage *flat_container_output, const uint32_t max_array_size) const
FlatMessage flat_container
std::vector< std::pair< std::string, Variant > > RenamedValues
ros::serialization::OStream stream(buffer.data(), buffer.size())
std::vector< uint8_t > buffer(ros::serialization::serializationLength(imu))
void registerMessageDefinition(const std::string &message_identifier, const ROSType &main_type, const std::string &definition)