ttnmapper / bugtracker

File all bugs and feature requests as issues on this repo please
0 stars 0 forks source link

Position is not showing #9

Closed afpastorio closed 4 years ago

afpastorio commented 4 years ago

I'm trying to use TTN to see how far can I get signal with an Arduino UNO + GPS shield + LoRa Module. The GPS works fine, and I'm transmiting payload as a string wich is decoded with the following function:

 function Decoder(bytes, port) { 
  var lon = '';
  var lat = '';
  var alt = '';
  var hdop = '';

  var tudo = String.fromCharCode.apply(null, bytes);

  lon = tudo.slice(0, tudo.indexOf('l'));
  lat = tudo.slice(tudo.indexOf('l')+1, tudo.indexOf('a'));
  alt = tudo.slice(tudo.indexOf('a')+1, tudo.indexOf('h'));
  hdop = tudo.slice(tudo.indexOf('h')+1, tudo.length-1);

  return {
    "latitude": parseFloat(lat),
    "longitude": parseFloat(lon),
    "altitude": parseFloat(alt),
    "hdop": parseFloat(hdop)
  };
}

The data appear just fine in the 'Data' tab in application, as well in other gps integrations as Tago.io.

I'm I doing something wrong? Why I can't see my data in ttnmapper?

jpmeijers commented 4 years ago

Hi @EdanPotter, you really should not be sending text over LoRa. It wastes a lot of precious airtime. I believe the TTN Fair Use Policy states this too.

Look at https://www.thethingsnetwork.org/docs/devices/bytes.html and there are some examples at https://github.com/ttnmapper/gps-node-examples

Please change this first, then we can figure out what else is wrong.

afpastorio commented 4 years ago

Thank's for the answer and sorry for the delay. I had some time today and made the changes as suggested. As it can take 24h to data to show on TTN mapper, I will be back tomorrow with an update.

jpmeijers commented 4 years ago

It's only the aggregated map layers that take some time to update. When you go to advanced maps and filter by device ID or gateway ID, it shows all the raw data. This should reflect the incoming data immediately.

afpastorio commented 4 years ago

So, the data still not showing. Here's my payload decoder, and it shows my location correctly.

function Decoder(bytes, port) {
  // Decode an uplink message from a buffer
  // (array) of bytes to an object of fields.
  var decoded = {};

  // if (port === 1) decoded.led = bytes[0];
  decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
  decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;

  decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
  decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;

  var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
  var sign = bytes[6] & (1 << 7);
  if(sign)
  {
    decoded.altitude = 0xFFFF0000 | altValue;
  }
  else
  {
    decoded.altitude = altValue;
  }

  decoded.hdop = bytes[8] / 10.0;

  return decoded;
}

The integration: Anotação 2019-12-11 091547

My device information: Anotação 2019-12-11 091920

jpmeijers commented 4 years ago

I see you are logging your data to an experiment. It will therefore not appear on the main map.

https://ttnmapper.org/experiments/map.php?experiment=gpshield

Looking at your data we see some points had incorrect coordinates, so those would have been filtered out if you logged to the main map. The rest of your points seem fine.

I noticed that there is a bug with the web interface that it will add both "on" and "off" parameters to the URL when you want to view the experiment map. For now you can use the URL linked above while I fix this issue.

afpastorio commented 4 years ago

Wow, cool.

Thank you very much, I really appreciate your help.