Trying to display sensor_msgs/Image in rqt_bag
I´m trying to display a custom message in rqt_bag. For that, I´ve tried the following:
msg = Image() //This is the initialization of my message
msg.image = self.msg
self.bag.write(topic, msg, self.msg.header.stamp)
self.bag2.write(topic, self.msg, self.msg.header.stamp)
- My message content (msg) is just: sensor_msgs/Image image.
- rqt_bag message (self.msg) contents:
std_msgs/Header header
uint32 height
uint32 width
string encoding
uint8 is_bigendian
uint32 step
uint8[] data - self.msg is tyoe sensor_msgs/Image, that´s why I can save the whole self.msg into msg.image
If I try to open the bag2 file which the one that uses the msg that rqt_bag creates, all works. However, If i try to open my custom message, rqt_bag doesn´t allow me to display the images.
I´ve also tried to save each field from self.msg to msg making first my custom message (msg) have the same structure as the rqt_bag message (self.msg):
msg.header = self.msg.header
msg.height = self.msg.height...
(in bag)-----------(in bag2)
Doing this what I have realized is that bag weights 306kB and bag2 308kB. It is like if there is some extra date somewhere which I don´t know.
Neither ways work for me. What can I do so that rqt_bag displays the images save on my custom message?? Thank you.
This may be slightly off point, but why are you trying to use a custom message to do exactly the same job as sensor_msgs/Image?
@PeteBlackerThe3rd cause I need to add extra parameters but I prefer to go little by little.
There is a much easier way of doing this, you can nest message types. Create your custom message type which includes a sensor_msgs/Image message along with the extra parameters you want to add. No need to re-invent the wheel.
@PeteBlackerThe3rd I dont know exactly what u mean. What I want is a message with sensor_msgs/Image image, string name, int8 number. Then, I have to store that msg in a bag, and finally display that bag in rqt_bag but i cant. Any idea? What u were saying is valid for this? If it is, can u explain?