我将 Veins 4.4 与 Omnet 4.6 和 Sumo 0.25 一起使用。
我想获得有关车辆高度的信息。我刚刚在 TraCICommandInterface 类中找到了 getLonLat() 方法。有没有关于高度的方法或其他方式来获取这种信息?谢谢
我试图修改上述功能如下:
std::list<double> TraCICommandInterface::getLonLatAlt(const Coord& coord) {
TraCIBuffer request;
request << static_cast<uint8_t>(POSITION_CONVERSION) << std::string("sim0")
<< static_cast<uint8_t>(TYPE_COMPOUND) << static_cast<int32_t>(2)
<< connection.omnet2traci(coord)
<< static_cast<uint8_t>(TYPE_UBYTE) << static_cast<uint8_t>(POSITION_LON_LAT_ALT);
TraCIBuffer response = connection.query(CMD_GET_SIM_VARIABLE, request);
uint8_t cmdLength; response >> cmdLength;
if (cmdLength == 0) {
uint32_t cmdLengthX;
response >> cmdLengthX;
}
uint8_t responseId; response >> responseId;
ASSERT(responseId == RESPONSE_GET_SIM_VARIABLE);
uint8_t variable; response >> variable;
ASSERT(variable == POSITION_CONVERSION);
std::string id; response >> id;
uint8_t convPosType; response >> convPosType;
ASSERT(convPosType == POSITION_LON_LAT_ALT);
double convPosLon; response >> convPosLon;
double convPosLat; response >> convPosLat;
double convPosAlt; response >> convPosAlt;
std::list<double> geo_coordinates;
std::list<double>::iterator it;
geo_coordinates.insert(it,0,convPosLon);
geo_coordinates.insert(it,1,convPosLat);
geo_coordinates.insert(it,2,convPosAlt);
return geo_coordinates;
}
但在调试模式下运行,它返回此错误:
线程 1“opp_run”收到信号 SIGSEGV,分段错误。0x00007ffff5ea5543 in std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*) () 来自 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 Python Exception 找不到 std::__cxx11::list >::const_iterator::_Node 类型:Python Exception 找不到 std::__cxx11::list >::const_iterator::_Node 类型:Python Exception 找不到 std::__cxx11 类型: :list >::const_iterator::_Node: