Adding a Custom Message to Magni

I added an array of power sensors to monitor the various devices I have added to the robot as part of a “performance per watt” exercise. The sensor array is monitored by a separate Raspberry Pi which is attached to the Ubiquity Pi via ROS_MASTER_URI, etc. environment variables.

The .msg file works great when I do rostopic echo /power_consumption from the NEW pi. But the Ubiquity pi doesn’t recognize the message format so I cannot collect the message data from other devices (analytics workstation).

Where should I put the custom .msg file so the magni will find it and recognize it? I’ve tried a lot of directories already containing .msg files, but it doesn’t seem to recognize my .msg file.

Message text: ERROR: Cannot load message class for [ina260/power_msgs]. Are your messages built?

This goes for ROS in general: message and service declaration files are usually kept in separate packages because they need to be present and compiled on all linked systems, except when you’re using roslibjs which just uses json and doesn’t care about anything.

So in your case just take the package you’re running on the monitoring pi, add it to the magni pi, compile it and leave it be. That should add the message types.

1 Like

Well THAT was easy. Thanks!

For anyone who wants more specific instructions, I just went to the ~/catkin_ws/src directory:

  1. catkin_create_package rospy std_msgs
  2. make directory msg and put the custom message into that folder
  3. make the usual changes to package.xml and CMakeLists.txt
  4. run catkin_make
  5. reboot