There are many ways to deal ROS topics published by the ThingMagic USB Pro RFID Reader. You might have your MATLAB/Simulink program subscribe to the
rfid topic and react to the detection events. Another option is to just record the publications in a ROS bag file and post-process the bag file to read the RFID publications and correlate them with the navigation data as illustrated in this example.
Since the RFID reader publishes String messages (http://docs.ros.org/kinetic/api/std_msgs/html/msg/String.html) on the
rfid topic. In this example a bag file is recorded with the navigation (Odometry and Geonav) and RFID topics. The MATLAB post-processing does the following:
- Selects a subset of the bag file based on the RFID topic name,
- Generates a timeseries MATLAB object so that we know the time of each detection event,
- Reads the Data field of the String message to find the ID reported by the reader for each event,
- Finds a list of the unique ID's reported in the bag file
- Uses interpolation to find the navigation estimate nearest in time to each RFID event and plots the location of each event
- Determines the mean location (centroid) for the events for each of the unique ID strings and plots this as the cumulative estimate of the tag location
The MATLAB example script builds upon the code from Assignment 7: Sensor Integration and Outdoor Navigation and is available in the
mrc_hw7 git repository at https://gitlab.nps.edu/bsbingha/mrc_hw7/blob/master/matlab/plot_rfid.m. The additional code that deals with the RFID messages is at the end of the script.
If we run this script with the
two_bots.bag file at https://gitlab.nps.edu/smsundey/mrc_project/tree/master/data then we get an image like this...
The green, red and blue open circles are the locations where messages were received on the
rfid topic and the large 'X's are the mean location for the collection of each set of events.