omnet++ - 使用 TraCIcommandInterface 在 Veins 中添加函数
问题描述
我想添加一个getFollowSpeed
在 Veins 中调用的函数,但出现错误。TraCIcommandInterface.cc
我已经在和中定义了函数名TraCIcommandInterface.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。
谁能帮我这个?为什么我收到此错误。我已经定义了函数。对此我将不胜感激。
提前致谢。
解决方案
VAR_FOLLOW_SPEED
在 SUMO 0.32.0 中不可用。功能getFollowSpeed
最近添加到当前 GIT 版本的 SUMO。请参阅SUMO 更新日志。
推荐阅读
- node.js - 电子事件发射器错误,而 app.quit 关闭所有打开的渲染器进程
- python - FTP download - not saving
- android - RecyclerView messes up when scrolling
- javascript - How to do pop operation in javascript when unchecked checkbox?
- ruby-on-rails - Rails validates_format_of with Regex fails in case of new line
- database - Best database structure for building levels and upgrades
- css - Angular 7 + Angular Material, styleUrls doesn't work as one would expect
- angular - Angular 5 - 无法绑定到“ngModule”,因为它不是“输入”的已知属性
- javascript - 带有 ES6 模块导入的 ServiceWorker (Google Chrome)
- c# - Create common connect class