strands-project / mongodb_store

MongoDB tools for storing and analysing runs of ROS systems.
BSD 3-Clause "New" or "Revised" License
49 stars 72 forks source link

mongodb_store: support shapeshifter #198

Closed furushchev closed 6 years ago

furushchev commented 6 years ago

In C++, topic_tools/ShapeShifter is used for the representation like AnyMsg in Python. Before this pull request, message type of topic_tools/ShapeShifter is set as *, not the original type of message, which causes failure on insertion.

ERROR] [WallTime: 1504084639.503414] bad callback: <bound method MessageStore.insert_ros_msg of <__main__.MessageStore object at 0x7f6dc5adcad0>>
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 720, in _invoke_callback
    cb(msg)
  File "/home/furushchev/ros/indigo/src/mongodb_store/mongodb_store/scripts/message_store_node.py", line 83, in insert_ros_msg
    self.insert_ros_srv(msg)
  File "/home/furushchev/ros/indigo/src/mongodb_store/mongodb_store/scripts/message_store_node.py", line 93, in insert_ros_srv
    obj = dc_util.deserialise_message(req.message)
  File "/home/furushchev/ros/indigo/src/mongodb_store/mongodb_store/src/mongodb_store/util.py", line 511, in deserialise_message
    cls_string = type_to_class_string(serialised_message.type)
  File "/home/furushchev/ros/indigo/src/mongodb_store/mongodb_store/src/mongodb_store/util.py", line 464, in type_to_class_string
    cls_string = "%s.msg._%s.%s" % (parts[0], parts[1], parts[1])
IndexError: list index out of range

In this pull request, I added special serialization function for topic_tools/ShapeShifter using template specialization.

strands-jenkins commented 6 years ago

Can one of the STRANDS admins verify this patch? Post a comment containing "ok to test" to enable Jenkins builds for this pull request.

furushchev commented 6 years ago

I further fixed to use ros::message_traits::datatype method to get data type string of serialized message instead of ros::message_traits::DataType<MsgType>::value() which returns meaningless value if message type is topic_tools::ShapeShifter and now we don't have to define specialized function.

Also added test codes for this case.

furushchev commented 6 years ago

@hawesie Thank you very much for merging! Please could you release it when you have time :+1:

hawesie commented 6 years ago

We're just battling with some 14.04 release issues, but it should be done soon.

hawesie commented 6 years ago

@furushchev please remind me again which ROS version you use and where you get your releases from?

furushchev commented 6 years ago

@hawesie Thank you! I'm using indigo for ROS version and shadow-fixed for getting released packages.

hawesie commented 6 years ago

I've been trying to release, but there's some weird key errors: http://build.ros.org/job/Kbin_djv8_dJv8__mongodb_store__debian_jessie_arm64__binary/5/console

hawesie commented 6 years ago

Actually the failure is for 15.04, so maybe we're ok.