I am trying edit the code of arducopter according to my needs, but I dont know from where to start. I have downloaded the arducopter and build it in linux, also I have build the SITL, for simulation and debug.
Things I want to do?
I want to change the code, so I can send commands from companion computer to flight controller using UART, but I don’t want to use MAVLINK.
How to compile the code in VSCode, I have error that I can find the necessary libraries.
After editing how to burn my code/custom firmware into the flight controller ?
thanks for reply. Yes I have gone through these documentation, but I was having error while compiling.
ChibiOS build requires g++ version 10.2.1 or later, found 9.3.1
I am not sure how to tackle this. I try to update the version of my gcc but the error remain the same. Also I have tried the following link for compiler.
Section you mention Setting up the Build Environment (Linux/Ubuntu) — Dev documentation only needed if you didn’t run install-prereqs-ubuntu.sh.
From this document: ONLY if you didn’t run the install-prereqs script from the previous step.
And Warning: Do not use this if you have already use the install-prereqs-ubuntu.sh script !
Tools/environment_install/install-prereqs-ubuntu.sh -y Yes I have run this command, but still I get that error. I have gone through all the steps as mention in the link.
I am using ubuntu 20.04, does my error have anything to do with the version of ubuntu ?
./waf configure --board=Pixhawk1
Setting top to : /home/haroon/ardupilot
Setting out to : /home/haroon/ardupilot/build
Autoconfiguration : enabled
Checking for program ‘python’ : /usr/bin/python3
Checking for python version >= 3.6.9 : 3.8.10
Setting board to : Pixhawk1
Using toolchain : arm-none-eabi
Checking for ‘g++’ (C++ compiler) : /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++
Checking for ‘gcc’ (C compiler) : /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc
Checking for program ‘arm-none-eabi-nm’ : /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-nm
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
CXX Compiler : g++ 9.3.1
Checking for program ‘make’ : /usr/bin/make
Checking for program ‘arm-none-eabi-objcopy’ : /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-objcopy
Including /home/haroon/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/fmuv3/hwdef.dat
Removing AP_BATTERY_SMBUS_SOLO_ENABLED
Removing BOARD_CHECK_F427_USE_1M
Setup for MCU STM32F427xx
No default parameter file found
Writing hwdef setup in /home/haroon/ardupilot/build/Pixhawk1/hwdef.h
Writing DMA map
Setting up as normal
No change in hwdef.h
Generating ldscript.ld
Checking for env.py
env set ENABLE_DFU_BOOT=0
env set WITH_FATFS=1
env set PROCESS_STACK=0x1C00
env set MAIN_STACK=0x600
env set IOMCU_FW=0
env set PERIPH_FW=0
env set HAL_NUM_CAN_IFACES=2
env set HAL_CANFD_SUPPORTED=0
env set BOARD_FLASH_SIZE=2048
env set EXT_FLASH_SIZE_MB=0
env set INT_FLASH_PRIMARY=False
env set ENABLE_CRASHDUMP=True
env set CPU_FLAGS=[‘-mcpu=cortex-m4’, ‘-mfpu=fpv4-sp-d16’, ‘-mfloat-abi=hard’, ‘-DARM_MATH_CM4’, ‘-u_printf_float’]
env set CORTEX=cortex-m4
env set APJ_BOARD_ID=9
env set APJ_BOARD_TYPE=STM32F427xx
env set USBID=0x1209/0x5741
env set FLASH_RESERVE_START_KB=16
env set EXT_FLASH_RESERVE_START_KB=0
env set FLASH_TOTAL=2080768
env set HAS_EXTERNAL_FLASH_SECTIONS=0
env set CHIBIOS_BUILD_FLAGS=USE_FATFS=yes CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F4xx/platform.mk MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1
ChibiOS build requires g++ version 10.2.1 or later, found 9.3.1
(complete log in /home/haroon/ardupilot/build/config.log)
There is one more thing that I need to ask, that if I want to send the data from companion computer to flight controller, how can I do that ? https://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html
I read this article which was helpful, but I dont want to use MAVLINK, is there any other way where I can send and receive data only from UART, so I can change ardupilot parameter or perform a command/action?
In order to make my response more fast, I was trying to use UART. Moreover I need onboard processing, I know mavlink also supported onboard processing aswell but, then I have to use other things (mavproxy, ROS etc) I want to cut all the middle things and directly get and send messages.
If you use MAVLink for a companion computer connection it’s commonly connected via serial. I think you’re confusing a high(er) latency MAVLink telemetry connection via radio with a wired serial MAVLink connection.
MAVLink C++ code can be generated from pymavlink.
Then call the generated C++ code from your own code, there is no faster solution than that.
That gives you extremely fast communication over UART especially if you use 1500000 baud…