ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

c++ api to get message md5sum from string msg type (e.g. std_msgs/Int32)

asked 2013-10-08 11:11:51 -0500

jbrindza gravatar image

updated 2014-01-28 17:18:10 -0500

ngrennan gravatar image

Is there a c++ equivalent to retrieve the md5sum of a message type from the string msg type?

In python you can do:

import roslib
int32_msg_class = roslib.message.get_message_class('std_msgs/Int32');
int32_msg_md5sum = int32_msg_class._md5sum;

Is there a C++ API for doing the same?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2013-10-08 15:24:30 -0500

Dirk Thomas gravatar image

updated 2013-10-08 15:25:50 -0500

In C++ you can "ask" the message type instead of using an API like in Python.

#include "mypackage/MyMessage.h"
#include "ros/message_traits.h"
std::string md5sum = message_traits::md5sum<MyMessage>();

Since you need to have the message type for that at compile time this won't work when you have the message type as a string only.

edit flag offensive delete link more

Comments

Thanks. That is what I thouhgt, just wanted to make sure it wasn't possible to do at runtime without a system call.

jbrindza gravatar image jbrindza  ( 2013-10-09 05:16:18 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-10-08 11:11:51 -0500

Seen: 776 times

Last updated: Oct 08 '13