Extracting values from $GPRMC string

118 views
Skip to first unread message

Rohit Radhakrishnan

unread,
Dec 10, 2019, 12:50:29 AM12/10/19
to mitappinv...@googlegroups.com
First of all, thank you in advance for the help.

I have to extract the Track angle in degrees from $GPRMC string and paste the result (updating every second) to a label without decimal point.

Hereby attached is the block for $GPRMC string using AdvancedLocationSensor.

How can we extract various values from $GPRMC string?

EDIT: The tracking angle should be taken w.r.t how device moves along with a vehicle it is placed and not the actual movement/twisting of the device inside the vehicle.

Kindly help.

Regards,
Rohit.
$GPRMC block.png

Chris Ward

unread,
Dec 10, 2019, 7:17:03 AM12/10/19
to MIT App Inventor Forum
Hello Rohit

You are asking a lot of the device to update a Label every second. Assuming that worked, what would be the point? You won't find a human being on this planet that could read the label that fast, or even bear looking at it for more than a few seconds!

In order to help you to extract a value from a string, we need to see the string.

SteveJG

unread,
Dec 10, 2019, 8:28:02 AM12/10/19
to mitappinv...@googlegroups.com
Chris is correct, the LocationSensor cannot provide a new satellite each second.  Your GPS receiver does NOT receive a  $GPRMC from the satellite every second and only provides a satellite fix about once (if you are lucky) every 20 to 30 seconds (i.e. responds to a LocationChanged event).   You would do well to review the example Blocks Niclas provided with the AdvancedLocationSensor.

How to parse a $GPRMC string is discussed in one of your previous Forum topics... https://groups.google.com/forum/#!msg/mitappinventortest/ivLItSb1lIU/vjXgb3mqAQAJ   See the Nov 28th post.


RMC - NMEA has its own version of essential gps pvt (position, velocity, time) data. It is called RMC, The Recommended Minimum, which will look similar to:

$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A

Where:
     RMC          Recommended Minimum sentence C
     123519       Fix taken at 12:35:19 UTC
     A            Status A=active or V=Void.
     4807.038,N   Latitude 48 deg 07.038' N
     01131.000,E  Longitude 11 deg 31.000' E
     022.4        Speed over the ground in knots
     084.4        Track angle in degrees True
     230394       Date - 23rd of March 1994
     003.1,W      Magnetic Variation
     *6A          The checksum data, always begins with *

Regards,
Steve

Rohit Radhakrishnan

unread,
Jan 13, 2020, 12:08:07 AM1/13/20
to MIT App Inventor Forum
Thank you Chris and Steve for the responses.

My app is supposed to send a string of data -- which consists of a vehicle id, latitude, longitude, date, time, TRACK ANGLE and the checksum of the string.

As both of you pointed out, the value of track angle which can be parsed from $GPRMC is possible only once in every specific amount of time. 

What I need to do is get the timely values of track angle i.e. value of track angle at every second and paste it to the string.

Kindly help.

SteveJG

unread,
Jan 13, 2020, 8:47:22 AM1/13/20
to MIT App Inventor Forum
Impossible every second.  

Sadly you still do not understand how the geo-positional satellites work.  Using the Location Sensor  The GPS listens for transmissions of  $GPRMC NEMA strings to capture the track angle.  No one can predict when the $GPRMC string  will arrive nor ensure that any single $GPRMC string received will be complete when received.  If a string is 'incomplete', the string is ignored when determining a satellite fix; when three fixes are achieved, the data is used to indicate a satellite fix.   A possible way to use complete $GPRMC strings as they arrive at the GPS receiver is to use the AdvancedLocationSensor to trap the $GPRMC strings as they are arrived at the GPS receiver (for example, filter the data stream of NEMA sentences and only use the appropriate sentences).  When you filter, you will NEVER probably find valid $GPRMC strings as frequently as every second.  You expectations are unrealistic.

You are attempting to build a commercial app with a compiler designed for educational purposes.  Normally, I would recommend you use Android Studio instead (that has advanced libraries to interpret NEMA strings).  In this case, I do not believe it is possible to "get the timely values of track angle i.e. value of track angle at every second and paste it to the string.

Do you know what the trak angle is and what you can do with it?   The track angle is the direction that the vehicle is moving in, as opposed to the direction it is pointing in. The track angle is also derived from velocity and is the same angle that GPS puts out. In all actuality, the track angle has little to no relationship with the direction the vehicle is pointing in. 

This Forum is going to close in a few days.   Please join AI2 developers in its new Forum   https://community.appinventor.mit.edu/  


-- Steve
Reply all
Reply to author
Forward
0 new messages