GPSDev Function Unrecognized- ESP32 and GT-U7
7 views (last 30 days)
Show older comments
When I run the first two code segments I get NaN/NaT or just no output but no error and when I the last two I get the error "Unrecognized function or variable 'gpsdev'. I have tested the set up using the arduinoIDE and I get proper GPS output through that. I have also checked the baud rate, the communication between the esp32 and computer and that there is proper physical connection. Do you know why I am getting this error/no output? What is the best method to trouble shoot these errors? Any tips would be greatly appreciated. Thank you.
Update: Using code 3 I reinstalled the Navigation toolbox and am now getting this error:
"Error using IMUReadings
Obtaining the required NMEA sentences (RMC, GGA and GSA) is taking longer than expected. Verify the physical connection of the GPS
device to the specified serial port and the configuration of the GPS device."
1.
a = arduino('COM3','ESP32-WROOM-DevKitC','Libraries','Serial')
gps = gpsdev(a)
gpsData = gps.read;
latitude = gpsData.LLA(1);
longitude = gpsData.LLA(2);
gpsTime = gpsData.GPSReceiverTime;
% GPS returns UTC datetime. Convert it into system time zone.
gpsTime.TimeZone = 'local';
if(~isnan(latitude) && ~isnan(longitude))
% plot the position in geographic coordinates
fig = geoplot(latitude,longitude,'Marker',"o",'MarkerSize',6,'Color','red','MarkerFaceColor','red');
% Sets the latitude and longitude limits of the base Map
geolimits([latitude-0.05,latitude+0.05],[longitude-0.05,longitude+0.05]) ;
% Selects the basemap
geobasemap streets;
timeString = strcat("Timestamp: ",string(gpsTime));
2.
a = arduino('COM3','ESP32-WROOM-DevKitC','Libraries','Serial')
gps = gpsdev(a)
[tt,overruns] = read(gps)
3.
gps = gpsdev('COM3','OutputFormat',"timetable")
[tt,overruns] = read(gps)
release(gps)
gps.SamplesPerRead = 2;
read(gps)
4.
s = serialport('COM3', 9600)
gps = gpsdev(s,'OutputFormat',"matrix")
[lla,speed,course,dops,gpsReceiverTime,timestamp,overruns] = read(gps)
%delete(gps);
%clear gps;
%clear a;
*These codes are adapted from MATWORKS references either by staff or other users
2 Comments
Walter Roberson
on 15 Jan 2025
gpsdev() passed a port name or serialport() object requires the Navigation Toolbox R2020b or later.
gpsdev() passed an arduino object requires the MATLAB Support Package for Arduino, R2020b or later.
Answers (0)
See Also
Categories
Find more on Install Products in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!