dronecodeのコーディングルールを拝見いたしました。
あまりにもざっくりしていることもあり、保守性や品質まではいき渡っていなさそうと感じています。
そこで、日本には、組み込み系ソフトについて、コーディングルールというのを事細かく定義してるものがあります。
例えば、
・MISRAとか
・IPAの「組込みソフトウェア開発向けコーディング作法ガイド[C++言語版]」や
・凡ミスによる障害の回避ルール
これらのルールをベースにArduCopterのコードの品質を上げていきたい。
また、その過程で、不安なコードがあれば、不安を軽減していきたい。
その情報や修正案などのアップしたいと思い、このディスカッションを立ち上げました。
何卒、よろしくおねがいいたします。
Replies
稼働させたまま、約2時間後に見てみたら、青LEDが点灯しっぱなしになっていました。
長時間稼働させるとスタックオーバーフローみたいなことが発生しているのだろうか?
傾いていると判断されている。。。
murata,katsutoshi said:
PX4FlowのファームウェアをGithubのMasterのバージョンへアップしてみることにしました。
https://github.com/PX4/Flow
ターゲットを「px4flow-v2_default」にしたところ、ハートビートLEDが点灯しっぱなしになりました。
タイプが合わないと判断し、「px4flow-v1_default」を選択したところ、更新前と同じような点滅になりました。
とりあえず、これで、長時間テストを実施してみます。
===
murata@ubuntu:~/work/PX4Flow$ make clean
murata@ubuntu:~/work/PX4Flow$ make px4flow-v1_default upload-usb
Checked mavlink submodule, correct version found
%%%%
%%%% Building px4flow-v1_default on baremetal in /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/
%%%%
make[1]: Entering directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build'
% PX4_BASE = /home/murata/work/PX4Flow/
% GIT_DESC = 4a314cfdb099aed9795b825e7518203771207fbb
% BUILD_URI = "localhost"
% CONFIG = px4flow-v1_default
% PX4_TARGET_OS = baremetal
% BOARD = px4flow-v1
% WORK_DIR = /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/
% BAREMETTAL_STARTUP =
%% Unpacking /home/murata/work/PX4Flow/Archives/px4flow-v1.baremetal.export
CC: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/empty.c
make[2]: Entering directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1'
%% MODULE px4flow-v1 (/home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/module.mk)
CC: /home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/px4flow_init.c
CC: /home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/../../../drivers/bootloaders/src/common/boot_app_shared.c
CC: /home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/../../../drivers/bootloaders/src/util/crc.c
PRELINK: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/module.pre.o
#@ arm-none-eabi-ld -Ur -Map /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/module.pre.o.map -o /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/module.pre.o px4flow_init.c.o ../../../drivers/bootloaders/src/common/boot_app_shared.c.o ../../../drivers/bootloaders/src/util/crc.c.o && arm-none-eabi-objcopy --localize-hidden /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1/module.pre.o
make[2]: Leaving directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1'
make[2]: Entering directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/modules/flow'
%% MODULE flow (/home/murata/work/PX4Flow/src/modules/flow/module.mk)
SRCS=/home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/startup_stm32f4xx.s system_stm32f4xx.c stm32f4xx_it.c main.c utils.c led.c settings.c communication.c flow.c dcmi.c mt9v034.c gyro.c usart.c sonar.c debug.c usb_bsp.c usbd_cdc_vcp.c usbd_desc.c usbd_usr.c i2c.c reset.c sonar_mode_filter.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/misc.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dcmi.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_i2c.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_spi.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_core.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_dcd_int.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_dcd.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_core.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_req.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_ioreq.c /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
CC: /home/murata/work/PX4Flow/src/modules/flow/system_stm32f4xx.c
CC: /home/murata/work/PX4Flow/src/modules/flow/stm32f4xx_it.c
CC: /home/murata/work/PX4Flow/src/modules/flow/main.c
CC: /home/murata/work/PX4Flow/src/modules/flow/utils.c
CC: /home/murata/work/PX4Flow/src/modules/flow/led.c
CC: /home/murata/work/PX4Flow/src/modules/flow/settings.c
CC: /home/murata/work/PX4Flow/src/modules/flow/communication.c
CC: /home/murata/work/PX4Flow/src/modules/flow/flow.c
CC: /home/murata/work/PX4Flow/src/modules/flow/dcmi.c
CC: /home/murata/work/PX4Flow/src/modules/flow/mt9v034.c
CC: /home/murata/work/PX4Flow/src/modules/flow/gyro.c
CC: /home/murata/work/PX4Flow/src/modules/flow/usart.c
CC: /home/murata/work/PX4Flow/src/modules/flow/sonar.c
CC: /home/murata/work/PX4Flow/src/modules/flow/debug.c
CC: /home/murata/work/PX4Flow/src/modules/flow/usb_bsp.c
CC: /home/murata/work/PX4Flow/src/modules/flow/usbd_cdc_vcp.c
CC: /home/murata/work/PX4Flow/src/modules/flow/usbd_desc.c
CC: /home/murata/work/PX4Flow/src/modules/flow/usbd_usr.c
CC: /home/murata/work/PX4Flow/src/modules/flow/i2c.c
CC: /home/murata/work/PX4Flow/src/modules/flow/reset.c
CC: /home/murata/work/PX4Flow/src/modules/flow/sonar_mode_filter.c
PRELINK: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/flow/module.pre.o
#@ arm-none-eabi-ld -Ur -Map /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/flow/module.pre.o.map -o /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/flow/module.pre.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/startup_stm32f4xx.s.o system_stm32f4xx.c.o stm32f4xx_it.c.o main.c.o utils.c.o led.c.o settings.c.o communication.c.o flow.c.o dcmi.c.o mt9v034.c.o gyro.c.o usart.c.o sonar.c.o debug.c.o usb_bsp.c.o usbd_cdc_vcp.c.o usbd_desc.c.o usbd_usr.c.o i2c.c.o reset.c.o sonar_mode_filter.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/misc.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dcmi.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_i2c.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_spi.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_core.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_dcd_int.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_OTG_Driver/src/usb_dcd.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_core.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_req.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Core/src/usbd_ioreq.c.o /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c.o && arm-none-eabi-objcopy --localize-hidden /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/flow/module.pre.o
make[2]: Leaving directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/modules/flow'
make[2]: Entering directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/modules/libc'
%% MODULE libc (/home/murata/work/PX4Flow/src/modules/libc/module.mk)
INCLUDE_DIRS=/home/murata/work/PX4Flow/src/ /home/murata/work/PX4Flow/src/modules/ /home/murata/work/PX4Flow/src/include/ /home/murata/work/PX4Flow/src/lib/ /home/murata/work/PX4Flow/src/platforms/ /home/murata/work/PX4Flow/Build/versioning/ /home/murata/work/PX4Flow/src/drivers/bootloaders/include /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2 /home/murata/work/PX4Flow/src/lib/stm32/st/v1.0.2/STM32F4xx_StdPeriph_Driver/inc /home/murata/work/PX4Flow/src/drivers/boards/px4flow-v1 /home/murata/work/PX4Flow/src//modules/libc/ /home/murata/work/PX4Flow/src//modules/libc/syslog
CC: /home/murata/work/PX4Flow/src/modules/libc/init.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strncmp.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strcmp.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_memcpy.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_memset.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strcpy.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strncpy.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strlen.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_strncat.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_skipspace.c
CC: /home/murata/work/PX4Flow/src/modules/libc/string/lib_isbasedigit.c
CC: /home/murata/work/PX4Flow/src/modules/libc/stdio/lib_printf.c
CC: /home/murata/work/PX4Flow/src/modules/libc/stdlib/lib_strtol.c
CC: /home/murata/work/PX4Flow/src/modules/libc/stdlib/lib_strtoul.c
CC: /home/murata/work/PX4Flow/src/modules/libc/stdlib/lib_checkbase.c
PRELINK: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/libc/module.pre.o
#@ arm-none-eabi-ld -Ur -Map /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/libc/module.pre.o.map -o /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/libc/module.pre.o init.c.o string/lib_strncmp.c.o string/lib_strcmp.c.o string/lib_memcpy.c.o string/lib_memset.c.o string/lib_strcpy.c.o string/lib_strncpy.c.o string/lib_strlen.c.o string/lib_strncat.c.o string/lib_skipspace.c.o string/lib_isbasedigit.c.o stdio/lib_printf.c.o stdlib/lib_strtol.c.o stdlib/lib_strtoul.c.o stdlib/lib_checkbase.c.o && arm-none-eabi-objcopy --localize-hidden /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/modules/libc/module.pre.o
make[2]: Leaving directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/modules/libc'
make[2]: Entering directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/platforms/common'
%% MODULE common (/home/murata/work/PX4Flow/src/platforms/common/module.mk)
CC: /home/murata/work/PX4Flow/src/platforms/common/px4_log.c
PRELINK: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/platforms/common/module.pre.o
#@ arm-none-eabi-ld -Ur -Map /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/platforms/common/module.pre.o.map -o /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/platforms/common/module.pre.o px4_log.c.o && arm-none-eabi-objcopy --localize-hidden /home/murata/work/PX4Flow/Build/px4flow-v1_default.build//home/murata/work/PX4Flow/src/platforms/common/module.pre.o
make[2]: Leaving directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build/home/murata/work/PX4Flow/src/platforms/common'
LINK: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/firmware.elf
BIN: /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/firmware.bin
%% Generating /home/murata/work/PX4Flow/Build/px4flow-v1_default.build/firmware.px4
make[1]: Leaving directory '/home/murata/work/PX4Flow/Build/px4flow-v1_default.build'
%% Copying /home/murata/work/PX4Flow/Images/px4flow-v1_default.px4
Attempting to flash px4flow-v1_default.px4 PX4FLOW board via USB
Loaded firmware for 6,0, waiting for the bootloader...
Found board 6,0 bootloader rev 3 on /dev/ttyACM0
erase...
program...
verify...
done, rebooting.
murata@ubuntu:~/work/PX4Flow$
murata,katsutoshi said:
ardupilotを再起動しても、FX4Flowは再起動しない。
I2Cにリセット指定ってあるのでしょうか。
なければ、電源の切り入りになってしまいます。
pi@navio:~/work/ardupilot/build/navio2-debug/bin $ sudo ./arducopter-hexa -A u:192.168.0.25:14550
Raspberry Pi 2/3 with BCM2709!
PANIC: AP_Baro::read unsuccessful for more than 500ms in AP_Baro::calibrate [2]
murata,katsutoshi said:
PX4Flowって、長時間稼働できるのだろうか。
PX4Flow自身がLEDを点滅しています。
この状態で数十分か1、2時間稼働させ続けると、点灯しっぱなしになって、GCSが異常を表示します。
ファームウェアにバグがあるかもしれません。
Mission Planner でログファイルをダウンロード機能があります。
Navi2にはWifiがあり、Wifi接続しています。
このダウンロード時間が、標準のSCPでのダウンロードと比へ非常に遅いです。
ログのダウンロードもテレメトリーとして送信しているからと思いますが。。。
ログのダウンロードにかかる負荷を考えたダウンロードを検討したいと思います。
ダウンロード中。
SCPダウンロード
未ダウンロード
ジャイロ関連が「0」なんですが。。。
これが正常なのか異常なのは。今は不明です。
これから調査するため。
(gdb) p *(i2c_integral_frame*)&val[22]
$9 = {frame_count_since_last_readout = 0, pixel_flow_x_integral = 0, pixel_flow_y_integral = 0, gyro_x_rate_integral = 0, gyro_y_rate_integral = 0, gyro_z_rate_integral = 0, integration_timespan = 0, sonar_timestamp = 13040, ground_distance = 300, gyro_temperature = 4000, qual = 0 '\000'}
(gdb) p/x val
$10 = {0x85, 0xc2, 0x0 <repeats 17 times>, 0x47, 0x2c, 0x1, 0x0 <repeats 16 times>, 0xf0, 0x32, 0x0, 0x0, 0x2c, 0x1, 0xa0, 0xf, 0x0}
murata,katsutoshi said:
GDBでデバッグを進めていいます。
下記のように定義しています。
しかし、処理では、開始レジスタが「0」になっています。
#define PX4FLOW_REG 0x16 // Measure Register 22
===
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Loaded symbols for /lib/arm-linux-gnueabihf/libpthread.so.0
Reading symbols from /lib/arm-linux-gnueabihf/libc.so.6...Reading symbols from /usr/lib/debug//lib/arm-linux-gnueabihf/libc-2.19.so...done.
done.
Loaded symbols for /lib/arm-linux-gnueabihf/libc.so.6
Reading symbols from /lib/ld-linux-armhf.so.3...Reading symbols from /usr/lib/debug//lib/arm-linux-gnueabihf/ld-2.19.so...done.
done.
Loaded symbols for /lib/ld-linux-armhf.so.3
0x00138700 in DataFlash_File::WritePrioritisedBlock (this=0x322c08, pBuffer=0x7ed7841c, size=47, is_critical=false) at ../../libraries/DataFlash/DataFlash_File.cpp:487
487 uint16_t space = BUF_SPACE(_writebuf);
(gdb) c
Continuing.
Breakpoint 1, AP_OpticalFlow_Linux::read (this=0x327d68, report=0x7ed78440) at ../../libraries/AP_OpticalFlow/AP_OpticalFlow_Linux.cpp:101
101 if (!_dev->read_registers(0, val, I2C_INTEGRAL_FRAME_SIZE)) {
(gdb) s
AP_HAL::OwnPtr<AP_HAL::I2CDevice>::operator-> (this=0x327d70) at ../../libraries/AP_HAL/utility/OwnPtr.h:95
95 T *operator->() const { return _ptr; }
(gdb) s
AP_HAL::Device::read_registers (this=0x327d00, first_reg=0 '\000', recv=0x7ed783c4 "", recv_len=25) at ../../libraries/AP_HAL/Device.h:79
79 first_reg |= _read_flag;
(gdb) s
80 return transfer(&first_reg, 1, recv, recv_len);
(gdb) s
Linux::I2CDevice::transfer (this=0x327d00, send=0x7ed783ab "", send_len=1, recv=0x7ed783c4 "", recv_len=25) at ../../libraries/AP_HAL_Linux/I2CDevice.cpp:150
150 struct i2c_msg msgs[2] = { };
(gdb) s
151 unsigned nmsgs = 0;
(gdb) s
153 assert(_bus.fd >= 0);
(gdb) s
155 if (send && send_len != 0) {
(gdb) s
156 msgs[nmsgs].addr = _address;
(gdb) s
157 msgs[nmsgs].flags = 0;
(gdb) s
158 msgs[nmsgs].buf = const_cast<uint8_t*>(send);
(gdb) s
159 msgs[nmsgs].len = send_len;
(gdb) s
160 nmsgs++;
(gdb) s
163 if (recv && recv_len != 0) {
(gdb)
164 msgs[nmsgs].addr = _address;
(gdb)
165 msgs[nmsgs].flags = I2C_M_RD;
(gdb)
166 msgs[nmsgs].buf = recv;
(gdb)
167 msgs[nmsgs].len = recv_len;
(gdb)
168 nmsgs++;
(gdb)
171 if (!nmsgs) {
(gdb)
175 struct i2c_rdwr_ioctl_data i2c_data = { };
(gdb)
177 i2c_data.msgs = msgs;
(gdb)
178 i2c_data.nmsgs = nmsgs;
(gdb)
180 int r = -EINVAL;
(gdb)
181 unsigned retries = _retries;
(gdb)
183 r = ::ioctl(_bus.fd, I2C_RDWR, &i2c_data);
(gdb)
ioctl () at ../sysdeps/unix/syscall-template.S:81
81 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb)
82 in ../sysdeps/unix/syscall-template.S
(gdb)
Linux::I2CDevice::transfer (this=0x327d00, send=0x7ed783ab "", send_len=1, recv=0x7ed783c4 "\246\203", recv_len=25) at ../../libraries/AP_HAL_Linux/I2CDevice.cpp:184
184 } while (r < 0 && retries-- > 0);
(gdb)
182 do {
(gdb)
186 return r >= 0;
(gdb)
187 }
(gdb)
AP_HAL::Device::read_registers (this=0x327d00, first_reg=0 '\000', recv=0x7ed783c4 "\246\203", recv_len=25) at ../../libraries/AP_HAL/Device.h:81
81 }
(gdb)
AP_OpticalFlow_Linux::read (this=0x327d68, report=0x7ed78440) at ../../libraries/AP_OpticalFlow/AP_OpticalFlow_Linux.cpp:104
104 memcpy(&f_integral, val, I2C_INTEGRAL_FRAME_SIZE);
(gdb) p val
$1 = "\246\203", '\000' <repeats 17 times>, "'\222\f", '\000' <repeats 24 times>
(gdb) bt
#0 AP_OpticalFlow_Linux::read (this=0x327d68, report=0x7ed78440) at ../../libraries/AP_OpticalFlow/AP_OpticalFlow_Linux.cpp:104
#1 0x00134bf4 in AP_OpticalFlow_Linux::update (this=0x327d68) at ../../libraries/AP_OpticalFlow/AP_OpticalFlow_Linux.cpp:153
#2 0x000c18d4 in OpticalFlow::update (this=0x164d58 <copter+5088>) at ../../libraries/AP_OpticalFlow/OpticalFlow.cpp:83
#3 0x0004a4d8 in Copter::update_optical_flow (this=0x163978 <copter>) at ../../ArduCopter/sensors.cpp:135
#4 0x00014d28 in Functor<void>::method_wrapper<Copter, &Copter::update_optical_flow> (obj=0x163978 <copter>) at ../../libraries/AP_HAL/utility/functor.h:85
#5 0x00091d54 in Functor<void>::operator() (this=0x142130 <Copter::scheduler_tasks+60>) at ../../libraries/AP_HAL/utility/functor.h:55
#6 0x000c9018 in AP_Scheduler::run (this=0x163cb0 <copter+824>, time_available=1323) at ../../libraries/AP_Scheduler/AP_Scheduler.cpp:135
#7 0x000139d8 in Copter::loop (this=0x163978 <copter>) at ../../ArduCopter/ArduCopter.cpp:241
#8 0x0011d134 in HAL_Linux::run (this=0x16bf1c <AP_HAL::get_HAL()::hal>, argc=3, argv=0x7ed787d4, callbacks=0x163978 <copter>) at ../../libraries/AP_HAL_Linux/HAL_Linux_Class.cpp:360
#9 0x00014c0c in main (argc=3, argv=0x7ed787d4) at ../../ArduCopter/ArduCopter.cpp:631
FX4Flowの仕様
https://pixhawk.org/modules/px4flow
開始レジスタ0
開始レジスタ 16
// Perform the writing and reading in a single command
if (PX4FLOW_REG == 0x00) {
if (!_dev->read_registers(0, val, I2C_FRAME_SIZE + I2C_INTEGRAL_FRAME_SIZE)) {
goto fail_transfer;
}
memcpy(&f_integral, &(val[I2C_FRAME_SIZE]), I2C_INTEGRAL_FRAME_SIZE);
}
if (PX4FLOW_REG == 0x16) {
if (!_dev->read_registers(0, val, I2C_INTEGRAL_FRAME_SIZE)) {
goto fail_transfer;
}
memcpy(&f_integral, val, I2C_INTEGRAL_FRAME_SIZE);
}
/*
* Core transfer function. This does a single bus transaction which
* sends send_len bytes and receives recv_len bytes back from the slave.
*
* Return: true on a successful transfer, false on failure.
*/
virtual bool transfer(const uint8_t *send, uint32_t send_len,
uint8_t *recv, uint32_t recv_len) = 0;
/**
* Wrapper function over #transfer() to read recv_len registers, starting
* by first_reg, into the array pointed by recv. The read flag passed to
* #set_read_flag(uint8_t) is ORed with first_reg before performing the
* transfer.
*
* Return: true on a successful transfer, false on failure.
*/
bool read_registers(uint8_t first_reg, uint8_t *recv, uint32_t recv_len)
{
first_reg |= _read_flag;
return transfer(&first_reg, 1, recv, recv_len);
}
murata,katsutoshi said:
このことなのかなあ。
とりあえす、GDBで動作を確認してみるとして。。。
デバッグ環境を整えるために、下記を実施。
cd ./work/ardupilot
alias waf="$PWD/modules/waf/waf-light"
waf configure --board=navio2 --debug
waf clean
waf --targets bin/arducopter-hexa
cd /home/pi/work/ardupilot/build/navio2-debug/bin
sudo ./arducopter-hexa -A udp:192.168.0.15:14550 (mac qgroundcontol)
or
sudo ./arducopter-hexa -A udp:192.168.0.25:14550 (Win10 Mission Planner)
別ターミナルで
ps -ax
pi@navio:~ $ ps -ax | grep ./arducopter-hexa
3023 pts/0 S+ 0:00 sudo ./arducopter-hexa -A udp:192.168.0.15:14550
3027 pts/0 SLl+ 47:31 ./arducopter-hexa -A udp:192.168.0.15:14550
3107 pts/1 S+ 0:00 grep --color=auto ./arducopter-hexa
sudo gdb
set target-async 1
set pagination off
set non-stop on
attach 3027
murata,katsutoshi said:
Navio2 で PX4Flow が使えないということを聞きました。
このことでしょうか。
https://community.emlid.com/t/why-doesnt-the-navio-or-navio2-suppor...
とりあえず、FX4Flow のファームウェアのリリース版を書き込んで、カメラテストしました。
フォーカスもちゃんときいていることを確認しました。
ソナーについては、今、未確認にです。
ここは頻繁に呼ばれるところではないので、可読性を優先させたのではないでしょうか?
murata,katsutoshi said: