title: Instant Veins 4.7-i1 Localization Time of Arrival
body: <p>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).</p>
  
  <p>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</p>
  
  <p>1) I know that i can use 
  <code>double Coord = mobility-&gt;getCurrentPosition().x;
  double Coord = mobility-&gt;getCurrentPosition().y;</code>
  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 <code>sstream</code> since I understand that the message are supposed to be of type <code>const char *</code> </p>
  
  <p>Thanks for any input</p>
  
  <p><strong>Edit 1:</strong> So this is what my new code on RSU looks like:</p>
  
  <pre><code>#include "RsuScOne.h"
  #include &lt;sstream&gt;
  
  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 &lt;&lt; "Initializing " &lt;&lt; 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&lt;&lt;mobility-&gt;getCurrentPosition().x&lt;&lt;mobility-&gt;getCurrentPosition().y;
      wsm-&gt;setWsmData(ss.str().c_str());
      scheduleAt(simTime()+par("beaconInterval").doubleValue(), sendWSAEvt);
      EV&lt;&lt;wsm;
  }
  
  void RsuScOne::handleSelfMsg(cMessage* msg) {
      BaseWaveApplLayer::handleSelfMsg(msg);
  
  }
  </code></pre>
  
  <p>But I realize that all that being done now is my RSU constantly sending a generic BSM, Why is this so? </p>