Md Hasibur Rahman
Md Hasibur Rahman

Reputation: 11

Add a function in Veins using TraCIcommandInterface

I want to add a function called getFollowSpeed in Veins but I am getting an error. I already defined the function name in both TraCIcommandInterface.cc and TraCIcommandInterface.h.

I also defined the function in TraCIconstant.h.

Please see the attached code in TraCIcommandInterface.cc.

double TraCICommandInterface::Vehicle::getFollowSpeed(double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string leaderID)
{

    uint8_t variableId = VAR_FOLLOW_SPEED;
    uint8_t variableType = TYPE_COMPOUND;
    int32_t count = 5;
    uint8_t speedType = TYPE_DOUBLE;
    uint8_t gapType = TYPE_DOUBLE;
    uint8_t leaderSpeedType = TYPE_DOUBLE;
    uint8_t leaderMaxDecelType = TYPE_DOUBLE;
    uint8_t LeaderIdType = TYPE_STRING;

    TraCIBuffer request;
    request << variableId << nodeId << variableType << speedType << speed << gapType << gap <<
            leaderSpeedType << leaderSpeed << leaderMaxDecelType << leaderMaxDecel << LeaderIdType << leaderID ;


    TraCIBuffer response = connection->query(CMD_GET_VEHICLE_VARIABLE,request);

    ASSERT(buf.eof());

}

Here is the error message that I received during running Omnet++ and Sumo through veins.

TraCI server reported error executing command 0xa4 ("Get Vehicle Variable: unsupported variable 0x1c specified"). -- in module (TraCIDemo11p) RSUExampleScenario.node[0].appl (id=14), at t=1s, event #2

I am using Veins 4.7.1 and Omnet 5.3 and sumo 0.32.0.

Can Anyone help me with this? Why I am getting this error. I have already defined the function. I would be very grateful for that.

Thanks in advance.

Upvotes: 1

Views: 118

Answers (1)

Jerzy D.
Jerzy D.

Reputation: 7002

VAR_FOLLOW_SPEED is not available in SUMO 0.32.0. Function getFollowSpeed was recently added to current GIT version of SUMO. See SUMO changelog.

Upvotes: 1

Related Questions