【问题标题】:Add a function in Veins using TraCIcommandInterface使用 TraCIcommandInterface 在 Veins 中添加函数
【发布时间】:2020-04-25 18:25:46
【问题描述】:

我想在 Veins 中添加一个名为 getFollowSpeed 的函数,但出现错误。我已经在TraCIcommandInterface.ccTraCIcommandInterface.h 中定义了函数名。

我还在TraCIconstant.h中定义了函数。

请查看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());

}

这是我在通过静脉运行 Omnet++ 和 Sumo 时收到的错误消息。

TraCI 服务器报告错误执行命令 0xa4(“获取车辆变量:不支持的变量 0x1c 指定”)。 -- 在模块 (TraCIDemo11p) RSUExampleScenario.node[0].appl (id=14) 中,在 t=1s,事件 #2

我正在使用 Veins 4.7.1、Omnet 5.3 和 sumo 0.32.0。

谁能帮我解决这个问题?为什么我收到此错误。我已经定义了函数。对此我将不胜感激。

提前致谢。

【问题讨论】:

    标签: omnet++ veins sumo


    【解决方案1】:

    VAR_FOLLOW_SPEED 在 SUMO 0.32.0 中不可用。函数 getFollowSpeed 最近被添加到当前 GIT 版本的 SUMO 中。见SUMO changelog

    【讨论】:

    • 感谢您的回复。我已经尝试过 SUMO 1.5.0,但仍然无法正常工作。你知道getFollowSpeed 也只添加在 python API 或 Veins (Omnet++) 中吗?
    猜你喜欢
    • 2018-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 2018-08-09
    • 1970-01-01
    • 1970-01-01
    • 2017-02-24
    相关资源
    最近更新 更多