rosbag in matlab2018b error "No definition for Header"
7 views (last 30 days)
i tried to read a bag-file into workspace with
bag = rosbag('2018-09-12-17-19-28_7.bag')
and i get the following error
No definition for Header
# Single scan from a planar laser range-finder
# If you have another ranging device with different behavior (e.g. a sonar
# array), please find or create a different message, since applications
# will make fairly laser-specific assumptions about this data
Header header # timestamp in the header is the acquisition time of
# the first ray in the scan.
# in frame frame_id, angles are measured around
# the positive Z axis (counterclockwise, if Z is up)
# with zero angle being forward along the x axis
float32 angle_min # start angle of the scan [rad]
float32 angle_max # end angle of the scan [rad]
float32 angle_increment # angular distance between measurements [rad]
float32 time_increment # time between measurements [seconds] - if your scanner
# is moving, this will be used in interpolating position
# of 3d points
float32 scan_time # time between scans [seconds]
float32 range_min # minimum range value [m]
float32 range_max # maximum range value [m]
float32 ranges # range data [m] (Note: values < range_min or > range_max should be discarded)
float32 intensities # intensity data [device-specific units]. If your
# device does not provide intensities, please leave
# the array empty.
in matlab2016b, i can read this bag-file in matlab2016b without error. But i need to use matlab2018b due to other new functions.
Does anyone have a solution for this problem?
Thanks in advance!
Best regards, Huy
Andreas Marxer on 1 Nov 2019
Edited: Andreas Marxer on 1 Nov 2019
I have kind of the same issue with Matlab 2019b.
I have a ROS bag with sensor_msg/Image and I want to generate a new one with the same header time stamps as in the original one just with the adapted images I have processed.
The recording of the bag, as well as to play in in ros works. But when I open the new bag in Matlab (or also Python) again I get the following error: No definition for Header
But I copy the Header from the existing message into the new message and they are both of the same type.
When I show the details while debugging the Header seems to be identical. What could be the issue here?
EDIT Solution found:
I did get it to work using this tool: https://github.com/gavanderhoorn/rosbag_fixer
But I still not get what the issue exactly was.
More Answers (1)
Cam Salzberger on 4 Oct 2018
Though the message definition of "Header" is not defining a particular message, it is a known alias for "std_msgs/Header", so I believe that should be accounted for. I assume that the message type giving the issue is a standard sensor_msgs/LaserScan? If so, that should be supported by default as well.
I would suggest contacting Technical Support with your bag file (or a smaller example that also has the same issue). That will be the easiest way to follow up with you.
In the meantime, as a workaround, you could potentially read the messages in which you are interested into R2016b, and save them to a MAT file, which you can then load in R2018b to continue processing. If you run into any kind of message versioning conflict, you could save the data from the messages alone, and not the whole message objects. Or convert the messages into structures in R2016b before saving to the MAT file.
Hope this helps!