Browse Source

AP_UAVCAN: fixed build of example on px4

mission-4.1.18
Andrew Tridgell 7 years ago
parent
commit
49dfccbcee
  1. 4
      libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md
  2. 15
      libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp

4
libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md

@ -4,12 +4,15 @@ be received by another node.
To build and upload for a Pixhawk style board run this: To build and upload for a Pixhawk style board run this:
```
./waf configure --board fmuv3 ./waf configure --board fmuv3
./waf --target examples/UAVCAN_sniffer --upload ./waf --target examples/UAVCAN_sniffer --upload
```
then connect on the USB console. You will see 1Hz packet stats like then connect on the USB console. You will see 1Hz packet stats like
this: this:
```
uavcan.equipment.air_data.StaticPressure: 29 uavcan.equipment.air_data.StaticPressure: 29
uavcan.equipment.air_data.StaticTemperature: 29 uavcan.equipment.air_data.StaticTemperature: 29
uavcan.equipment.ahrs.MagneticFieldStrength: 20 uavcan.equipment.ahrs.MagneticFieldStrength: 20
@ -18,6 +21,7 @@ uavcan.equipment.gnss.Fix: 10
uavcan.equipment.gnss.Auxiliary: 1 uavcan.equipment.gnss.Auxiliary: 1
uavcan.equipment.actuator.ArrayCommand: 45 uavcan.equipment.actuator.ArrayCommand: 45
uavcan.equipment.esc.RawCommand: 368 uavcan.equipment.esc.RawCommand: 368
```
note that the code requires you to add new msg types you want to note that the code requires you to add new msg types you want to
see. Look for the MSG_CB() and START_CB() macros in the code see. Look for the MSG_CB() and START_CB() macros in the code

15
libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp

@ -4,7 +4,7 @@
#include <AP_Common/AP_Common.h> #include <AP_Common/AP_Common.h>
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX #if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
#include <uavcan/uavcan.hpp> #include <uavcan/uavcan.hpp>
@ -301,4 +301,17 @@ void loop(void)
AP_HAL_MAIN(); AP_HAL_MAIN();
#else
#include <stdio.h>
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
static void loop() { }
static void setup()
{
printf("Board not currently supported\n");
}
AP_HAL_MAIN();
#endif #endif

Loading…
Cancel
Save