|
We have been using JAUS messages to transmit messages between underwater vehicles and I have noticed that there is a loss in precision between double that goes into a JAUS message and the double that comes out.
An example is the ReportTravelSpeed message. I have a structure that stores the message data which is then parsed into a ReportTravelSpeedMessage. I then create a generic JAUS message using
RTSMsg->speedMps = 12.3456789012;
JAUSMsg = reportTravelSpeedMessageMessageToJausMessage(RTSMsg)
If you turn that back into an RTSMsg using something like
RTSMsg_new = reportTravelSpeedMessageMessageFromJausMessage(JAUSMsg)
I have found that the
RTSMsg_new->speedMps = 12.3598077363
I have found that this is the result of the conversion the double to an unsigned short and vice versa in the jausUnsignedShortToDouble and jausUnsignedShortFromDouble routines. Apparently, this is just a fact of life in converting a 4 byte double into a 2 byte short and vice versa. I found as a test that converting to unsigned longs improves the accuracy of the conversion.
We have noticed this precision loss in all of our Jaus messages, some worse than others. I guess my question is, is this reasonable or am I doing something wrong here. It is certainly a valid question to wonder how accurately we know any real quantity underwater in a moving vehicle, but I would like to know that I am using OpenJaus correctly.
Thanks for your help and sorry the post is long. -- John
|