Autonomous Flight and hovering

Firmware/software/electronics/mechanics
Post Reply
Evan
Beginner
Posts: 10
Joined: Thu Oct 26, 2017 3:04 pm
Location: United States

Autonomous Flight and hovering

Post by Evan »

Hello again!

I want to build a program into the firmware that instructs the crazyflie to take off, stop at a specific height, and then land. I would like to be able to do this without the crazyflie communicating with a control client. To control the height, I have a z-ranger, and I hope to control the position through the on board sensors. Does anyone have any suggestion as to what files to look at to hard code height controls and what files I can edit to include the instructions for flight? If you could point me in the right direction it would really help, since looking at the firmware makes me a little scared. :oops:

Thanks in advance for any assistance! :D
Jens_Lee
Member
Posts: 40
Joined: Sun Nov 19, 2017 8:14 pm

Re: Autonomous Flight and hovering

Post by Jens_Lee »

Hi Evan.

I think you should take a look at this thread: viewtopic.php?f=19&t=2479
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Autonomous Flight and hovering

Post by arnaud »

Hi Evan,

A little while ago I posted an implementation example on the forum: viewtopic.php?f=6&t=2648&p=13352&hilit=demo#p13352. This code will take-off automatically and fly an '8 pattern' using the flow deck.

With only the z-ranger, you will get some drift (you can simulate that by connecting the client and making the drone taking-off without any roll/pich control).

I suggest you try first to control your drone with a python script, this way you can easily debug your sequence before programming it in C in the Crazyflie.
Evan
Beginner
Posts: 10
Joined: Thu Oct 26, 2017 3:04 pm
Location: United States

Re: Autonomous Flight and hovering

Post by Evan »

Hello, Everyone!

First of all thank you very much for your suggestions! I have taken some time to study the example code that Arnaud had in the forum thread that he linked me to, and I feel like I understand much better how the drone can be controlled within the firmware! Thanks! :D Also, to counter drift I tied a string of yarn to the crazyflie to make sure it doesn't walk off on me, and I imbalanced it to fly in one direction just slightly to the left so that it tugs on the string and stays in place! Thanks for the reminder of drift!

After I took some time to study the program, I tried to use Arnaud's code and modify it to just run a simple takeoff and landing procedure, which according to eclipse had no errors. I have unfortunately been unable to test it on the actual drone because I now have a new issue, this being that I cannot get the program to flash using the radio. Every time I try to flash the custom firmware to the crazyflie (after cleaning it, and then building the project and cload successfully), the output in the console says:

make cload
python3 -m cfloader -w radio://0/100/2M/E7E7E7E7E7 flash cf2.bin stm32-fw
Reset to bootloader mode . . .
Failed t owarmboot
make: *** [cload] Error 255

In an attempt to troubleshoot the issue, I removed the edited firmware from my eclipse editor and then returned into the editor the original firmware, and as soon as I do that, the editor is able to flawlessly flash the firmware using the radio, which leads me to believe that of course the issue is somewhere in the code that I edited.

My issue is that I can't figure out what in the code that I edited would cause an issue with the radio. I will include the files that I edited, which include my config.mk (which is located in crazyflie-firmware/tools/make as I am pretty sure it should be), Makefile, and sequence.c, which contains the code that I edited earlier.

sequence.c code:

Code: Select all

/*
 * sequence.c
 *
 *  Created on: Jan 03, 2018
 *      Editor: Swarm team member Evan
 */

/* My intention with this file is to build a timed flight sequence based off
 * a sequence generated by the bitcraze group that is really meant for a timed
 * figure eight flight. I hope that building this will help me to develop a program later
 * on that will be able to utilize sensors to input data and have the drone react.
 */


#include "deck.h"
#include "system.h"
#include "commander.h"

#include "FreeRTOS.h"
#include "task.h"

#include "debug.h"

#define DEBUG_MODULE "SEQ"



static void setHoverSetpoint(setpoint_t*setpoint, float vx, float vy, float z, float yawrate){
	setpoint->mode.z = modeAbs; //set z hover mode I believe.
	setpoint->position.z = z;   //set position of hover. I am not sure as of yet what value.

	setpoint->mode.x = modeVelocity;   			
	setpoint->mode.y = modeVelocity;			
	setpoint->velocity.x = vx;					
	setpoint->velocity.y = vy;					

	setpoint->velocity_body = true;
}

static void sequenceTask(){
	static setpoint_t setpoint;
	int count = 0;

	systemWaitStart();

	vTaskDelay(M2T(3000));
	//DEBUG_PRINT("starting sequence ...\n");

	for (count=0; count< 20; count++){ //takeoff
		setHoverSetpoint(&setpoint,0,0,0.2,0);
		commanderSetSetpoint(&setpoint,3);
		vTaskDelay(M2T(100));
	}

	for (count = 0; count < 20; count++){ //takeoff continued
		setHoverSetpoint(&setpoint,0,0,0.4,0);
		commanderSetSetpoint(&setpoint,3);
		vTaskDelay(M2T(100));
	}

	for (count = 0; count <200; count++){ //this should be the hover time.
		setHoverSetpoint(&setpoint,0,0,0.8,0);
		commanderSetSetpoint(&setpoint,3); // sets priority of function (line 69 in file commander.c)
		vTaskDelay(M2T(100));
	}

	for (count = 0; count < 20; count++){ //begin landing
			setHoverSetpoint(&setpoint,0,0,0.4,0);
			commanderSetSetpoint(&setpoint,3);
			vTaskDelay(M2T(100));
		}

	for (count=0; count< 20; count++){ //gets drone close to the ground for final landing.
			setHoverSetpoint(&setpoint,0,0,0.1,0);
			commanderSetSetpoint(&setpoint,3);
			vTaskDelay(M2T(100));
		}

	while(1){
		vTaskDelay(M2T(100));
	}
}

static void sequenceInit(){
	xTaskCreate(sequenceTask, "sequence", 2*configMINIMAL_STACK_SIZE, NULL,3,NULL);
	/*the number three here is used to indicate priority in the commander manager.
	 */
}

static bool sequenceTest(){
	return true;
}

const DeckDriver sequence_deck = {
		.vid = 0,
		.pid = 0,
		.name = "bcSequence",

		.usedGpio = 0, //FIXME: set the used pins

		.init = sequenceInit,
		.test = sequenceTest,
};

DECK_DRIVER(sequence_deck);
I am pretty sure that my error that is preventing eclipse from flashing the firmware is coming from one of my makefiles, although I could be totally wrong. The only line that I edited in the main makefile is the line where I included sequence.o in the makefile, so I am thinking that my issue likely isn't here, either.

Code in makefile:

Code: Select all

# CrazyFlie's Makefile
# Copyright (c) 2011,2012 Bitcraze AB
# This Makefile compiles all the objet file to ./bin/ and the resulting firmware
# image in ./cfX.elf and ./cfX.bin

# Put your personal build config in tools/make/config.mk and DO NOT COMMIT IT!
# Make a copy of tools/make/config.mk.example to get you started
-include tools/make/config.mk

CFLAGS += $(EXTRA_CFLAGS)

######### JTAG and environment configuration ##########
OPENOCD           ?= openocd
OPENOCD_INTERFACE ?= interface/stlink-v2.cfg
OPENOCD_CMDS      ?=
CROSS_COMPILE     ?= arm-none-eabi-
PYTHON2           ?= python2
DFU_UTIL          ?= dfu-util
CLOAD             ?= 1
DEBUG             ?= 0
CLOAD_SCRIPT      ?= python3 -m cfloader
CLOAD_CMDS        ?=
CLOAD_ARGS        ?=
PLATFORM					?= CF2
LPS_TDMA_ENABLE   ?= 0
LPS_TDOA_ENABLE   ?= 0

######### Stabilizer configuration ##########
##### Sets the name of the stabilizer module to use.
ESTIMATOR          ?= any
CONTROLLER         ?= pid
POWER_DISTRIBUTION ?= stock
SENSORS 					 ?= cf2

######### Test activation ##########
FATFS_DISKIO_TESTS  ?= 0	# Set to 1 to enable FatFS diskio function tests. Erases card.

ifeq ($(PLATFORM), CF2)
OPENOCD_TARGET    ?= target/stm32f4x_stlink.cfg
USE_FPU           ?= 1
endif


ifeq ($(PLATFORM), CF2)
# Now needed for SYSLINK
CFLAGS += -DUSE_RADIOLINK_CRTP     # Set CRTP link to radio
CFLAGS += -DENABLE_UART          # To enable the uart
REV               ?= D
endif

#OpenOCD conf
RTOS_DEBUG        ?= 0

############### Location configuration ################
FREERTOS = src/lib/FreeRTOS
ifeq ($(USE_FPU), 1)
PORT = $(FREERTOS)/portable/GCC/ARM_CM4F
else
PORT = $(FREERTOS)/portable/GCC/ARM_CM3
endif

ifeq ($(PLATFORM), CF2)
LINKER_DIR = tools/make/F405/linker
ST_OBJ_DIR  = tools/make/F405
endif

LIB = src/lib

################ Build configuration ##################
# St Lib
VPATH_CF2 += $(LIB)/CMSIS/STM32F4xx/Source/
VPATH_CF2 += $(LIB)/STM32_USB_Device_Library/Core/src
VPATH_CF2 += $(LIB)/STM32_USB_OTG_Driver/src
VPATH_CF2 += src/deck/api src/deck/core src/deck/drivers/src src/deck/drivers/src/test
CRT0_CF2 = startup_stm32f40xx.o system_stm32f4xx.o

# Should maybe be in separate file?
-include $(ST_OBJ_DIR)/st_obj.mk

# USB obj
ST_OBJ_CF2 += usb_core.o usb_dcd_int.o usb_dcd.o
# USB Device obj
ST_OBJ_CF2 += usbd_ioreq.o usbd_req.o usbd_core.o

# libdw dw1000 driver
VPATH_CF2 += vendor/libdw1000/src

# FreeRTOS
VPATH += $(PORT)
PORT_OBJ = port.o
VPATH +=  $(FREERTOS)/portable/MemMang
MEMMANG_OBJ = heap_4.o

VPATH += $(FREERTOS)
FREERTOS_OBJ = list.o tasks.o queue.o timers.o $(MEMMANG_OBJ)

#FatFS
VPATH_CF2 += $(LIB)/FatFS
FATFS_OBJ  = diskio.o ff.o syscall.o unicode.o fatfs_sd.o
ifeq ($(FATFS_DISKIO_TESTS), 1)
FATFS_OBJ += diskio_function_tests.o
CFLAGS += -DUSD_RUN_DISKIO_FUNCTION_TESTS
endif

# Crazyflie sources
VPATH += src/init src/hal/src src/modules/src src/utils/src src/drivers/bosch/src src/drivers/src
VPATH_CF2 += src/platform/cf2

ifeq ($(PLATFORM), CF2)
VPATH +=$(VPATH_CF2)
endif


############### Source files configuration ################

# Init
PROJ_OBJ += main.o
PROJ_OBJ_CF2 += platform_cf2.o

# Drivers
PROJ_OBJ += exti.o nvic.o motors.o
PROJ_OBJ_CF2 += led_f405.o mpu6500.o i2cdev_f405.o ws2812_cf2.o lps25h.o i2c_drv.o
PROJ_OBJ_CF2 += ak8963.o eeprom.o maxsonar.o piezo.o
PROJ_OBJ_CF2 += uart_syslink.o swd.o uart1.o uart2.o watchdog.o
PROJ_OBJ_CF2 += cppm.o
PROJ_OBJ_CF2 += bmi055_accel.o bmi055_gyro.o bmi160.o bmp280.o bstdr_comm_support.o bmm150.o
PROJ_OBJ_CF2 += pca9685.o vl53l0x.o pca95x4.o
# USB Files
PROJ_OBJ_CF2 += usb_bsp.o usblink.o usbd_desc.o usb.o

# Hal
PROJ_OBJ += crtp.o ledseq.o freeRTOSdebug.o buzzer.o
PROJ_OBJ_CF2 +=  pm_f405.o syslink.o radiolink.o ow_syslink.o proximity.o usec_time.o

PROJ_OBJ_CF2 +=  sensors_$(SENSORS).o
# libdw
PROJ_OBJ_CF2 += libdw1000.o libdw1000Spi.o

# Modules
PROJ_OBJ += system.o comm.o console.o pid.o crtpservice.o param.o
PROJ_OBJ += log.o worker.o trigger.o sitaw.o queuemonitor.o msp.o
PROJ_OBJ_CF2 += platformservice.o sound_cf2.o extrx.o sysload.o mem_cf2.o

# Stabilizer modules
PROJ_OBJ += commander.o crtp_commander.o crtp_commander_rpyt.o
PROJ_OBJ += crtp_commander_generic.o crtp_localization_service.o
PROJ_OBJ += attitude_pid_controller.o sensfusion6.o stabilizer.o
PROJ_OBJ += position_estimator_altitude.o position_controller_pid.o
PROJ_OBJ += estimator.o estimator_complementary.o
PROJ_OBJ += controller_$(CONTROLLER).o
PROJ_OBJ += power_distribution_$(POWER_DISTRIBUTION).o
PROJ_OBJ_CF2 += estimator_kalman.o


# Deck Core
PROJ_OBJ_CF2 += deck.o deck_info.o deck_drivers.o deck_test.o

# Deck API
PROJ_OBJ_CF2 += deck_constants.o
PROJ_OBJ_CF2 += deck_digital.o
PROJ_OBJ_CF2 += deck_analog.o
PROJ_OBJ_CF2 += deck_spi.o

# Decks
PROJ_OBJ_CF2 += bigquad.o
PROJ_OBJ_CF2 += rzr.o
PROJ_OBJ_CF2 += ledring12.o
PROJ_OBJ_CF2 += buzzdeck.o
PROJ_OBJ_CF2 += gtgps.o
PROJ_OBJ_CF2 += cppmdeck.o
PROJ_OBJ_CF2 += usddeck.o
PROJ_OBJ_CF2 += zranger.o
PROJ_OBJ_CF2 += locodeck.o
PROJ_OBJ_CF2 += lpsTwrTag.o
PROJ_OBJ_CF2 += flowdeck.o
PROJ_OBJ_CF2 += oa.o
PROJ_OBJ_CF2 += sequence.o #edited line in makefile

ifeq ($(LPS_TDOA_ENABLE), 1)
PROJ_OBJ_CF2 += lpsTdoaTag.o
CFLAGS += -DLPS_TDOA_ENABLE
endif

ifeq ($(LPS_TDMA_ENABLE), 1)
CFLAGS += -DLPS_TDMA_ENABLE
endif

#Deck tests
PROJ_OBJ_CF2 += exptest.o
#PROJ_OBJ_CF2 += bigquadtest.o


# Utilities
PROJ_OBJ += filter.o cpuid.o cfassert.o  eprintf.o crc.o num.o debug.o
PROJ_OBJ += version.o FreeRTOS-openocd.o
PROJ_OBJ_CF2 += configblockeeprom.o crc_bosch.o
PROJ_OBJ_CF2 += sleepus.o

# Libs
PROJ_OBJ_CF2 += libarm_math.a

OBJ = $(FREERTOS_OBJ) $(PORT_OBJ) $(ST_OBJ) $(PROJ_OBJ)
ifeq ($(PLATFORM), CF2)
OBJ += $(CRT0_CF2) $(ST_OBJ_CF2) $(FATFS_OBJ) $(PROJ_OBJ_CF2)
endif

ifdef P
  C_PROFILE = -D P_$(P)
endif

############### Compilation configuration ################
AS = $(CROSS_COMPILE)as
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
OBJCOPY = $(CROSS_COMPILE)objcopy
GDB = $(CROSS_COMPILE)gdb

INCLUDES  = -I$(FREERTOS)/include -I$(PORT) -Isrc
INCLUDES += -Isrc/config -Isrc/hal/interface -Isrc/modules/interface
INCLUDES += -Isrc/utils/interface -Isrc/drivers/interface -Isrc/platform
INCLUDES += -Ivendor/CMSIS/CMSIS/Include -Isrc/drivers/bosch/interface

INCLUDES_CF2 += -I$(LIB)/STM32F4xx_StdPeriph_Driver/inc
INCLUDES_CF2 += -I$(LIB)/CMSIS/STM32F4xx/Include
INCLUDES_CF2 += -I$(LIB)/STM32_USB_Device_Library/Core/inc
INCLUDES_CF2 += -I$(LIB)/STM32_USB_OTG_Driver/inc
INCLUDES_CF2 += -Isrc/deck/interface -Isrc/deck/drivers/interface
INCLUDES_CF2 += -Ivendor/libdw1000/inc
INCLUDES_CF2 += -I$(LIB)/FatFS

ifeq ($(USE_FPU), 1)
	PROCESSOR = -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
	CFLAGS += -fno-math-errno -DARM_MATH_CM4 -D__FPU_PRESENT=1 -D__TARGET_FPU_VFP
else
	ifeq ($(PLATFORM), CF2)
		PROCESSOR = -mcpu=cortex-m4 -mthumb
	endif
endif

#Flags required by the ST library
STFLAGS_CF2 = -DSTM32F4XX -DSTM32F40_41xxx -DHSE_VALUE=8000000 -DUSE_STDPERIPH_DRIVER

ifeq ($(DEBUG), 1)
  CFLAGS += -O0 -g3 -DDEBUG
else
	# Fail on warnings
  CFLAGS += -Os -g3 -Werror
endif

ifeq ($(LTO), 1)
  CFLAGS += -flto
endif

ifeq ($(USE_ESKYLINK), 1)
  CFLAGS += -DUSE_ESKYLINK
endif

CFLAGS += -DBOARD_REV_$(REV) -DESTIMATOR_NAME=$(ESTIMATOR)Estimator -DCONTROLLER_TYPE_$(CONTROLLER) -DPOWER_DISTRIBUTION_TYPE_$(POWER_DISTRIBUTION)

CFLAGS += $(PROCESSOR) $(INCLUDES) $(STFLAGS)
ifeq ($(PLATFORM), CF2)
CFLAGS += $(INCLUDES_CF2) $(STFLAGS_CF2)
endif

CFLAGS += -Wall -Wmissing-braces -fno-strict-aliasing $(C_PROFILE) -std=gnu11
# Compiler flags to generate dependency files:
CFLAGS += -MD -MP -MF $(BIN)/dep/$(@).d -MQ $(@)
#Permits to remove un-used functions and global variables from output file
CFLAGS += -ffunction-sections -fdata-sections
# Prevent promoting floats to doubles
CFLAGS += -Wdouble-promotion


ASFLAGS = $(PROCESSOR) $(INCLUDES)
LDFLAGS = --specs=nano.specs $(PROCESSOR) -Wl,-Map=$(PROG).map,--cref,--gc-sections,--undefined=uxTopUsedPriority

#Flags required by the ST library
ifeq ($(CLOAD), 1)
  LDFLAGS += -T $(LINKER_DIR)/FLASH_CLOAD.ld
  LOAD_ADDRESS = 0x8004000
else
  LDFLAGS += -T $(LINKER_DIR)/FLASH.ld
  LOAD_ADDRESS = 0x8000000
endif

ifeq ($(LTO), 1)
  LDFLAGS += -Os -flto -fuse-linker-plugin
endif

#Program name
PROG = cf2
#Where to compile the .o
BIN = bin
VPATH += $(BIN)

#Dependency files to include
DEPS := $(foreach o,$(OBJ),$(BIN)/dep/$(o).d)

##################### Misc. ################################
ifeq ($(SHELL),/bin/sh)
  COL_RED=\033[1;31m
  COL_GREEN=\033[1;32m
  COL_RESET=\033[m
endif

#################### Targets ###############################


all: check_submodules build
build: clean_version compile print_version size
compile: clean_version $(PROG).hex $(PROG).bin $(PROG).dfu

libarm_math.a:
	+$(MAKE) -C tools/make/cmsis_dsp/ V=$(V)

clean_version:
ifeq ($(SHELL),/bin/sh)
	@echo "  CLEAN_VERSION"
	@rm -f version.c
endif

print_version: compile
ifeq ($(PLATFORM), CF2)
	@echo "Crazyflie 2.0 build!"
endif
	@$(PYTHON2) tools/make/versionTemplate.py --print-version
ifeq ($(CLOAD), 1)
	@echo "Crazyloader build!"
endif
ifeq ($(FATFS_DISKIO_TESTS), 1)
	@echo "WARNING: FatFS diskio tests enabled. Erases SD-card!"
endif

size: compile
	@$(SIZE) -B $(PROG).elf

#Radio bootloader
cload:
ifeq ($(CLOAD), 1)
	$(CLOAD_SCRIPT) $(CLOAD_CMDS) flash $(CLOAD_ARGS) $(PROG).bin stm32-fw
else
	@echo "Only cload build can be bootloaded. Launch build and cload with CLOAD=1"
endif

#Flash the stm.
flash:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset halt" \
                 -c "flash write_image erase $(PROG).elf" -c "verify_image $(PROG).elf" -c "reset run" -c shutdown

flash_dfu:
	$(DFU_UTIL) -a 0 -D $(PROG).dfu

#STM utility targets
halt:
	$(OPENOCD) -d0 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "halt" -c shutdown

reset:
	$(OPENOCD) -d0 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "reset" -c shutdown

openocd:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -c "\$$_TARGETNAME configure -rtos auto"

trace:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) $(OPENOCD_CMDS) -f $(OPENOCD_TARGET) -c init -c targets -f tools/trace/enable_trace.cfg

gdb: $(PROG).elf
	$(GDB) -ex "target remote localhost:3333" -ex "monitor reset halt" $^

erase:
	$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets -c "halt" -c "stm32f4x mass_erase 0" -c shutdown

#Print preprocessor #defines
prep:
	@$(CC) $(CFLAGS) -dM -E - < /dev/null

check_submodules:
	@$(PYTHON2) tools/make/check-for-submodules.py

include tools/make/targets.mk

#include dependencies
-include $(DEPS)

unit:
	rake unit "DEFINES=$(CFLAGS)" "FILES=$(FILES)"
Because of a couple of threads on the forums that I read, I am thinking that my error may be in my config.mk file. I kept having issues when I initially implemented the line :

Code: Select all

CFLAGS += -DDECK_FORCE=bcSequence
due to another file using the -DDECK_FORCE initialization, and two as far as I was able to understand from the thread at viewtopic.php?f=6&t=2791 was that as of yet adding another -DDECK_FORCE to the config.mk isn't quite flawlessly possible yet, so instead I deleted the line

Code: Select all

CFLAGS += -DDECK_FORCE=bcBuzzer
and replaced it with the line forcing bcSequence.
Here is the code in my config.mk file:

Code: Select all

## Set CRTP link to E-SKY receiver
 CFLAGS += -DUSE_ESKYLINK

## Redirect the console output to the UART
 CFLAGS += -DDEBUG_PRINT_ON_UART

## Load a deck driver that has no OW memory
 CFLAGS += -DDECK_FORCE=bcSequence

## Enable biq quad deck features
 CFLAGS += -DENABLE_BQ_DECK
 CFLAGS += -DBQ_DECK_ENABLE_PM
 CFLAGS += -DBQ_DECK_ENABLE_OSD

## Use morse when flashing the LED to indicate that the Crazyflie is calibrated
 CFLAGS += -DCALIBRATED_LED_MORSE

## Turn on monitoring of queue usages
 CFLAGS += -DDEBUG_QUEUE_MONITOR

## Automatically reboot to bootloader before flashing
 CLOAD_CMDS = -w radio://0/100/2M/E7E7E7E7E7

## Set number of anchor in LocoPositioningSystem
 CFLAGS += -DLOCODECK_NR_OF_ANCHORS=8

## Set alternative pins for LOCO deck (IRQ=IO_2, RESET=IO_3, default are RX1 and TX1)
 CFLAGS += -DLOCODECK_USE_ALT_PINS

## Compile positioning system for TDoA mode
 LPS_TDOA_ENABLE=1
Thank you guys for the assistance you've given me! And thanks in advance for looking at this and any help you can provide! :D Also, I'm sorry if this is all a really stupid question since I'm still pretty new to the crazyflie :roll: . Thanks for taking questions like these and helping us newbies along!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Autonomous Flight and hovering

Post by arnaud »

Hi,

Do you really want to enable all those options in config.mk? It seems to me that your config.mk should look like that:

Code: Select all

CFLAGS += -DDECK_FORCE=bcSequence
The flash error comes from the cload command line option in your config.mk (the CLOAD_CMDS variable). If you remove (or comment) all the lines you do not need in config.mk, flashing will work. There is virtually nothing you can modify in the C code that would affect flashing your code (unless the code does not compile of course, then there is nothing to flash).

Otherwise, a quick look at your code and the makefile looks good :-). I am not so familiar with the Eclipse target setting, but typing "make && make cload" when the Crazyflie is in bootloader should work for flashing your software.
Evan
Beginner
Posts: 10
Joined: Thu Oct 26, 2017 3:04 pm
Location: United States

Re: Autonomous Flight and hovering

Post by Evan »

Hello!

Arnaud, thank you so very much for your assistance! This process has helped me so much to learn a bunch about what is going on with the firmware in the crazyflie. Our drone now can hover on its own, and we can flash the custom firmware using the eclipse ide. We will soon start working on an ultrasonic replacement for the zranger with the Maxbotics MaxSonar range finder so that we can place the faster and more accurate zranger on the side to act as sensing for collision avoidance.

And of course I am sure I will still have questions about the crazyflie as I go along, so I thank you both now and in advance for the assistance we will receive from you guys! Thank you once again! Have an excellent day!

-Evan
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Autonomous Flight and hovering

Post by arnaud »

Awesome and thanks for your message :).

Good luck and do not hesitate if you have further questions. There is a MaxSonar driver in the Crazyflie that you might be able to use: https://github.com/bitcraze/crazyflie-f ... maxsonar.c. I am not entirely sure how to use it though (it seems to be used in proximity.c).
Post Reply