Subscriber to /diagnostic topic

I am trying to do a subscriber for the /diagnostic topic.
The message is diagnostic_msgs::DiagnosticArray and inside has a diagnostic_msgs::DiagnosticStatus array named status.
I like access to the members inside of this array: name, message… in the callback.

I am using a pointer to the diagnostic_msgs::DiagnosticArray:

message_string=pointer->status->message;

the type of message is string.

What is wrong? Many thanks.

HI, @rbaguena ,

  1. Can you share the code you are using.
  2. Have you considered using dot operator to access the object variables? that is, callback_msg.variable1