Monday, July 29, 2019

ROS: Fix "Unable to get message class for type custom_msgs/gnssSample"

I recently received a ROS bag file recorded with a Velodyne VLP-16 LiDAR sensor and a XSens IMU-GPS sensor. When playing back the bag file, the ROS rqt plugins could not expand the XSens messages. The error message: can not get message class for type "custom_msgs/gnssSample" is shown in the screen shot below.
 
I found a deprecated Github repository for the XSens MTi ROS node at https://github.com/xsens/xsens_mti_ros_node that has the definitions for the custom message gnssSample. However, the repository's package name is xsens_msgs while the bag file's package name is custom_msgs. I had to rename the package to get ROS to recognize the bag file's messages. So the following steps were how I resolved the problem.
  1. Follow the tutorial at https://wiki.ros.org/ROS/Tutorials/CreatingPackage to create a Catkin workspace e.g. /home/yourname/catkin_ws/.
  2. Open up a Terminal and change the directory to /home/yourname/catkin_ws/src/.

    $ cd /home/yourname/catkin_ws/src
  3. Download the XSens MTi ROS Node repository.

    $ git clone https://github.com/xsens/xsens_mti_ros_node
  4. Using a text editor, open up the file /home/yourname/catkin_ws/src/xsens_mti_ros_node/src/xsens_msgs/package.xml.


  5. Change the package name to custom_msgs as shown below.


  6. Open up the file /home/yourname/catkin_ws/src/xsens_mti_ros_node/src/xsens_msgs/CMakeLists.txt.



  7. Change the project name to custom_msgs as shown below.


  8. Now in a Terminal change to the catkin root directory.

    $ cd /home/yourname/catkin_ws
  9. Compile the package by entering the command:

    $ catkin_make
If the compilation is successful, now when reviewing the messages with rqt, the custom_msgs/gnssSample message can be expanded, as shown below.

No comments: