Instant Veins 4.7-i1本地化到达时间

时间:2018-09-09 13:58:20

标签: omnet++ veins sumo

我是一名研究定位的硕士生,使用测距(车辆与RSU之间的到达时间)和相对位置(使用模拟惯性导航系统)进行

我已经在Matlab上实现了基于卡尔曼滤波器的定位逻辑的实现,现在我想在静脉上实现它。我只希望RSU发送包含其位置和ID的消息

1)我知道我可以使用 double Coord = mobility->getCurrentPosition().x; double Coord = mobility->getCurrentPosition().y; 到RSU(以及我的车辆)的位置,我不知道如何将这些坐标分配给消息。我不能使用sstream,因为我知道该消息应为const char *

感谢您的任何输入

编辑1:因此,这就是我在RSU上的新代码:

#include "RsuScOne.h"
#include <sstream>

Define_Module(RsuScOne);

void RsuScOne::initialize(int stage) {
    BaseWaveApplLayer::initialize(stage);
    if (stage == 0) {
        //Initializing members and pointers of your application goes here
        //WaveShortMessage* wsm = new WaveShortMessage();
        EV << "Initializing " << std::endl;
    }
    else if (stage == 1) {
        //Initializing members that require initialized other modules goes here

    }
}

void RsuScOne::finish() {
    BaseWaveApplLayer::finish();
    //statistics recording goes here
    cancelEvent(sendWSAEvt);
}

void RsuScOne::onWSM(WaveShortMessage* wsm) {
    //Your application has received a data message from another car or RSU
    //code for handling the message goes here, see TraciDemo11p.cc for examples

    populateWSM(wsm);
    std::stringstream ss;
    ss<<mobility->getCurrentPosition().x<<mobility->getCurrentPosition().y;
    wsm->setWsmData(ss.str().c_str());
    scheduleAt(simTime()+par("beaconInterval").doubleValue(), sendWSAEvt);
    EV<<wsm;
}

void RsuScOne::handleSelfMsg(cMessage* msg) {
    BaseWaveApplLayer::handleSelfMsg(msg);

}

但是我意识到现在要做的就是我的RSU不断发送通用的BSM,为什么会这样呢?

0 个答案:

没有答案