It is useful to my project to have data of the state of the arduino available in ROS. Depending on what is going on it might be for example the current PID parameters, the number of errors that were detected as the arm is moving and so on. As the particular variables might change from time to time I am toying with a different idea.
I would like to define a message that is flexible with respect to what it contains. The message would be published by the Arduino and available to ROS for display or other actions.
I have considered the following approaches:
- I could of course simply modify the message and rebuild everything if I want to add or change a variable. That's what I am trying to avoid.
- I could have a message that contains a JSON string. I would have to convert the data to JSON on the arduino and back from JSON in ROS. The string could be very long.
- I could have a message with an array of doubles and an equal length array of string which would be the name of the variable. I am not sure about arrays in messages.
I have to think this problem has been addressed in the past. Any recommendations or pointers would be appreciated.