0

I am a masters student working on localization, using ranging (time of arrival between vehicle and RSU) and relative location (Using emulated Inertial Navigation System).

I have done an implementation of my kalman filter based localization logic on Matlab, now I would like to implement this on veins. I want only the RSU to send out a message comprising of its location and ID

1) I know that i can use double Coord = mobility->getCurrentPosition().x; double Coord = mobility->getCurrentPosition().y; to the location of RSU(and my vehicle as well), I do not understand how I should assign these coordinates to the message. I cannot use sstream since I understand that the message are supposed to be of type const char *

Thanks for any input

Edit 1: So this is what my new code on RSU looks like:

#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);

}

But I realize that all that being done now is my RSU constantly sending a generic BSM, Why is this so?

  • I suggest you have a look at this answer and go through the recommended links: https://stackoverflow.com/questions/46609196/building-my-own-veins-scenario/46647841#46647841 – Julian Heinovski Sep 10 '18 at 07:50
  • Thanks for pointing in the right direction! This is how I now asssign x and y coordinates of the RSU to the wsm: `std::stringstream ss; ss<getCurrentPosition().x<getCurrentPosition().y; wsm->setWsmData(ss.str().c_str());` Any suggestion on how I can re-create the two coordinates of type `double` once recieved? – prithvi shenoy Sep 11 '18 at 10:30

0 Answers0