View unanswered posts | View active topics It is currently Wed Oct 22, 2014 5:42 pm






Reply to topic  [ 10 posts ] 
Does anyone know where to find... 
Author Message
Rookie

Joined: Sun Feb 24, 2013 8:35 pm
Posts: 5
Post Does anyone know where to find...
...a driver for the Dexter GPS sensor. The canned version fails without, well, failure.

Thanks!


Sun Feb 24, 2013 8:39 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Does anyone know where to find...
Did you try the dexterind-gps-test1.c and associated driver from the driver suite? You can download it from the link in my signature.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 25, 2013 12:37 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 8:35 pm
Posts: 5
Post Re: Does anyone know where to find...
Yes, I've tried everything. It appears the byte order from the sensor responses is incorrect. The sample program, which should display distance and heading info when started, always show a heading of 68, and a distance of -9800

* $Id: dexterind-gps-test1.c 123 2012-11-02 16:35:15Z xander $
*/

/**
* dexterind-gps.h provides an API for the Dexter Industries GPS Sensor. This program
* demonstrates how to use that API.
*
* Changelog:
* - 0.1: Initial release
* - 0.2: Removed common.h from includes
*
* Credits:
* - Big thanks to Dexter Industries for providing me with the hardware necessary to write and test this.
*
* License: You may use this code as you wish, provided you give credit where it's due.
*
* THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.54 AND HIGHER.
* Xander Soldaat (xander_at_botbench.com)
* 20 February 2011
* version 0.2
*/

#include "C:\Program Files\Robomatter Inc\ROBOTC Development Environment\Sample Programs\NXT\3rd Party Sensor Drivers\drivers\dexterind-gps.h"
//#include "DGPS.h"

task main () {

long longitude = 0;
long latitude = 0;
long utc = 0;
bool linkstatus = false;

nxtDisplayCenteredTextLine(0, "Dexter Ind.");
nxtDisplayCenteredBigTextLine(1, "GPS");
nxtDisplayCenteredTextLine(3, "Test 1");
nxtDisplayCenteredTextLine(5, "Connect sensor");
nxtDisplayCenteredTextLine(6, "to S1");
wait1Msec(2000);
eraseDisplay();
longitude = DGPSreadLongitude(DGPS);
latitude = DGPSreadLatitude(DGPS);
bool temp=false;
temp = DGPSsetDestination(DGPS,longitude,latitude);

while (true) {
// Read the sensor's data
utc = DGPSreadUTC(DGPS);

linkstatus = DGPSreadStatus(DGPS);
int dist=DGPSreadDistToDestination(DGPS);
int dir=DGPSreadRelHeading(DGPS);


nxtDisplayCenteredTextLine(0, "DGPS Test 1");
nxtDrawLine(0, 52, 99, 52);
nxtDisplayTextLine(2, "UTC: %d", utc);
nxtDisplayTextLine(3, "Dist: %d", dist);
nxtDisplayTextLine(4, "Dir: %d", dir);
if (linkstatus)
nxtDisplayTextLine(7, "Link Stat: [UP]");
else
nxtDisplayTextLine(7, "Link Stat: [DOWN]");
nxtDrawLine(0, 20, 99, 20);
wait1Msec(500);
}
}

/*
* $Id: dexterind-gps-test1.c 123 2012-11-02 16:35:15Z xander $
*/


Mon Feb 25, 2013 2:22 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Does anyone know where to find...
Are you using ROBOTC 3.55B2 or something else?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 25, 2013 4:59 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 8:35 pm
Posts: 5
Post Re: Does anyone know where to find...
3.54......


Mon Feb 25, 2013 10:24 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Does anyone know where to find...
You need to use 3.55B2, as stated on the driver page: http://botbench.com/blog/robotc-driver-suite/

There are ubyte to int conversion issues with 3.54, the kind you're seeing. I would advise you to upgrade. You can pick up your copy here: viewtopic.php?f=52&t=5122

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 25, 2013 10:50 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 8:35 pm
Posts: 5
Post Re: Does anyone know where to find...
Hi Zander,
Tried the upgrade, same result. Tried the NXC driver port, similar result. The time, lat and log are fine but the relative heading and distance to waypoint functions don't work. Or, apparently the house across the street is 13,000,000 miles due north. Too bad there is no technical documentation on the Dexter website I.e. register numbers for reference. Is something a byte off?

In any event, the NXT-G block works fine. Is there an issue with the SetDestinaion function?. The fact that the NXT-G block works let's me know the unit is fine, but also makes me want to chuck it in the trash compactor!

Best,
Greg

P.S. sorry about the late response, life got in the way :-)


Fri Mar 08, 2013 12:54 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Does anyone know where to find...
Hey Greg,

Do you think you could mail me the NXT-G program that you know is working correctly? I will run the thing through my protocol analyser and see where my driver is going wrong. The email address to send it to can be found in all of the drivers :)

Also, mail me the ROBOTC program you're using to try and do the same thing.

Thanks,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Mar 08, 2013 2:07 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 8:35 pm
Posts: 5
Post Re: Does anyone know where to find...
Zander,
I'll dig that stuff up......

Meanwhile, the program below works!

Debugging was painful, turns out the degress to radian function doesn't work reliably..



====================================================

Code:
#pragma config(Sensor, S4,     DGPS,           sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "C:\Program Files\Robomatter Inc\ROBOTC Development Environment\Sample Programs\NXT\3rd Party Sensor Drivers\drivers\dexterind-gps.h"

float Lat;
float Lon;
float TarLat;
float TarLon;
float lat1;
float lat2;
float lon1;
float lon2;
float dlon;
float dlat;
const int R=6371;
float x;
float y;
float a;
float c;
float heading;
float distance;
long utc;
const float div = 1000000;

void CalcHeadingAndDistance()
{
   //Set up the trig stuff
   lat1=Lat*PI/180;
   lat2=TarLat*PI/180;
   lon1=Lon*PI/180;
   lon2=TarLon*PI/180;
   dlon=lon2-lon1;
   dlat=lat2-lat1;


   //Haversince distance calc
   a = sin(dlat/2) * sin(dlat/2) +sin(dlon/2) * sin(dlon/2) * cos(lat1) * cos(lat2);
   c = 2 * atan2(sqrt(a), sqrt(1-a));
   distance=c*R*1000;

   //Heading Calc
   y = sin(dlon) * cos(lat2);
   x = cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(dlon);
   float temp=atan2(y,x);
   heading=radiansToDegrees(temp);
   if (heading<0)heading=heading+360;

}

task main()
{
   while(nNxtButtonPressed==-1)
   {
   }

   TarLon = DGPSreadLongitude(DGPS)/div;
   TarLat = DGPSreadLatitude(DGPS)/div;

   PlaySound(soundBeepBeep);
   while(true)
   {
      Lon = DGPSreadLongitude(DGPS)/div;
      Lat = DGPSreadLatitude(DGPS)/div;
      utc = DGPSreadUTC(DGPS);
      CalcHeadingAndDistance();
      nxtDisplayTextLine(2, "UTC: %d", utc);
      nxtDisplayTextLine(3, "Head: %f", heading);
      nxtDisplayTextLine(4, "Dist: %f", distance);
      nxtDisplayTextLine(5, "Lat: %f", Lat);
      nxtDisplayTextLine(6, "Lon: %f", Lon);
      wait1Msec(500);
   }

}


Sat Mar 09, 2013 1:41 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3225
Location: Rotterdam, The Netherlands
Post Re: Does anyone know where to find...
I just noticed you are using the full path to the include file. Please consider using relative paths by following the instructions here: http://botbench.com/blog/robotc-driver- ... ver-suite/

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Mar 09, 2013 5:23 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.