MikeS96 / autonomous_landing_uav

ROS packages of the Autonomous landing system of a UAV in Gazebo
MIT License
158 stars 54 forks source link

Building error: error: ‘struct sensor_gps_s’ has no member named ‘latitude_deg’ #25

Open Comor543 opened 1 month ago

Comor543 commented 1 month ago

Hello @MikeS96 and everyone. Would you mind helpping me, please? I was trying to build the Autonomous landing of a UAV on Ubuntu 20.04, which encountered below error. I went through Installation and environment configuration and everything was fine. However, when I executed make px4_sitl gazebo in PX4-Autopilot directory, building was stopped by this error.

[1/500] Building CXX object src/driver...drivers__gps.dir/devices/src/ubx.cpp.o
FAILED: src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ubx.cpp.o 
/usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gps\" -DPX4_MAIN=gps_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -Wno-stringop-overflow -D__KERNEL__ -std=gnu++14 -MD -MT src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ubx.cpp.o -MF src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ubx.cpp.o.d -o src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ubx.cpp.o -c ../../src/drivers/gps/devices/src/ubx.cpp
../../src/drivers/gps/devices/src/ubx.cpp: In member function ‘int GPSDriverUBX::payloadRxDone()’:
../../src/drivers/gps/devices/src/ubx.cpp:1976:19: error: ‘struct sensor_gps_s’ has no member named ‘latitude_deg’
 1976 |    _gps_position->latitude_deg  = _buf.payload_rx_nav_pvt.lat * 1e-7;
      |                   ^~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[2/500] Building CXX object src/driver...drivers__gps.dir/devices/src/mtk.cpp.o
FAILED: src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/mtk.cpp.o 
/usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gps\" -DPX4_MAIN=gps_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -Wno-stringop-overflow -D__KERNEL__ -std=gnu++14 -MD -MT src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/mtk.cpp.o -MF src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/mtk.cpp.o.d -o src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/mtk.cpp.o -c ../../src/drivers/gps/devices/src/mtk.cpp
../../src/drivers/gps/devices/src/mtk.cpp: In member function ‘void GPSDriverMTK::handleMessage(gps_mtk_packet_t&)’:
../../src/drivers/gps/devices/src/mtk.cpp:220:18: error: ‘struct sensor_gps_s’ has no member named ‘latitude_deg’
  220 |   _gps_position->latitude_deg = packet.latitude / 1e6;   // from degrees*1e6 to degrees
      |                  ^~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[3/500] Building CXX object src/driver...ers__gps.dir/devices/src/ashtech.cpp.o
FAILED: src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ashtech.cpp.o 
/usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gps\" -DPX4_MAIN=gps_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -Wno-stringop-overflow -D__KERNEL__ -std=gnu++14 -MD -MT src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ashtech.cpp.o -MF src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ashtech.cpp.o.d -o src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/ashtech.cpp.o -c ../../src/drivers/gps/devices/src/ashtech.cpp
../../src/drivers/gps/devices/src/ashtech.cpp: In member function ‘int GPSDriverAshtech::handleMessage(int)’:
../../src/drivers/gps/devices/src/ashtech.cpp:243:18: error: ‘struct sensor_gps_s’ has no member named ‘latitude_deg’
  243 |   _gps_position->latitude_deg = static_cast<int>(lat * 0.01) + (lat * 0.01 - static_cast<int>(lat * 0.01)) * 100.0 / 60.0;
      |                  ^~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[4/500] Building CXX object src/driver..._gps.dir/devices/src/emlid_reach.cpp.o
FAILED: src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/emlid_reach.cpp.o 
/usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gps\" -DPX4_MAIN=gps_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -Wno-stringop-overflow -D__KERNEL__ -std=gnu++14 -MD -MT src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/emlid_reach.cpp.o -MF src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/emlid_reach.cpp.o.d -o src/drivers/gps/CMakeFiles/drivers__gps.dir/devices/src/emlid_reach.cpp.o -c ../../src/drivers/gps/devices/src/emlid_reach.cpp
../../src/drivers/gps/devices/src/emlid_reach.cpp: In member function ‘int GPSDriverEmlidReach::handleErbSentence()’:
../../src/drivers/gps/devices/src/emlid_reach.cpp:288:18: error: ‘struct sensor_gps_s’ has no member named ‘longitude_deg’
  288 |   _gps_position->longitude_deg = _erb_buff.payload.geodic_position.longitude;
      |                  ^~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
[6/500] Building CXX object src/driver.../CMakeFiles/drivers__gps.dir/gps.cpp.o
FAILED: src/drivers/gps/CMakeFiles/drivers__gps.dir/gps.cpp.o 
/usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"gps\" -DPX4_MAIN=gps_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -Wno-stringop-overflow -D__KERNEL__ -std=gnu++14 -MD -MT src/drivers/gps/CMakeFiles/drivers__gps.dir/gps.cpp.o -MF src/drivers/gps/CMakeFiles/drivers__gps.dir/gps.cpp.o.d -o src/drivers/gps/CMakeFiles/drivers__gps.dir/gps.cpp.o -c ../../src/drivers/gps/gps.cpp
../../src/drivers/gps/gps.cpp: In member function ‘virtual void GPS::run()’:
../../src/drivers/gps/gps.cpp:827:52: error: no matching function for call to ‘GPSDriverUBX::GPSDriverUBX(GPSHelper::Interface&, int (*)(GPSCallbackType, void*, int, void*), GPS*, sensor_gps_s*, satellite_info_s*&, int32_t&, float&, GPSDriverUBX::UBXMode&)’
  827 |          gps_ubx_dynmodel, heading_offset, ubx_mode);
      |                                                    ^
compilation terminated due to -Wfatal-errors.
ninja: build stopped: subcommand failed.
make: *** [Makefile:235: px4_sitl] Error 1

I think these 3 are the errors

  1. error: ‘struct sensor_gps_s’ has no member named ‘latitude_deg’
  2. error: ‘struct sensor_gps_s’ has no member named ‘longitude_deg’
  3. error: no matching function for call to ‘GPSDriverUBX::GPSDriverUBX(GPSHelper::Interface&, int (*)(GPSCallbackType, void*, int, void*), GPS*, sensor_gps_s*, satellite_info_s*&, int32_t&, float&, GPSDriverUBX::UBXMode&)’

Best Regards,

MikeS96 commented 2 weeks ago

Hi @Comor543, this is very likely and installation issue. Potentially you did not checkout the right commit when installing the PX4 SITL. I'd recommend try carefully the installation again and making extra sure you run:

git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot
git checkout cab477d71550558756509ad3a6ffcbebbbbf82b1
Comor543 commented 1 week ago

Thank you @MikeS96