diff --git a/boards/aerotenna/ocpoc/default.cmake b/boards/aerotenna/ocpoc/default.cmake index 834c519475..0a8ec6719d 100644 --- a/boards/aerotenna/ocpoc/default.cmake +++ b/boards/aerotenna/ocpoc/default.cmake @@ -87,6 +87,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/airmind/mindpx-v2/default.cmake b/boards/airmind/mindpx-v2/default.cmake index 77b8d1fd8f..7fab0bc386 100644 --- a/boards/airmind/mindpx-v2/default.cmake +++ b/boards/airmind/mindpx-v2/default.cmake @@ -110,6 +110,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/atlflight/eagle/default.cmake b/boards/atlflight/eagle/default.cmake index 95f3c84f1b..6b8d4ff453 100644 --- a/boards/atlflight/eagle/default.cmake +++ b/boards/atlflight/eagle/default.cmake @@ -114,6 +114,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/atlflight/excelsior/default.cmake b/boards/atlflight/excelsior/default.cmake index 1a2bcf2a81..25dbf2f533 100644 --- a/boards/atlflight/excelsior/default.cmake +++ b/boards/atlflight/excelsior/default.cmake @@ -112,6 +112,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/av/x-v1/default.cmake b/boards/av/x-v1/default.cmake index 9ffe268013..717d7e7964 100644 --- a/boards/av/x-v1/default.cmake +++ b/boards/av/x-v1/default.cmake @@ -106,6 +106,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/beaglebone/blue/default.cmake b/boards/beaglebone/blue/default.cmake index 546fe5ca38..cdcd011127 100644 --- a/boards/beaglebone/blue/default.cmake +++ b/boards/beaglebone/blue/default.cmake @@ -83,6 +83,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/cuav/nora/default.cmake b/boards/cuav/nora/default.cmake index e32f58844a..585b2fba9e 100644 --- a/boards/cuav/nora/default.cmake +++ b/boards/cuav/nora/default.cmake @@ -114,6 +114,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/cuav/x7pro/default.cmake b/boards/cuav/x7pro/default.cmake index 82abc1c1cf..a16f4e8e28 100644 --- a/boards/cuav/x7pro/default.cmake +++ b/boards/cuav/x7pro/default.cmake @@ -117,6 +117,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/cubepilot/cubeorange/console.cmake b/boards/cubepilot/cubeorange/console.cmake index fc66e0ec84..baddd1a3b9 100644 --- a/boards/cubepilot/cubeorange/console.cmake +++ b/boards/cubepilot/cubeorange/console.cmake @@ -118,6 +118,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/cubepilot/cubeorange/default.cmake b/boards/cubepilot/cubeorange/default.cmake index 49c4437920..2c7f66b911 100644 --- a/boards/cubepilot/cubeorange/default.cmake +++ b/boards/cubepilot/cubeorange/default.cmake @@ -118,6 +118,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/cubepilot/cubeyellow/console.cmake b/boards/cubepilot/cubeyellow/console.cmake index d0c4c2595c..8437416762 100644 --- a/boards/cubepilot/cubeyellow/console.cmake +++ b/boards/cubepilot/cubeyellow/console.cmake @@ -117,6 +117,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/cubepilot/cubeyellow/default.cmake b/boards/cubepilot/cubeyellow/default.cmake index 04f688ce3c..bae4a05b0c 100644 --- a/boards/cubepilot/cubeyellow/default.cmake +++ b/boards/cubepilot/cubeyellow/default.cmake @@ -117,6 +117,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/emlid/navio2/default.cmake b/boards/emlid/navio2/default.cmake index 0c826cd41f..ee0d6c30a4 100644 --- a/boards/emlid/navio2/default.cmake +++ b/boards/emlid/navio2/default.cmake @@ -84,6 +84,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/holybro/durandal-v1/default.cmake b/boards/holybro/durandal-v1/default.cmake index 561e262dc7..eba0412b43 100644 --- a/boards/holybro/durandal-v1/default.cmake +++ b/boards/holybro/durandal-v1/default.cmake @@ -115,6 +115,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/holybro/pix32v5/default.cmake b/boards/holybro/pix32v5/default.cmake index a82a6236e4..625c6cc5e4 100644 --- a/boards/holybro/pix32v5/default.cmake +++ b/boards/holybro/pix32v5/default.cmake @@ -122,6 +122,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/intel/aerofc-v1/default.cmake b/boards/intel/aerofc-v1/default.cmake index 9d2b306169..86fb32f8bf 100644 --- a/boards/intel/aerofc-v1/default.cmake +++ b/boards/intel/aerofc-v1/default.cmake @@ -92,6 +92,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/intel/aerofc-v1/rtps.cmake b/boards/intel/aerofc-v1/rtps.cmake index c81745792a..9782fb5fb7 100644 --- a/boards/intel/aerofc-v1/rtps.cmake +++ b/boards/intel/aerofc-v1/rtps.cmake @@ -91,6 +91,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/modalai/fc-v1/default.cmake b/boards/modalai/fc-v1/default.cmake index 486fc14e5f..1cba5226b5 100644 --- a/boards/modalai/fc-v1/default.cmake +++ b/boards/modalai/fc-v1/default.cmake @@ -109,6 +109,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/mro/ctrl-zero-f7-oem/default.cmake b/boards/mro/ctrl-zero-f7-oem/default.cmake index d28c3aa004..99c9a8bc59 100644 --- a/boards/mro/ctrl-zero-f7-oem/default.cmake +++ b/boards/mro/ctrl-zero-f7-oem/default.cmake @@ -114,6 +114,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/mro/ctrl-zero-f7/default.cmake b/boards/mro/ctrl-zero-f7/default.cmake index 03111bcc84..cae28037a6 100644 --- a/boards/mro/ctrl-zero-f7/default.cmake +++ b/boards/mro/ctrl-zero-f7/default.cmake @@ -114,6 +114,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/mro/pixracerpro/default.cmake b/boards/mro/pixracerpro/default.cmake index cf9322f170..f65c1b6c82 100644 --- a/boards/mro/pixracerpro/default.cmake +++ b/boards/mro/pixracerpro/default.cmake @@ -115,6 +115,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/mro/x21-777/default.cmake b/boards/mro/x21-777/default.cmake index 92f0dea1b7..b375d33cf0 100644 --- a/boards/mro/x21-777/default.cmake +++ b/boards/mro/x21-777/default.cmake @@ -116,6 +116,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/mro/x21/default.cmake b/boards/mro/x21/default.cmake index f01a17d0fb..3206bc224d 100644 --- a/boards/mro/x21/default.cmake +++ b/boards/mro/x21/default.cmake @@ -112,6 +112,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/nxp/fmuk66-e/default.cmake b/boards/nxp/fmuk66-e/default.cmake index ba4d6ad325..4f0a2faf86 100644 --- a/boards/nxp/fmuk66-e/default.cmake +++ b/boards/nxp/fmuk66-e/default.cmake @@ -111,6 +111,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/nxp/fmuk66-e/socketcan.cmake b/boards/nxp/fmuk66-e/socketcan.cmake index a982d2afcb..5c8758adfb 100644 --- a/boards/nxp/fmuk66-e/socketcan.cmake +++ b/boards/nxp/fmuk66-e/socketcan.cmake @@ -110,6 +110,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/nxp/fmuk66-v3/default.cmake b/boards/nxp/fmuk66-v3/default.cmake index f276f19de6..3c5ab8ad67 100644 --- a/boards/nxp/fmuk66-v3/default.cmake +++ b/boards/nxp/fmuk66-v3/default.cmake @@ -111,6 +111,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/nxp/fmuk66-v3/rtps.cmake b/boards/nxp/fmuk66-v3/rtps.cmake index 996298b584..47dd4d9b4b 100644 --- a/boards/nxp/fmuk66-v3/rtps.cmake +++ b/boards/nxp/fmuk66-v3/rtps.cmake @@ -111,6 +111,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/nxp/fmuk66-v3/socketcan.cmake b/boards/nxp/fmuk66-v3/socketcan.cmake index 502210b9ce..396da8efe8 100644 --- a/boards/nxp/fmuk66-v3/socketcan.cmake +++ b/boards/nxp/fmuk66-v3/socketcan.cmake @@ -110,6 +110,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/omnibus/f4sd/default.cmake b/boards/omnibus/f4sd/default.cmake index 31ab03cc8c..a5a98cfb36 100644 --- a/boards/omnibus/f4sd/default.cmake +++ b/boards/omnibus/f4sd/default.cmake @@ -98,6 +98,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v2/default.cmake b/boards/px4/fmu-v2/default.cmake index 5c9d1df658..82fbc75c50 100644 --- a/boards/px4/fmu-v2/default.cmake +++ b/boards/px4/fmu-v2/default.cmake @@ -128,6 +128,7 @@ px4_add_board( #ver #work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v2/lpe.cmake b/boards/px4/fmu-v2/lpe.cmake index 917b734f52..d5498e9650 100644 --- a/boards/px4/fmu-v2/lpe.cmake +++ b/boards/px4/fmu-v2/lpe.cmake @@ -113,6 +113,7 @@ px4_add_board( work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v2/rover.cmake b/boards/px4/fmu-v2/rover.cmake index e613375f87..1955913e26 100644 --- a/boards/px4/fmu-v2/rover.cmake +++ b/boards/px4/fmu-v2/rover.cmake @@ -79,5 +79,4 @@ px4_add_board( usb_connected ver work_queue - ) diff --git a/boards/px4/fmu-v2/test.cmake b/boards/px4/fmu-v2/test.cmake index 5d24b4e629..78c1430cbc 100644 --- a/boards/px4/fmu-v2/test.cmake +++ b/boards/px4/fmu-v2/test.cmake @@ -121,6 +121,7 @@ px4_add_board( ver #work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v3/ctrlalloc.cmake b/boards/px4/fmu-v3/ctrlalloc.cmake index 7c28b349b6..feaa3903e4 100644 --- a/boards/px4/fmu-v3/ctrlalloc.cmake +++ b/boards/px4/fmu-v3/ctrlalloc.cmake @@ -127,6 +127,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v3/default.cmake b/boards/px4/fmu-v3/default.cmake index 6880620067..ab565a9bce 100644 --- a/boards/px4/fmu-v3/default.cmake +++ b/boards/px4/fmu-v3/default.cmake @@ -125,6 +125,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v3/rtps.cmake b/boards/px4/fmu-v3/rtps.cmake index be9068ff2f..946cf15388 100644 --- a/boards/px4/fmu-v3/rtps.cmake +++ b/boards/px4/fmu-v3/rtps.cmake @@ -121,6 +121,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v3/stackcheck.cmake b/boards/px4/fmu-v3/stackcheck.cmake index e9eaf3ab0e..4349737b05 100644 --- a/boards/px4/fmu-v3/stackcheck.cmake +++ b/boards/px4/fmu-v3/stackcheck.cmake @@ -117,6 +117,7 @@ px4_add_board( work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v4/ctrlalloc.cmake b/boards/px4/fmu-v4/ctrlalloc.cmake index 697956fbb8..6b6f4f9aa9 100644 --- a/boards/px4/fmu-v4/ctrlalloc.cmake +++ b/boards/px4/fmu-v4/ctrlalloc.cmake @@ -124,6 +124,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_gyro fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control diff --git a/boards/px4/fmu-v4/default.cmake b/boards/px4/fmu-v4/default.cmake index 93e46a62ef..d8f30be794 100644 --- a/boards/px4/fmu-v4/default.cmake +++ b/boards/px4/fmu-v4/default.cmake @@ -123,6 +123,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_gyro fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control diff --git a/boards/px4/fmu-v4/rtps.cmake b/boards/px4/fmu-v4/rtps.cmake index 6075ce88bd..912dd08858 100644 --- a/boards/px4/fmu-v4/rtps.cmake +++ b/boards/px4/fmu-v4/rtps.cmake @@ -117,6 +117,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v4/stackcheck.cmake b/boards/px4/fmu-v4/stackcheck.cmake index 970e77528b..e293d89a5f 100644 --- a/boards/px4/fmu-v4/stackcheck.cmake +++ b/boards/px4/fmu-v4/stackcheck.cmake @@ -116,6 +116,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello #hwtest # Hardware test diff --git a/boards/px4/fmu-v4pro/default.cmake b/boards/px4/fmu-v4pro/default.cmake index 4016bd5670..cbb50d0808 100644 --- a/boards/px4/fmu-v4pro/default.cmake +++ b/boards/px4/fmu-v4pro/default.cmake @@ -119,6 +119,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v4pro/rtps.cmake b/boards/px4/fmu-v4pro/rtps.cmake index 5539cd4546..ae96e40996 100644 --- a/boards/px4/fmu-v4pro/rtps.cmake +++ b/boards/px4/fmu-v4pro/rtps.cmake @@ -116,6 +116,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v5/critmonitor.cmake b/boards/px4/fmu-v5/critmonitor.cmake index 7932969f70..718251481b 100644 --- a/boards/px4/fmu-v5/critmonitor.cmake +++ b/boards/px4/fmu-v5/critmonitor.cmake @@ -118,6 +118,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v5/ctrlalloc.cmake b/boards/px4/fmu-v5/ctrlalloc.cmake index c2dbb22f98..db5923eb3a 100644 --- a/boards/px4/fmu-v5/ctrlalloc.cmake +++ b/boards/px4/fmu-v5/ctrlalloc.cmake @@ -127,6 +127,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_gyro fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control diff --git a/boards/px4/fmu-v5/debug.cmake b/boards/px4/fmu-v5/debug.cmake index 0ad41402b0..e74ab83236 100644 --- a/boards/px4/fmu-v5/debug.cmake +++ b/boards/px4/fmu-v5/debug.cmake @@ -123,6 +123,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fake_magnetometer #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello diff --git a/boards/px4/fmu-v5/default.cmake b/boards/px4/fmu-v5/default.cmake index 8472ad76d4..c2dcd651ab 100644 --- a/boards/px4/fmu-v5/default.cmake +++ b/boards/px4/fmu-v5/default.cmake @@ -125,6 +125,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fake_gyro fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control diff --git a/boards/px4/fmu-v5/irqmonitor.cmake b/boards/px4/fmu-v5/irqmonitor.cmake index 4749467037..dd4c85ea99 100644 --- a/boards/px4/fmu-v5/irqmonitor.cmake +++ b/boards/px4/fmu-v5/irqmonitor.cmake @@ -119,6 +119,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v5/rtps.cmake b/boards/px4/fmu-v5/rtps.cmake index 0604383d73..37c253aead 100644 --- a/boards/px4/fmu-v5/rtps.cmake +++ b/boards/px4/fmu-v5/rtps.cmake @@ -119,6 +119,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v5/stackcheck.cmake b/boards/px4/fmu-v5/stackcheck.cmake index 087dc8b588..387c142a51 100644 --- a/boards/px4/fmu-v5/stackcheck.cmake +++ b/boards/px4/fmu-v5/stackcheck.cmake @@ -123,6 +123,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fake_magnetometer #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control #hello diff --git a/boards/px4/fmu-v5/uavcanv1.cmake b/boards/px4/fmu-v5/uavcanv1.cmake index 5410bc653b..765326d8f1 100644 --- a/boards/px4/fmu-v5/uavcanv1.cmake +++ b/boards/px4/fmu-v5/uavcanv1.cmake @@ -126,6 +126,7 @@ px4_add_board( ver work_queue EXAMPLES + #fake_gps #fake_gyro #fake_magnetometer #fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control diff --git a/boards/px4/fmu-v5x/base_phy_DP83848C.cmake b/boards/px4/fmu-v5x/base_phy_DP83848C.cmake index cedcdfd3ec..9c7ac206ac 100644 --- a/boards/px4/fmu-v5x/base_phy_DP83848C.cmake +++ b/boards/px4/fmu-v5x/base_phy_DP83848C.cmake @@ -119,6 +119,7 @@ px4_add_board( work_queue serial_test EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v5x/default.cmake b/boards/px4/fmu-v5x/default.cmake index b2544095df..58cc476cfb 100644 --- a/boards/px4/fmu-v5x/default.cmake +++ b/boards/px4/fmu-v5x/default.cmake @@ -122,6 +122,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v6u/default.cmake b/boards/px4/fmu-v6u/default.cmake index 000017b7cd..7e23ff4459 100644 --- a/boards/px4/fmu-v6u/default.cmake +++ b/boards/px4/fmu-v6u/default.cmake @@ -122,6 +122,7 @@ px4_add_board( work_queue serial_test EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v6u/stackcheck.cmake b/boards/px4/fmu-v6u/stackcheck.cmake index 000017b7cd..7e23ff4459 100644 --- a/boards/px4/fmu-v6u/stackcheck.cmake +++ b/boards/px4/fmu-v6u/stackcheck.cmake @@ -122,6 +122,7 @@ px4_add_board( work_queue serial_test EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/fmu-v6x/default.cmake b/boards/px4/fmu-v6x/default.cmake index 67d68acf7a..9afa6612de 100644 --- a/boards/px4/fmu-v6x/default.cmake +++ b/boards/px4/fmu-v6x/default.cmake @@ -120,6 +120,7 @@ px4_add_board( work_queue serial_test EXAMPLES + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/px4/raspberrypi/default.cmake b/boards/px4/raspberrypi/default.cmake index a728372bf5..36d812f838 100644 --- a/boards/px4/raspberrypi/default.cmake +++ b/boards/px4/raspberrypi/default.cmake @@ -83,6 +83,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_gps dyn_hello # dynamically loading modules example fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/px4/sitl/ctrlalloc.cmake b/boards/px4/sitl/ctrlalloc.cmake index 267b18097a..9922036c8e 100644 --- a/boards/px4/sitl/ctrlalloc.cmake +++ b/boards/px4/sitl/ctrlalloc.cmake @@ -87,6 +87,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/px4/sitl/default.cmake b/boards/px4/sitl/default.cmake index 4b38a847bc..217b262699 100644 --- a/boards/px4/sitl/default.cmake +++ b/boards/px4/sitl/default.cmake @@ -85,6 +85,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/px4/sitl/nolockstep.cmake b/boards/px4/sitl/nolockstep.cmake index 0cf36842b1..3c45559194 100644 --- a/boards/px4/sitl/nolockstep.cmake +++ b/boards/px4/sitl/nolockstep.cmake @@ -85,6 +85,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/px4/sitl/rtps.cmake b/boards/px4/sitl/rtps.cmake index 9004c67dbe..9f043c589f 100644 --- a/boards/px4/sitl/rtps.cmake +++ b/boards/px4/sitl/rtps.cmake @@ -84,6 +84,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/px4/sitl/test.cmake b/boards/px4/sitl/test.cmake index 861b5af0d2..5205f770df 100644 --- a/boards/px4/sitl/test.cmake +++ b/boards/px4/sitl/test.cmake @@ -83,6 +83,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello diff --git a/boards/scumaker/pilotpi/arm64.cmake b/boards/scumaker/pilotpi/arm64.cmake index f02d39b087..3684b2990f 100644 --- a/boards/scumaker/pilotpi/arm64.cmake +++ b/boards/scumaker/pilotpi/arm64.cmake @@ -84,6 +84,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/boards/scumaker/pilotpi/default.cmake b/boards/scumaker/pilotpi/default.cmake index c5fed5e441..4dcd5bed6b 100644 --- a/boards/scumaker/pilotpi/default.cmake +++ b/boards/scumaker/pilotpi/default.cmake @@ -84,6 +84,7 @@ px4_add_board( work_queue EXAMPLES dyn_hello # dynamically loading modules example + fake_gps fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello #hwtest # Hardware test diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index a2f9c34b7b..e7bd0a4cdb 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -103,8 +103,8 @@ public: Count }; - GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interface, bool fake_gps, bool enable_sat_info, - Instance instance, unsigned configured_baudrate); + GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interface, bool enable_sat_info, Instance instance, + unsigned configured_baudrate); ~GPS() override; /** @see ModuleBase */ @@ -175,8 +175,6 @@ private: unsigned _num_bytes_read{0}; ///< counter for number of read bytes from the UART (within update interval) unsigned _rate_reading{0}; ///< reading rate in B/s - const bool _fake_gps; ///< fake gps output - const Instance _instance; uORB::Subscription _orb_inject_data_sub{ORB_ID(gps_inject_data)}; @@ -258,12 +256,11 @@ px4::atomic GPS::_secondary_instance{nullptr}; extern "C" __EXPORT int gps_main(int argc, char *argv[]); -GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interface, bool fake_gps, - bool enable_sat_info, Instance instance, unsigned configured_baudrate) : +GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interface, bool enable_sat_info, + Instance instance, unsigned configured_baudrate) : _configured_baudrate(configured_baudrate), _mode(mode), _interface(interface), - _fake_gps(fake_gps), _instance(instance) { /* store port name */ @@ -637,37 +634,35 @@ void GPS::dumpGpsData(uint8_t *data, size_t len, bool msg_to_gps_device) void GPS::run() { - if (!_fake_gps) { - /* open the serial port */ - _serial_fd = ::open(_port, O_RDWR | O_NOCTTY); + /* open the serial port */ + _serial_fd = ::open(_port, O_RDWR | O_NOCTTY); - if (_serial_fd < 0) { - PX4_ERR("GPS: failed to open serial port: %s err: %d", _port, errno); - return; - } + if (_serial_fd < 0) { + PX4_ERR("GPS: failed to open serial port: %s err: %d", _port, errno); + return; + } #ifdef __PX4_LINUX - if (_interface == GPSHelper::Interface::SPI) { - int spi_speed = 1000000; // make sure the bus speed is not too high (required on RPi) - int status_value = ioctl(_serial_fd, SPI_IOC_WR_MAX_SPEED_HZ, &spi_speed); + if (_interface == GPSHelper::Interface::SPI) { + int spi_speed = 1000000; // make sure the bus speed is not too high (required on RPi) + int status_value = ioctl(_serial_fd, SPI_IOC_WR_MAX_SPEED_HZ, &spi_speed); - if (status_value < 0) { - PX4_ERR("SPI_IOC_WR_MAX_SPEED_HZ failed for %s (%d)", _port, errno); - return; - } - - status_value = ioctl(_serial_fd, SPI_IOC_RD_MAX_SPEED_HZ, &spi_speed); - - if (status_value < 0) { - PX4_ERR("SPI_IOC_RD_MAX_SPEED_HZ failed for %s (%d)", _port, errno); - return; - } + if (status_value < 0) { + PX4_ERR("SPI_IOC_WR_MAX_SPEED_HZ failed for %s (%d)", _port, errno); + return; } -#endif /* __PX4_LINUX */ + status_value = ioctl(_serial_fd, SPI_IOC_RD_MAX_SPEED_HZ, &spi_speed); + + if (status_value < 0) { + PX4_ERR("SPI_IOC_RD_MAX_SPEED_HZ failed for %s (%d)", _port, errno); + return; + } } +#endif /* __PX4_LINUX */ + param_t handle = param_find("GPS_YAW_OFFSET"); float heading_offset = 0.f; @@ -719,122 +714,89 @@ GPS::run() /* loop handling received serial bytes and also configuring in between */ while (!should_exit()) { + if (_helper != nullptr) { + delete (_helper); + _helper = nullptr; + } - if (_fake_gps) { - _report_gps_pos.timestamp = hrt_absolute_time(); - _report_gps_pos.lat = (int32_t)47.378301e7f; - _report_gps_pos.lon = (int32_t)8.538777e7f; - _report_gps_pos.alt = (int32_t)1200e3f; - _report_gps_pos.alt_ellipsoid = 10000; - _report_gps_pos.s_variance_m_s = 0.5f; - _report_gps_pos.c_variance_rad = 0.1f; - _report_gps_pos.fix_type = 3; - _report_gps_pos.eph = 0.8f; - _report_gps_pos.epv = 1.2f; - _report_gps_pos.hdop = 0.9f; - _report_gps_pos.vdop = 0.9f; - _report_gps_pos.vel_n_m_s = 0.0f; - _report_gps_pos.vel_e_m_s = 0.0f; - _report_gps_pos.vel_d_m_s = 0.0f; - _report_gps_pos.vel_m_s = 0.0f; - _report_gps_pos.cog_rad = 0.0f; - _report_gps_pos.vel_ned_valid = true; - _report_gps_pos.satellites_used = 10; - _report_gps_pos.heading = NAN; - _report_gps_pos.heading_offset = NAN; + switch (_mode) { + case GPS_DRIVER_MODE_NONE: + _mode = GPS_DRIVER_MODE_UBX; - /* no time and satellite information simulated */ - - - publish(); - - px4_usleep(200000); - - } else { - - if (_helper != nullptr) { - delete (_helper); - _helper = nullptr; - } - - switch (_mode) { - case GPS_DRIVER_MODE_NONE: - _mode = GPS_DRIVER_MODE_UBX; - - /* FALLTHROUGH */ - case GPS_DRIVER_MODE_UBX: - _helper = new GPSDriverUBX(_interface, &GPS::callback, this, &_report_gps_pos, _p_report_sat_info, - gps_ubx_dynmodel, heading_offset, ubx_mode); - break; + /* FALLTHROUGH */ + case GPS_DRIVER_MODE_UBX: + _helper = new GPSDriverUBX(_interface, &GPS::callback, this, &_report_gps_pos, _p_report_sat_info, + gps_ubx_dynmodel, heading_offset, ubx_mode); + break; #ifndef CONSTRAINED_FLASH - case GPS_DRIVER_MODE_MTK: - _helper = new GPSDriverMTK(&GPS::callback, this, &_report_gps_pos); - break; + case GPS_DRIVER_MODE_MTK: + _helper = new GPSDriverMTK(&GPS::callback, this, &_report_gps_pos); + break; - case GPS_DRIVER_MODE_ASHTECH: - _helper = new GPSDriverAshtech(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info, heading_offset); - break; + case GPS_DRIVER_MODE_ASHTECH: + _helper = new GPSDriverAshtech(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info, heading_offset); + break; - case GPS_DRIVER_MODE_EMLIDREACH: - _helper = new GPSDriverEmlidReach(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info); - break; + case GPS_DRIVER_MODE_EMLIDREACH: + _helper = new GPSDriverEmlidReach(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info); + break; #endif // CONSTRAINED_FLASH - default: - break; + default: + break; + } + + _baudrate = _configured_baudrate; + GPSHelper::GPSConfig gpsConfig{}; + gpsConfig.output_mode = GPSHelper::OutputMode::GPS; + gpsConfig.gnss_systems = static_cast(gnssSystemsParam); + + if (_helper && _helper->configure(_baudrate, gpsConfig) == 0) { + + /* reset report */ + memset(&_report_gps_pos, 0, sizeof(_report_gps_pos)); + _report_gps_pos.heading = NAN; + _report_gps_pos.heading_offset = heading_offset; + + if (_mode == GPS_DRIVER_MODE_UBX) { + + /* GPS is obviously detected successfully, reset statistics */ + _helper->resetUpdateRates(); } - _baudrate = _configured_baudrate; - GPSHelper::GPSConfig gpsConfig{}; - gpsConfig.output_mode = GPSHelper::OutputMode::GPS; - gpsConfig.gnss_systems = static_cast(gnssSystemsParam); + int helper_ret; - if (_helper && _helper->configure(_baudrate, gpsConfig) == 0) { + while ((helper_ret = _helper->receive(TIMEOUT_5HZ)) > 0 && !should_exit()) { - /* reset report */ - memset(&_report_gps_pos, 0, sizeof(_report_gps_pos)); - _report_gps_pos.heading = NAN; - _report_gps_pos.heading_offset = heading_offset; + if (helper_ret & 1) { + publish(); - if (_mode == GPS_DRIVER_MODE_UBX) { + last_rate_count++; + } - /* GPS is obviously detected successfully, reset statistics */ + if (_p_report_sat_info && (helper_ret & 2)) { + publishSatelliteInfo(); + } + + reset_if_scheduled(); + + /* measure update rate every 5 seconds */ + if (hrt_absolute_time() - last_rate_measurement > RATE_MEASUREMENT_PERIOD) { + float dt = (float)((hrt_absolute_time() - last_rate_measurement)) / 1000000.0f; + _rate = last_rate_count / dt; + _rate_rtcm_injection = _last_rate_rtcm_injection_count / dt; + _rate_reading = _num_bytes_read / dt; + last_rate_measurement = hrt_absolute_time(); + last_rate_count = 0; + _last_rate_rtcm_injection_count = 0; + _num_bytes_read = 0; + _helper->storeUpdateRates(); _helper->resetUpdateRates(); } - int helper_ret; - - while ((helper_ret = _helper->receive(TIMEOUT_5HZ)) > 0 && !should_exit()) { - - if (helper_ret & 1) { - publish(); - - last_rate_count++; - } - - if (_p_report_sat_info && (helper_ret & 2)) { - publishSatelliteInfo(); - } - - reset_if_scheduled(); - - /* measure update rate every 5 seconds */ - if (hrt_absolute_time() - last_rate_measurement > RATE_MEASUREMENT_PERIOD) { - float dt = (float)((hrt_absolute_time() - last_rate_measurement)) / 1000000.0f; - _rate = last_rate_count / dt; - _rate_rtcm_injection = _last_rate_rtcm_injection_count / dt; - _rate_reading = _num_bytes_read / dt; - last_rate_measurement = hrt_absolute_time(); - last_rate_count = 0; - _last_rate_rtcm_injection_count = 0; - _num_bytes_read = 0; - _helper->storeUpdateRates(); - _helper->resetUpdateRates(); - } - - if (!_healthy) { - // Helpful for debugging, but too verbose for normal ops + if (!_healthy) { + // Helpful for debugging, but too verbose for normal ops // const char *mode_str = "unknown"; // // switch (_mode) { @@ -859,46 +821,44 @@ GPS::run() // } // // PX4_WARN("module found: %s", mode_str); - _healthy = true; - } - } - - if (_healthy) { - _healthy = false; - _rate = 0.0f; - _rate_rtcm_injection = 0.0f; + _healthy = true; } } - if (_mode_auto) { - switch (_mode) { - case GPS_DRIVER_MODE_UBX: + if (_healthy) { + _healthy = false; + _rate = 0.0f; + _rate_rtcm_injection = 0.0f; + } + } + + if (_mode_auto) { + switch (_mode) { + case GPS_DRIVER_MODE_UBX: #ifndef CONSTRAINED_FLASH - _mode = GPS_DRIVER_MODE_MTK; - break; + _mode = GPS_DRIVER_MODE_MTK; + break; - case GPS_DRIVER_MODE_MTK: - _mode = GPS_DRIVER_MODE_ASHTECH; - break; + case GPS_DRIVER_MODE_MTK: + _mode = GPS_DRIVER_MODE_ASHTECH; + break; - case GPS_DRIVER_MODE_ASHTECH: - _mode = GPS_DRIVER_MODE_EMLIDREACH; - break; + case GPS_DRIVER_MODE_ASHTECH: + _mode = GPS_DRIVER_MODE_EMLIDREACH; + break; - case GPS_DRIVER_MODE_EMLIDREACH: + case GPS_DRIVER_MODE_EMLIDREACH: #endif // CONSTRAINED_FLASH - _mode = GPS_DRIVER_MODE_UBX; - px4_usleep(500000); // tried all possible drivers. Wait a bit before next round - break; + _mode = GPS_DRIVER_MODE_UBX; + px4_usleep(500000); // tried all possible drivers. Wait a bit before next round + break; - default: - break; - } - - } else { - px4_usleep(500000); + default: + break; } + } else { + px4_usleep(500000); } } @@ -927,33 +887,28 @@ GPS::print_status() break; } - //GPS Mode - if (_fake_gps) { - PX4_INFO("protocol: SIMULATED"); - - } else { - switch (_mode) { - case GPS_DRIVER_MODE_UBX: - PX4_INFO("protocol: UBX"); - break; + // GPS Mode + switch (_mode) { + case GPS_DRIVER_MODE_UBX: + PX4_INFO("protocol: UBX"); + break; #ifndef CONSTRAINED_FLASH - case GPS_DRIVER_MODE_MTK: - PX4_INFO("protocol: MTK"); - break; + case GPS_DRIVER_MODE_MTK: + PX4_INFO("protocol: MTK"); + break; - case GPS_DRIVER_MODE_ASHTECH: - PX4_INFO("protocol: ASHTECH"); - break; + case GPS_DRIVER_MODE_ASHTECH: + PX4_INFO("protocol: ASHTECH"); + break; - case GPS_DRIVER_MODE_EMLIDREACH: - PX4_INFO("protocol: EMLIDREACH"); - break; + case GPS_DRIVER_MODE_EMLIDREACH: + PX4_INFO("protocol: EMLIDREACH"); + break; #endif // CONSTRAINED_FLASH - default: - break; - } + default: + break; } PX4_INFO("status: %s, port: %s, baudrate: %d", _healthy ? "OK" : "NOT OK", _port, _baudrate); @@ -966,10 +921,8 @@ GPS::print_status() PX4_INFO("rate velocity: \t\t%6.2f Hz", (double)_helper->getVelocityUpdateRate()); } - if (!_fake_gps) { - PX4_INFO("rate publication:\t\t%6.2f Hz", (double)_rate); - PX4_INFO("rate RTCM injection:\t%6.2f Hz", (double)_rate_rtcm_injection); - } + PX4_INFO("rate publication:\t\t%6.2f Hz", (double)_rate); + PX4_INFO("rate RTCM injection:\t%6.2f Hz", (double)_rate_rtcm_injection); print_message(_report_gps_pos); } @@ -1097,9 +1050,6 @@ There is a thread for each device polling for data. The GPS protocol classes are so that they can be used in other projects as well (eg. QGroundControl uses them too). ### Examples -For testing it can be useful to fake a GPS signal (it will signal the system that it has a valid position): -$ gps stop -$ gps start -f Starting 2 GPS devices (the main GPS on /dev/ttyS3 and the secondary on /dev/ttyS4): $ gps start -d /dev/ttyS3 -e /dev/ttyS4 @@ -1115,7 +1065,6 @@ $ gps reset warm PRINT_MODULE_USAGE_PARAM_STRING('e', nullptr, "", "Optional secondary GPS device", true); PRINT_MODULE_USAGE_PARAM_INT('g', 0, 0, 3000000, "Baudrate (secondary GPS, can also be p:)", true); - PRINT_MODULE_USAGE_PARAM_FLAG('f', "Fake a GPS signal (useful for testing)", true); PRINT_MODULE_USAGE_PARAM_FLAG('s', "Enable publication of satellite info", true); PRINT_MODULE_USAGE_PARAM_STRING('i', "uart", "spi|uart", "GPS interface", true); @@ -1186,7 +1135,6 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) const char *device_name_secondary = nullptr; int baudrate_main = 0; int baudrate_secondary = 0; - bool fake_gps = false; bool enable_sat_info = false; GPSHelper::Interface interface = GPSHelper::Interface::UART; GPSHelper::Interface interface_secondary = GPSHelper::Interface::UART; @@ -1197,7 +1145,7 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) int ch; const char *myoptarg = nullptr; - while ((ch = px4_getopt(argc, argv, "b:d:e:fg:si:j:p:", &myoptind, &myoptarg)) != EOF) { + while ((ch = px4_getopt(argc, argv, "b:d:e:g:si:j:p:", &myoptind, &myoptarg)) != EOF) { switch (ch) { case 'b': if (px4_get_parameter_value(myoptarg, baudrate_main) != 0) { @@ -1220,10 +1168,6 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) device_name_secondary = myoptarg; break; - case 'f': - fake_gps = true; - break; - case 's': enable_sat_info = true; break; @@ -1290,7 +1234,7 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) GPS *gps; if (instance == Instance::Main) { - gps = new GPS(device_name, mode, interface, fake_gps, enable_sat_info, instance, baudrate_main); + gps = new GPS(device_name, mode, interface, enable_sat_info, instance, baudrate_main); if (gps && device_name_secondary) { task_spawn(argc, argv, Instance::Secondary); @@ -1308,7 +1252,7 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance) } } } else { // secondary instance - gps = new GPS(device_name_secondary, mode, interface_secondary, fake_gps, enable_sat_info, instance, baudrate_secondary); + gps = new GPS(device_name_secondary, mode, interface_secondary, enable_sat_info, instance, baudrate_secondary); } return gps; diff --git a/src/examples/fake_gps/CMakeLists.txt b/src/examples/fake_gps/CMakeLists.txt new file mode 100644 index 0000000000..41539388da --- /dev/null +++ b/src/examples/fake_gps/CMakeLists.txt @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2021 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +px4_add_module( + MODULE modules__fake_gps + MAIN fake_gps + COMPILE_FLAGS + SRCS + FakeGps.cpp + FakeGps.hpp + DEPENDS + px4_work_queue +) diff --git a/src/examples/fake_gps/FakeGps.cpp b/src/examples/fake_gps/FakeGps.cpp new file mode 100644 index 0000000000..1605a2f9b9 --- /dev/null +++ b/src/examples/fake_gps/FakeGps.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** + * + * Copyright (c) 2021 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#include "FakeGps.hpp" + +using namespace time_literals; + +FakeGps::FakeGps(double latitude_deg, double longitude_deg, float altitude_m) : + ModuleParams(nullptr), + ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default), + _latitude(latitude_deg * 10e6), + _longitude(longitude_deg * 10e6), + _altitude(altitude_m * 10e2f) +{ +} + +bool FakeGps::init() +{ + ScheduleOnInterval(SENSOR_INTERVAL_US); + return true; +} + +void FakeGps::Run() +{ + if (should_exit()) { + ScheduleClear(); + exit_and_cleanup(); + return; + } + + sensor_gps_s sensor_gps{}; + sensor_gps.time_utc_usec = hrt_absolute_time() + 1613692609599954; + sensor_gps.lat = _latitude; + sensor_gps.lon = _longitude; + sensor_gps.alt = _altitude; + sensor_gps.alt_ellipsoid = _altitude; + sensor_gps.s_variance_m_s = 0.3740f; + sensor_gps.c_variance_rad = 0.6737f; + sensor_gps.eph = 2.1060f; + sensor_gps.epv = 3.8470f; + sensor_gps.hdop = 0.8800f; + sensor_gps.vdop = 1.3300f; + sensor_gps.noise_per_ms = 101; + sensor_gps.jamming_indicator = 35; + sensor_gps.vel_m_s = 0.0420f; + sensor_gps.vel_n_m_s = 0.0370f; + sensor_gps.vel_e_m_s = 0.0200f; + sensor_gps.vel_d_m_s = -0.0570f; + sensor_gps.cog_rad = 0.3988f; + sensor_gps.timestamp_time_relative = 0; + sensor_gps.heading = NAN; + sensor_gps.heading_offset = 0.0000; + sensor_gps.fix_type = 4; + sensor_gps.jamming_state = 0; + sensor_gps.vel_ned_valid = true; + sensor_gps.satellites_used = 14; + sensor_gps.timestamp = hrt_absolute_time(); + _sensor_gps_pub.publish(sensor_gps); +} + +int FakeGps::task_spawn(int argc, char *argv[]) +{ + FakeGps *instance = new FakeGps(); + + if (instance) { + _object.store(instance); + _task_id = task_id_is_work_queue; + + if (instance->init()) { + return PX4_OK; + } + + } else { + PX4_ERR("alloc failed"); + } + + delete instance; + _object.store(nullptr); + _task_id = -1; + + return PX4_ERROR; +} + +int FakeGps::custom_command(int argc, char *argv[]) +{ + return print_usage("unknown command"); +} + +int FakeGps::print_usage(const char *reason) +{ + if (reason) { + PX4_WARN("%s\n", reason); + } + + PRINT_MODULE_DESCRIPTION( + R"DESCR_STR( +### Description + +)DESCR_STR"); + + PRINT_MODULE_USAGE_NAME("fake_gps", "driver"); + PRINT_MODULE_USAGE_COMMAND("start"); + PRINT_MODULE_USAGE_DEFAULT_COMMANDS(); + return 0; +} + +extern "C" __EXPORT int fake_gps_main(int argc, char *argv[]) +{ + return FakeGps::main(argc, argv); +} diff --git a/src/examples/fake_gps/FakeGps.hpp b/src/examples/fake_gps/FakeGps.hpp new file mode 100644 index 0000000000..ef5a9197eb --- /dev/null +++ b/src/examples/fake_gps/FakeGps.hpp @@ -0,0 +1,73 @@ +/**************************************************************************** + * + * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class FakeGps : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem +{ +public: + FakeGps(double latitude_deg = 29.6603018, double longitude_deg = -82.3160500, float altitude_m = 30.1f); + + ~FakeGps() override = default; + + /** @see ModuleBase */ + static int task_spawn(int argc, char *argv[]); + + /** @see ModuleBase */ + static int custom_command(int argc, char *argv[]); + + /** @see ModuleBase */ + static int print_usage(const char *reason = nullptr); + + bool init(); + +private: + static constexpr uint32_t SENSOR_INTERVAL_US{1000000 / 5}; // 5 Hz + + void Run() override; + + uORB::PublicationMulti _sensor_gps_pub{ORB_ID(sensor_gps)}; + + int32_t _latitude{296603018}; // Latitude in 1e-7 degrees + int32_t _longitude{-823160500}; // Longitude in 1e-7 degrees + int32_t _altitude{30100}; // Altitude in 1e-3 meters above MSL, (millimetres) +};