Hello Jakob,Thanks for replying, i tried what you suggested but it didn't work 
out still same error.
Error: tcpip::Storage::readIsSafe: want to read 823066624 bytes from Storage, 
but only 21 remaining Quitting (on error).

I will paste my entire in function, in case i am doing something stupid ,please 
take a look!
TraCITestClient::Position TraCITestClient::getPosition()
{
send_commandGetVariable(0xa4, 0x42, "veh1");//first i got XY coordinates

tcpip::Storage inMsg;
try {
    std::string acknowledgement;
    check_resultState(inMsg, 0xa4, false, &acknowledgement);

} catch (tcpip::SocketException& e) {
    pos.x = -1;
    pos.y = -1;
    return pos;
}
check_commandGetResult(inMsg, 0xa4, -1, false);
// report result state
try {
    int variableID = inMsg.readUnsignedByte();
    std::string objectID = inMsg.readString();

    int valueDataType = inMsg.readUnsignedByte();

    pos.x = inMsg.readDouble();
    pos.y = inMsg.readDouble();

} catch (tcpip::SocketException& e) {
    std::stringstream msg;
    msg << "Error while receiving command: " << e.what();
    errorMsg(msg);
    pos.x = -1;
    pos.y = -1;
    return pos;
}

//till here i am getting correct value in pos.x and pos.y

// now i want to convert these XY coordinates to actual Lat Long


    tcpip::Storage* tmp = new tcpip::Storage;


    tmp->writeByte(TYPE_COMPOUND);
    tmp->writeInt(2);

    tmp->writeByte(POSITION_2D);// as suggested added this line
    tmp->writeDouble(pos.x);
    tmp->writeDouble(pos.y);
    tmp->writeByte(TYPE_UBYTE);

    tmp->writeUnsignedByte(POSITION_LON_LAT);

send_commandGetVariable(0x82, 0x58, "veh1",tmp); //**here i am getting error**

tcpip::Storage inMsgX;
try {
    std::string acknowledgement;
    check_resultState(inMsgX, 0x82, false, &acknowledgement);

} catch (tcpip::SocketException& e) {
    return pos;
}
check_commandGetResult(inMsgX, 0x82, -1, false);
// report result state
try {

    int variableID = inMsgX.readUnsignedByte();
    std::string objectID = inMsgX.readString();

    int valueDataType = inMsgX.readUnsignedByte();


    pos.x = inMsgX.readDouble();
    pos.y = inMsgX.readDouble();

} catch (tcpip::SocketException& e) {
    std::stringstream msg;
    msg << "Error while receiving command: " << e.what();
    errorMsg(msg);
    return pos;
}

return pos;
}what could be the error, are those command Id's correct? 

    On Wednesday, 7 December 2016 2:28 PM, Jakob Erdmann 
<[email protected]> wrote:
 

 Hello,
you need to specify the source position type
tmp->writeByte(POSITION_2D)
before sending x and y

regards,
Jakob


From: Wasim Ahmed <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Date: Tue, 6 Dec 2016 12:52:27 +0000 (UTC)
Subject: Fw: SUMO-TRACI-QUERY [Converting XY Coordinates to Lat/Long]




  Hello,    I wanted to convert the retrieved XY coordinates to Latitude and 
Longitude.    I saw the command to do so is 0x82 and 0x58 in documentation  
[http://www.sumo.dlr.de/wiki/ TraCI/Simulation_Value_ Retrieval#Command_0x82:_ 
Position_Conversion].    I have valid XY Coordinates in pos.x and pos.y.  So in 
order to convert my XY Coordinates to Lat/Long .  I am using following command. 
Don’t know what’s wrong with it:    tcpip::Storage*tmp = new tcpip::Storage;    
tmp->writeByte(TYPE_COMPOUND); tmp->writeInt(2);    tmp->writeDouble(pos.x); 
tmp->writeDouble(pos.y); tmp->writeByte(TYPE_UBYTE);    tmp->writeUnsignedByte( 
POSITION_LON_LAT);    send_commandGetVariable(0x82, 0x58,“veh1”,tmp);    I 
debugged the code and error is coming in “send_commandGetVariable(0x82, 
0x58,“veh1”,tmp);” function. Getting following error on SUMO-GUI Server:    
Error: tcpip::Storage::readIsSafe: want to read 823066624 bytes from Storage, 
but only 20 remaining Quitting (on error).       Any Help!!    ThanksJ  





   
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to