Welcome, Guest

How does the JAUS Component/message work?
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: How does the JAUS Component/message work?
#170
Re: How does the JAUS Component/message work? 6 Months, 2 Weeks ago  
The jausAddressCopy line does set the destination, however where does your "address" field come from? I assume it is farther up in your code. The <specific>MessageToJausMessage() functions do not set any values related to the source or destination address. They merely copy the value defined in the specificMessage to the generic JausMessage container.

Remember, the source address - the address of the sending component - is stored in the OjCmpt structure. Since that structure is not passed to the <specific>MessageToJausMessage() function, it has no knowledge of the source JAUS address. This is done purposefully, otherwise the libjaus library would have a dependency on the libOpenJAUS library which is unwanted in the OpenJAUS design.
kentd
Go Gators!
Admin
Posts: 61
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Draco098 Lights Out Photography Draco098 Draco098 Draco098 Location: Charlotte, NC Birthday: 09/20
The administrator has disabled public write access.
There's 10 types of people in the world; those that understand binary and those that don't.
 
#171
Re: How does the JAUS Component/message work? 6 Months, 2 Weeks ago  
I see, that makes sense. Ok, I set source and dest addresses but there is still one more issue left. When I create a jausMessageFromLidarDataMessage the presence vector doesn't seem to get copied because when I go to retrieve the data back from the jausMessageToReportLidarDataMessage and check for presence vectors they are all 0. I looked at the code that converts from LidarDataMessage to JausMessage and there is no place where presence vectors get copied. The getDataFromBuffer function looks at the presence vectors before it loads the data. That is why I cannot receive the data in my component. Here is my code for creating report message converting it to jaus message and then converting it back. The data gets lost.
Code:


//setup the LidarData file
ReportLidarDataMessage myReportMsg = reportLidarDataMessageCreate();
JausMessage txtMessage;
JausAddress address = ojCmptGetAddress(rsensor);
//creating a report message
jausByteSetBit(&myReportMsg->presenceVector, JAUS_LIDAR_DATA_RANGES_BIT);
jausByteSetBit(&myReportMsg->presenceVector, JAUS_LIDAR_DATA_X_BIT);
jausByteSetBit(&myReportMsg->presenceVector, JAUS_LIDAR_DATA_Y_BIT);
jausByteSetBit(&myReportMsg->presenceVector, JAUS_LIDAR_DATA_T_BIT);
memcpy(&myReportMsg->ranges,lidarData, 2800);
myReportMsg->deltaX = 12;
myReportMsg->deltaY = 10;
myReportMsg->deltaTheta = 20;
printf("PRESENCE VECTOR %d\n", myReportMsg->presenceVector); -> this prints 255
cout << "Original Message \n" << reportLidarDataMessageToString(myReportMsg)<<endl; -> this prints our all of the message with all of the fields set to values above.
txtMessage = reportLidarDataMessageToJausMessage(myReportMsg);
jausAddressCopy(txtMessage->destination,address);
jausAddressCopy(txtMessage->source,address);
cout << "JausMessage: \n" << jausMessageToString(txtMessage) << endl;
             JausMessage: 
            JAUS_REPORT_LIDAR_DATA (0x4803)
            Reserved: 0
            Version: 3.2 and 3.3 compatible
            Exp. Flag: Not Experimental
            SC Flag: Not Service Connection
            ACK/NAK: None
            Priority: Normal Priority 6
            Source: 1.1.50.2
            Destination: 1.1.50.2
            Data Size: 2844
            Data Flag: 0 Only data packet in single-packet stream
            Sequence Number: 0
ReportLidarDataMessage report = reportLidarDataMessageFromJausMessage(txtMessage);
cout << "New Message \n" << reportLidarDataMessageToString(report)<<endl;
               New Message 
               JAUS_REPORT_LIDAR_DATA (0x4803)
               Reserved: 0
               Version: 3.2 and 3.3 compatible
               Exp. Flag: Not Experimental
               SC Flag: Not Service Connection
               ACK/NAK: None
               Priority: Normal Priority 6
               Source: 1.1.50.2
               Destination: 1.1.50.2
               Data Size: 2844
               Data Flag: 0 Only data packet in single-packet stream
               Sequence Number: 0
               Presence Vector: 0x0
               Time Stamp: 
ojCmptSendMessage(rsensor,txtMessage);
jausMessageDestroy(txtMessage);
reportLidarDataMessageDestroy(myReportMsg);



I'm really not sure why this doesn't work. My code follows all the examples in ojVehicleSim.
victort
OpenJAUS Contributor
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#172
Re:How does the JAUS Component/message work? 6 Months, 1 Week ago  
The mistake you are making is in regard to the Presence Vector field. A Presence Vector is not part of every JAUS message, i.e. it is not contained in the header structure. You can see what fields are and are not contained in the header by looking at the header for any of the messages or looking it up in the JAUS RA document. The Presence Vector is used when some or all fields of a given message are optional. It indicates which fields are presence in the message at runtime.

For messages that do include a Presence Vector, such as you have implemented, the first element packed and unpacked from the byte stream in the dataToBuffer and dataFromBuffer methods has to be that Presence Vector. I suspect the only mistake you have made is not to explicitly pack and unpack the Presence Vector field.

There is a good blurb on Presence Vectors in the Creating an Experimental Message tutorial. It suggests the Report Global Pose message as a good example of a message which uses a Presence Vector for optional fields.

Remember: If you don't want optional fields in a message, there is no need for the Presence Vector at all and you can omit it completely!
kentd
Go Gators!
Admin
Posts: 61
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Draco098 Lights Out Photography Draco098 Draco098 Draco098 Location: Charlotte, NC Birthday: 09/20
The administrator has disabled public write access.
There's 10 types of people in the world; those that understand binary and those that don't.
 
#173
Re:How does the JAUS Component/message work? 6 Months, 1 Week ago  
Hey thanks a lot for your help. I got my component to work properly.
victort
OpenJAUS Contributor
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12
Copyright © 2010 OpenJAUS. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.