GPSDev Function Unrecognized- ESP32 and GT-U7
조회 수: 7 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2025년 1월 15일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Install Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!