Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Trent Lukaczyk
2015-01-31 15:00:16 -08:00
407 changed files with 35507 additions and 9715 deletions
+3
View File
@@ -38,3 +38,6 @@ tags
.pydevproject
.ropeproject
*.orig
Firmware.zip
unittests/build
*.generated.h
+4 -1
View File
@@ -5,5 +5,8 @@
path = NuttX
url = git://github.com/PX4/NuttX.git
[submodule "uavcan"]
path = uavcan
path = src/lib/uavcan
url = git://github.com/pavel-kirienko/uavcan.git
[submodule "unittests/gtest"]
path = unittests/gtest
url = https://github.com/sjwilks/gtest.git
+84
View File
@@ -0,0 +1,84 @@
# Build and autotest script for PX4 Firmware
# http://travis-ci.org
language: cpp
before_script:
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8 gcc-4.8 libstdc++-4.8-dev; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
# Travis specific tools
- sudo apt-get install s3cmd grep zip mailutils
# General toolchain dependencies
- sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386
- sudo apt-get install python-serial python-argparse
- sudo apt-get install flex bison libncurses5-dev autoconf texinfo build-essential libtool zlib1g-dev genromfs git wget cmake
- pushd .
- cd ~
- wget https://launchpadlibrarian.net/174121628/gcc-arm-none-eabi-4_7-2014q2-20140408-linux.tar.bz2
- tar -jxf gcc-arm-none-eabi-4_7-2014q2-20140408-linux.tar.bz2
- exportline="export PATH=$HOME/gcc-arm-none-eabi-4_7-2014q2/bin:\$PATH"
- if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
- . ~/.profile
- popd
git:
depth: 500
env:
global:
# AWS KEY: $PX4_AWS_KEY
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
# AWS SECRET: $PX4_AWS_SECRET
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
- PX4_AWS_BUCKET=px4-travis
- PX4_EMAIL_SUBJECT="Travis CI result"
# Email address: $PX4_EMAIL
- secure: "ei3hKAw6Pk+vEkQBI5Y2Ak74BRAaXcK2UHVnVadviBHI4EVPwn1YGP6A4Y0wnLe4U7ETTl0UiijRoVxyDW0Mq896Pv0siw02amNpjSZZYu+RfN1+//MChB48OxsLDirUdHVrULhl/bOARM02h2Bg28jDE2g7IqmJwg3em3oMbjU="
- PX4_REPORT=report.txt
script:
- arm-none-eabi-gcc --version
- echo 'Running Tests..' && echo -en 'travis_fold:start:script.1\\r'
- make tests
- cat src/modules/systemlib/mixer/mixer_multirotor.generated.h
- echo -en 'travis_fold:end:script.1\\r'
- echo 'Building NuttX..' && echo -en 'travis_fold:start:script.2\\r'
- make archives
- echo -en 'travis_fold:end:script.2\\r'
- echo 'Building Firmware..' && echo -en 'travis_fold:start:script.3\\r'
- make -j6
- echo -en 'travis_fold:end:script.3\\r'
- zip Firmware.zip Images/*.px4
after_script:
- git clone git://github.com/PX4/CI-Tools.git
- ./CI-Tools/s3cmd-configure
# upload newest build for this branch with s3 index
- ./CI-Tools/s3cmd-put Images/px4*.px4 CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/
# archive newest build by date with s3 index
- ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/`date "+%Y-%m-%d"`-$TRAVIS_BUILD_ID/
- ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/
# upload top level index.html and timestamp.html
- ./CI-Tools/s3cmd-put CI-Tools/index.html index.html
- ./CI-Tools/s3cmd-put CI-Tools/timestamp.html timestamp.html
deploy:
provider: releases
api_key:
secure: cdHWLRBxA5UlYpOS0Sp891QK7PFmMgQ5ZWs1aPt+sw0rIrowyWMHCwXNBEdUqaExHYNYgXCUDI0EzNgfB7ZcR63Qv1MQeoyamV4jsxlyAqDqmxNtWO82S6RhHGeMLk26VgFKzynVcEk1IYlQP2nqzMQLdu+jTrngERuAIrCdRuc=
file: "Firmware.zip"
skip_cleanup: true
on:
tags: true
all_branches: true
repo: PX4/Firmware
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/2b9c4a4cb2211f8befba
on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
+2 -2
View File
@@ -16,7 +16,7 @@ git checkout -b mydescriptivebranchname
### Edit and build the code
The [developer guide](http://pixhawk.org/dev/start) explains how to set up the development environment on Mac OS, Linux or Windows. Please take note of our [coding style](http://pixhawk.org/dev/code_style) when editing files.
The [developer guide](http://px4.io/dev/start) explains how to set up the development environment on Mac OS, Linux or Windows. Please take note of our [coding style](http://px4.io/dev/code_style) when editing files.
### Commit your changes
@@ -41,4 +41,4 @@ Since we care about safety, we will regularly ask you for test results. Best is
Push changes to your repo and send a [pull request](https://github.com/PX4/Firmware/compare/).
Make sure to provide some testing feedback and if possible the link to a flight log file.
Make sure to provide some testing feedback and if possible the link to a flight log file. Upload flight log files to [Log Muncher](http://dash.oznet.ch) and link the resulting report.
+3 -2
View File
@@ -178,9 +178,10 @@ define showtaskstack
printf "can't measure idle stack\n"
else
set $stack_free = 0
while ($stack_free < $task->adj_stack_size) && *(uint8_t *)($task->stack_alloc_ptr + $stack_free)
while ($stack_free < $task->adj_stack_size) && ((uint32_t *)($task->stack_alloc_ptr))[$stack_free] == 0xffffffff
set $stack_free = $stack_free + 1
end
set $stack_free = $stack_free * 4
printf" stack 0x%08x-0x%08x (%d) %d free\n", $task->stack_alloc_ptr, $task->adj_stack_ptr, $task->adj_stack_size, $stack_free
end
end
@@ -278,4 +279,4 @@ define my_mem
set $cursor = $cursor - 4
end
end
end
end
+39 -49
View File
@@ -1,7 +1,10 @@
# GDB/Python functions for dealing with NuttX
from __future__ import print_function
import gdb, gdb.types
parse_int = lambda x: int(str(x), 0)
class NX_register_set(object):
"""Copy of the registers for a given context"""
@@ -155,7 +158,7 @@ class NX_task(object):
result = []
for i in range(pidhash_type.range()[0],pidhash_type.range()[1]):
entry = pidhash_value[i]
pid = int(entry['pid'])
pid = parse_int(entry['pid'])
if pid is not -1:
result.append(pid)
return result
@@ -184,7 +187,7 @@ class NX_task(object):
self.__dict__['stack_used'] = 0
else:
stack_limit = self._tcb['adj_stack_size']
for offset in range(0, int(stack_limit)):
for offset in range(0, parse_int(stack_limit)):
if stack_base[offset] != 0xff:
break
self.__dict__['stack_used'] = stack_limit - offset
@@ -244,7 +247,7 @@ class NX_task(object):
filearray = filelist['fl_files']
result = dict()
for i in range(filearray.type.range()[0],filearray.type.range()[1]):
inode = int(filearray[i]['f_inode'])
inode = parse_int(filearray[i]['f_inode'])
if inode != 0:
result[i] = inode
return result
@@ -299,7 +302,7 @@ class NX_show_task (gdb.Command):
super(NX_show_task, self).__init__("show task", gdb.COMMAND_USER)
def invoke(self, arg, from_tty):
t = NX_task.for_pid(int(arg))
t = NX_task.for_pid(parse_int(arg))
if t is not None:
my_fmt = 'PID:{pid} name:{name} state:{state}\n'
my_fmt += ' stack used {stack_used} of {stack_limit}\n'
@@ -435,12 +438,12 @@ class NX_tcb(object):
first_tcb = tcb_ptr.dereference()
tcb_list.append(first_tcb);
next_tcb = first_tcb['flink'].dereference()
while not self.is_in(int(next_tcb['pid']),[int(t['pid']) for t in tcb_list]):
while not self.is_in(parse_int(next_tcb['pid']),[parse_int(t['pid']) for t in tcb_list]):
tcb_list.append(next_tcb);
old_tcb = next_tcb;
next_tcb = old_tcb['flink'].dereference()
return [t for t in tcb_list if int(t['pid'])<2000]
return [t for t in tcb_list if parse_int(t['pid'])<2000]
def getTCB(self):
list_of_listsnames = ['g_pendingtasks','g_readytorun','g_waitingforsemaphore','g_waitingforsignal','g_inactivetasks']
@@ -469,12 +472,12 @@ class NX_check_stack_order(gdb.Command):
first_tcb = tcb_ptr.dereference()
tcb_list.append(first_tcb);
next_tcb = first_tcb['flink'].dereference()
while not self.is_in(int(next_tcb['pid']),[int(t['pid']) for t in tcb_list]):
while not self.is_in(parse_int(next_tcb['pid']),[parse_int(t['pid']) for t in tcb_list]):
tcb_list.append(next_tcb);
old_tcb = next_tcb;
next_tcb = old_tcb['flink'].dereference()
return [t for t in tcb_list if int(t['pid'])<2000]
return [t for t in tcb_list if parse_int(t['pid'])<2000]
def getTCB(self):
list_of_listsnames = ['g_pendingtasks','g_readytorun','g_waitingforsemaphore','g_waitingforsignal','g_inactivetasks']
@@ -488,7 +491,7 @@ class NX_check_stack_order(gdb.Command):
def getSPfromTask(self,tcb):
regmap = NX_register_set.v7em_regmap
a =tcb['xcp']['regs']
return int(a[regmap['SP']])
return parse_int(a[regmap['SP']])
def find_closest(self,list,val):
tmp_list = [abs(i-val) for i in list]
@@ -525,8 +528,8 @@ class NX_check_stack_order(gdb.Command):
for t in tcb:
p = [];
#print(t.name,t._tcb['stack_alloc_ptr'])
p.append(int(t['stack_alloc_ptr']))
p.append(int(t['adj_stack_ptr']))
p.append(parse_int(t['stack_alloc_ptr']))
p.append(parse_int(t['adj_stack_ptr']))
p.append(self.getSPfromTask(t))
stackadresses[str(t['name'])] = p;
address = int("0x30000000",0)
@@ -594,12 +597,12 @@ class NX_search_tcb(gdb.Command):
first_tcb = tcb_ptr.dereference()
tcb_list.append(first_tcb);
next_tcb = first_tcb['flink'].dereference()
while not self.is_in(int(next_tcb['pid']),[int(t['pid']) for t in tcb_list]):
while not self.is_in(parse_int(next_tcb['pid']),[parse_int(t['pid']) for t in tcb_list]):
tcb_list.append(next_tcb);
old_tcb = next_tcb;
next_tcb = old_tcb['flink'].dereference()
return [t for t in tcb_list if int(t['pid'])<2000]
return [t for t in tcb_list if parse_int(t['pid'])<2000]
def invoke(self,args,sth):
list_of_listsnames = ['g_pendingtasks','g_readytorun','g_waitingforsemaphore','g_waitingforsignal','g_inactivetasks']
@@ -612,7 +615,7 @@ class NX_search_tcb(gdb.Command):
# filter for tasks that are listed twice
tasks_filt = {}
for t in tasks:
pid = int(t['pid']);
pid = parse_int(t['pid']);
if not pid in tasks_filt.keys():
tasks_filt[pid] = t['name'];
print('{num_t} Tasks found:'.format(num_t = len(tasks_filt)))
@@ -653,62 +656,49 @@ class NX_my_bt(gdb.Command):
tcb_ptr = addr_value.cast(gdb.lookup_type('struct tcb_s').pointer())
return tcb_ptr.dereference()
def print_instruction_at(self,addr,stack_percentage):
def resolve_file_line_func(self,addr,stack_percentage):
gdb.write(str(round(stack_percentage,2))+":")
str_to_eval = "info line *"+hex(addr)
#gdb.execute(str_to_eval)
res = gdb.execute(str_to_eval,to_string = True)
# get information from results string:
words = res.split()
valid = False
if words[0] == 'No':
#no line info...
pass
else:
valid = True
if words[0] != 'No':
line = int(words[1])
idx = words[3].rfind("/"); #find first backslash
if idx>0:
name = words[3][idx+1:];
path = words[3][:idx];
else:
name = words[3];
path = "";
block = gdb.block_for_pc(addr)
func = block.function
if str(func) == "None":
func = block.superblock.function
if valid:
print("Line: ",line," in ",path,"/",name,"in ",func)
return name,path,line,func
return words[3].strip('"'), line, func
def invoke(self,args,sth):
addr_dec = int(args[2:],16)
_tcb = self.get_tcb_from_address(addr_dec)
try:
addr_dec = parse_int(args) # Trying to interpret the input as TCB address
except ValueError:
for task in NX_task.tasks(): # Interpreting as a task name
if task.name == args:
_tcb = task._tcb
break
else:
_tcb = self.get_tcb_from_address(addr_dec)
print("found task with PID: ",_tcb["pid"])
up_stack = int(_tcb['adj_stack_ptr'])
curr_sp = int(_tcb['xcp']['regs'][0]) #curr stack pointer
other_sp = int(_tcb['xcp']['regs'][8]) # other stack pointer
stacksize = int(_tcb['adj_stack_size']) # other stack pointer
up_stack = parse_int(_tcb['adj_stack_ptr'])
curr_sp = parse_int(_tcb['xcp']['regs'][0]) #curr stack pointer
other_sp = parse_int(_tcb['xcp']['regs'][8]) # other stack pointer
stacksize = parse_int(_tcb['adj_stack_size']) # other stack pointer
print("tasks current SP = ",hex(curr_sp),"stack max ptr is at ",hex(up_stack))
if curr_sp == up_stack:
sp = other_sp
else:
sp = curr_sp;
while(sp < up_stack):
item = 0
for sp in range(other_sp if curr_sp == up_stack else curr_sp, up_stack, 4):
mem = self.readmem(sp)
#print(hex(sp)," : ",hex(mem))
if self.is_in_bounds(mem):
# this is a potential instruction ptr
stack_percentage = (up_stack-sp)/stacksize
name,path,line,func = self.print_instruction_at(mem,stack_percentage)
sp = sp + 4; # jump up one word
filename,line,func = self.resolve_file_line_func(mem, stack_percentage)
print('#%-2d ' % item, '0x%08x in ' % mem, func, ' at ', filename, ':', line, sep='')
item += 1
NX_my_bt()
+260
View File
@@ -0,0 +1,260 @@
#!/bin/bash
#
# Poor man's sampling profiler for NuttX.
#
# Usage: Install flamegraph.pl in your PATH, configure your .gdbinit, run the script with proper arguments and go
# have a coffee. When you're back, you'll see the flamegraph. Note that frequent calls to GDB significantly
# interfere with normal operation of the target, which means that you can't profile real-time tasks with it.
#
# Requirements: ARM GDB with Python support
#
set -e
root=$(dirname $0)/..
function die()
{
echo "$@"
exit 1
}
function usage()
{
echo "Invalid usage. Supported options:"
cat $0 | sed -n 's/^\s*--\([^)\*]*\).*/\1/p' # Don't try this at home.
exit 1
}
which flamegraph.pl > /dev/null || die "Install flamegraph.pl first"
#
# Parsing the arguments. Read this section for usage info.
#
nsamples=0
sleeptime=0.1 # Doctors recommend 7-8 hours a day
taskname=
elf=$root/Build/px4fmu-v2_default.build/firmware.elf
append=0
fgfontsize=10
fgwidth=1900
for i in "$@"
do
case $i in
--nsamples=*)
nsamples="${i#*=}"
;;
--sleeptime=*)
sleeptime="${i#*=}"
;;
--taskname=*)
taskname="${i#*=}"
;;
--elf=*)
elf="${i#*=}"
;;
--append)
append=1
;;
--fgfontsize=*)
fgfontsize="${i#*=}"
;;
--fgwidth=*)
fgwidth="${i#*=}"
;;
*)
usage
;;
esac
shift
done
#
# Temporary files
#
stacksfile=/tmp/pmpn-stacks.log
foldfile=/tmp/pmpn-folded.txt
graphfile=/tmp/pmpn-flamegraph.svg
gdberrfile=/tmp/pmpn-gdberr.log
#
# Sampling if requested. Note that if $append is true, the stack file will not be rewritten.
#
cd $root
if [[ $nsamples > 0 ]]
then
[[ $append = 0 ]] && (rm -f $stacksfile; echo "Old stacks removed")
echo "Sampling the task '$taskname'..."
for x in $(seq 1 $nsamples)
do
if [[ "$taskname" = "" ]]
then
arm-none-eabi-gdb $elf --batch -ex "set print asm-demangle on" -ex bt \
2> $gdberrfile \
| sed -n 's/\(#.*\)/\1/p' \
>> $stacksfile
else
arm-none-eabi-gdb $elf --batch -ex "set print asm-demangle on" \
-ex "source $root/Debug/Nuttx.py" \
-ex "show mybt $taskname" \
2> $gdberrfile \
| sed -n 's/0\.0:\(#.*\)/\1/p' \
>> $stacksfile
fi
echo -e '\n\n' >> $stacksfile
echo -ne "\r$x/$nsamples"
sleep $sleeptime
done
echo
echo "Stacks saved to $stacksfile"
else
echo "Sampling skipped - set 'nsamples' to re-sample."
fi
#
# Folding the stacks.
#
[ -f $stacksfile ] || die "Where are the stack samples?"
cat << 'EOF' > /tmp/pmpn-folder.py
#
# This stack folder correctly handles C++ types.
#
from __future__ import print_function, division
import fileinput, collections, os, sys
def enforce(x, msg='Invalid input'):
if not x:
raise Exception(msg)
def split_first_part_with_parens(line):
LBRACES = {'(':'()', '<':'<>', '[':'[]', '{':'{}'}
RBRACES = {')':'()', '>':'<>', ']':'[]', '}':'{}'}
QUOTES = set(['"', "'"])
quotes = collections.defaultdict(bool)
braces = collections.defaultdict(int)
out = ''
for ch in line:
out += ch
# escape character cancels further processing
if ch == '\\':
continue
# special cases
if out.endswith('operator>') or out.endswith('operator>>') or out.endswith('operator->'): # gotta love c++
braces['<>'] += 1
if out.endswith('operator<') or out.endswith('operator<<'):
braces['<>'] -= 1
# switching quotes
if ch in QUOTES:
quotes[ch] = not quotes[ch]
# counting parens only when outside quotes
if sum(quotes.values()) == 0:
if ch in LBRACES.keys():
braces[LBRACES[ch]] += 1
if ch in RBRACES.keys():
braces[RBRACES[ch]] -= 1
# sanity check
for v in braces.values():
enforce(v >= 0, 'Unaligned braces: ' + str(dict(braces)))
# termination condition
if ch == ' ' and sum(braces.values()) == 0:
break
out = out.strip()
return out, line[len(out):]
def parse(line):
def take_path(line, output):
line = line.strip()
if line.startswith('at '):
line = line[3:].strip()
if line:
output['file_full_path'] = line.rsplit(':', 1)[0].strip()
output['file_base_name'] = os.path.basename(output['file_full_path'])
output['line'] = int(line.rsplit(':', 1)[1])
return output
def take_args(line, output):
line = line.lstrip()
if line[0] == '(':
output['args'], line = split_first_part_with_parens(line)
return take_path(line.lstrip(), output)
def take_function(line, output):
output['function'], line = split_first_part_with_parens(line.lstrip())
return take_args(line.lstrip(), output)
def take_mem_loc(line, output):
line = line.lstrip()
if line.startswith('0x'):
end = line.find(' ')
num = line[:end]
output['memloc'] = int(num, 16)
line = line[end:].lstrip()
end = line.find(' ')
enforce(line[:end] == 'in')
line = line[end:].lstrip()
return take_function(line, output)
def take_frame_num(line, output):
line = line.lstrip()
enforce(line[0] == '#')
end = line.find(' ')
num = line[1:end]
output['frame_num'] = int(num)
return take_mem_loc(line[end:], output)
return take_frame_num(line, {})
stacks = collections.defaultdict(int)
current = ''
stack_tops = collections.defaultdict(int)
num_stack_frames = 0
for idx,line in enumerate(fileinput.input()):
try:
line = line.strip()
if line:
inf = parse(line)
fun = inf['function']
current = (fun + ';' + current) if current else fun
if inf['frame_num'] == 0:
num_stack_frames += 1
stack_tops[fun] += 1
elif current:
stacks[current] += 1
current = ''
except Exception, ex:
print('ERROR (line %d):' % (idx + 1), ex, file=sys.stderr)
for s, f in sorted(stacks.items(), key=lambda (s, f): s):
print(s, f)
print('Total stack frames:', num_stack_frames, file=sys.stderr)
print('Top consumers (distribution of the stack tops):', file=sys.stderr)
for name,num in sorted(stack_tops.items(), key=lambda (name, num): num, reverse=True)[:10]:
print('% 5.1f%% ' % (100 * num / num_stack_frames), name, file=sys.stderr)
EOF
cat $stacksfile | python /tmp/pmpn-folder.py > $foldfile
echo "Folded stacks saved to $foldfile"
#
# Graphing.
#
cat $foldfile | flamegraph.pl --fontsize=$fgfontsize --width=$fgwidth > $graphfile
echo "FlameGraph saved to $graphfile"
# On KDE, xdg-open prefers Gwenview by default, which doesn't handle interactive SVGs, so we need a browser.
# The current implementation is hackish and stupid. Somebody, please do something about it.
opener=xdg-open
which firefox > /dev/null && opener=firefox
which google-chrome > /dev/null && opener=google-chrome
$opener $graphfile
Binary file not shown.
+16 -4
View File
@@ -169,16 +169,18 @@ ifneq ($(filter archives,$(MAKECMDGOALS)),)
.NOTPARALLEL:
endif
J?=1
$(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@))
$(ARCHIVE_DIR)%.export: configuration = nsh
$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC)
@$(ECHO) %% Configuring NuttX for $(board)
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(board) .)
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration))
@$(ECHO) %% Exporting NuttX for $(board)
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) CONFIG_ARCH_BOARD=$(board) export
$(Q) $(MKDIR) -p $(dir $@)
$(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@
$(Q) (cd $(NUTTX_SRC)/configs && $(RMDIR) $(board))
@@ -195,11 +197,11 @@ BOARD = $(BOARDS)
menuconfig: $(NUTTX_SRC)
@$(ECHO) %% Configuring NuttX for $(BOARD)
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) (cd $(NUTTX_SRC)/configs && $(COPYDIR) $(PX4_BASE)nuttx-configs/$(BOARD) .)
$(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(BOARD)/nsh)
@$(ECHO) %% Running menuconfig for $(BOARD)
$(Q) $(MAKE) -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) menuconfig
$(Q) $(MAKE) -r -j$(J) -C $(NUTTX_SRC) -r $(MQUIET) menuconfig
@$(ECHO) %% Saving configuration file
$(Q)$(COPY) $(NUTTX_SRC).config $(PX4_BASE)nuttx-configs/$(BOARD)/nsh/defconfig
else
@@ -229,6 +231,14 @@ updatesubmodules:
#
testbuild:
$(Q) (cd $(PX4_BASE) && $(MAKE) distclean && $(MAKE) archives && $(MAKE) -j8)
$(Q) (zip -r Firmware.zip $(PX4_BASE)/Images)
#
# Unittest targets. Builds and runs the host-level
# unit tests.
.PHONY: tests
tests:
$(Q) (mkdir -p $(PX4_BASE)/unittests/build && cd $(PX4_BASE)/unittests/build && cmake .. && $(MAKE) unittests)
#
# Cleanup targets. 'clean' should remove all built products and force
@@ -237,11 +247,13 @@ testbuild:
#
.PHONY: clean
clean:
@echo > /dev/null
$(Q) $(RMDIR) $(BUILD_DIR)*.build
$(Q) $(REMOVE) $(IMAGE_DIR)*.px4
.PHONY: distclean
distclean: clean
@echo > /dev/null
$(Q) $(REMOVE) $(ARCHIVE_DIR)*.export
$(Q) $(MAKE) -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) (cd $(NUTTX_SRC)/configs && $(FIND) . -maxdepth 1 -type l -delete)
+1 -1
Submodule NuttX updated: 9d06b64579...37cbc3e8ae
+36 -5
View File
@@ -1,10 +1,41 @@
## PX4 Aerial Middleware and Flight Control Stack ##
## PX4 Flight Control Stack and Middleware ##
[![Build Status](https://travis-ci.org/PX4/Firmware.svg?branch=master)](https://travis-ci.org/PX4/Firmware) [![Coverity Scan](https://scan.coverity.com/projects/3966/badge.svg?flat=1)](https://scan.coverity.com/projects/3966?tab=overview)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PX4/Firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
* Official Website: http://px4.io
* License: BSD 3-clause (see LICENSE.md)
* Supported airframes:
* Multicopters
* Fixed wing
* Supported airframes (more experimental are supported):
* [Multicopters](http://px4.io/platforms/multicopters/start)
* [Fixed wing](http://px4.io/platforms/planes/start)
* [VTOL](http://px4.io/platforms/vtol/start)
* Binaries (always up-to-date from master):
* [Downloads](https://pixhawk.org/downloads)
* [Downloads](http://px4.io/downloads)
* Mailing list: [Google Groups](http://groups.google.com/group/px4users)
### Users ###
Please refer to the [user documentation](https://pixhawk.org/users/start) for flying drones with the PX4 flight stack.
### Developers ###
Contributing guide:
* [CONTRIBUTING.md](https://github.com/PX4/Firmware/blob/master/CONTRIBUTING.md)
* [PX4 Contribution Guide](http://px4.io/dev/contributing)
Developer guide:
http://px4.io/dev/
Testing guide:
http://px4.io/dev/unit_tests
This repository contains code supporting these boards:
* FMUv1.x
* FMUv2.x
* AeroCore (v1 and v2)
## NuttShell (NSH) ##
NSH usage documentation:
http://px4.io/users/serial_connection
@@ -7,4 +7,4 @@
sh /etc/init.d/rc.fw_defaults
set HIL yes
set MIXER FMU_AERT
set MIXER AERT
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO review MC_YAWRATE_I
param set MC_ROLL_P 8.0
@@ -24,7 +24,7 @@ then
param set MC_YAWRATE_D 0.0
fi
set MIXER FMU_quad_w
set MIXER quad_w
set PWM_OUTPUTS 1234
set PWM_OUT 1234
set PWM_MIN 1200
+3 -3
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO tune roll/pitch separately
param set MC_ROLL_P 7.0
@@ -27,9 +27,9 @@ then
param set BAT_C_SCALING 0.0124
fi
set MIXER FMU_quad_w
set MIXER quad_w
set PWM_OUTPUTS 1234
set PWM_OUT 1234
set PWM_MIN 1200
set PWM_MAX 1950
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO tune roll/pitch separately
param set MC_ROLL_P 7.0
@@ -26,9 +26,9 @@ then
param set BAT_N_CELLS 4
fi
set MIXER FMU_quad_w
set MIXER quad_w
set PWM_MIN 1210
set PWM_MAX 2100
set PWM_OUTPUTS 1234
set PWM_OUT 1234
@@ -0,0 +1,37 @@
#!nsh
#
# Team Blacksheep Discovery Long Range Quadcopter
#
# Setup: 15 x 5" Props, 6S 4000mAh TBS LiPo, TBS 30A ESCs, TBS 400kV Motors
#
# Simon Wilks <simon@px4.io>
#
sh /etc/init.d/rc.mc_defaults
if [ $AUTOCNF == yes ]
then
param set BAT_N_CELLS 6
param set BAT_V_EMPTY 3.5
param set MC_ROLL_P 7.0
param set MC_ROLLRATE_P 0.08
param set MC_ROLLRATE_I 0.02
param set MC_ROLLRATE_D 0.003
param set MC_PITCH_P 7.0
param set MC_PITCHRATE_P 0.13
param set MC_PITCHRATE_I 0.02
param set MC_PITCHRATE_D 0.005
param set MC_YAW_P 2.8
param set MC_YAWRATE_P 0.2
param set MC_YAWRATE_I 0.1
param set MC_YAWRATE_D 0.0
param set MPC_XY_FF 0.2
param set MPC_XY_VEL_MAX 2
fi
set MIXER quad_w
set PWM_OUT 1234
set PWM_MIN 1080
@@ -0,0 +1,31 @@
#!nsh
#
# HobbyKing SK450 DeadCat modification
#
# Anton Matosov <anton.matosov@gmail.com>
#
sh /etc/init.d/rc.mc_defaults
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 6.0
param set MC_ROLLRATE_P 0.04
param set MC_ROLLRATE_I 0.1
param set MC_ROLLRATE_D 0.0015
param set MC_PITCH_P 6.0
param set MC_PITCHRATE_P 0.08
param set MC_PITCHRATE_I 0.2
param set MC_PITCHRATE_D 0.0015
param set MC_YAW_P 2.8
param set MC_YAWRATE_P 0.1
param set MC_YAWRATE_I 0.07
param set MC_YAWRATE_D 0.0
fi
set MIXER sk450_deadcat
set PWM_OUT 1234
set PWM_MIN 1050
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_quad_x
set MIXER quad_x
set HIL yes
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_quad_+
set MIXER quad_+
set HIL yes
set HIL yes
@@ -9,4 +9,4 @@ sh /etc/init.d/rc.fw_defaults
set HIL yes
set MIXER FMU_AERT
set MIXER AERT
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.fw_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set FW_AIRSPD_MIN 12
param set FW_AIRSPD_TRIM 25
@@ -35,4 +35,4 @@ fi
set HIL yes
# Set the AERT mixer for HIL (even if the malolo is a flying wing)
set MIXER FMU_AERT
set MIXER AERT
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_hexa_cox
set MIXER hexa_cox
# Need to set all 8 channels
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
+2 -2
View File
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_octo_cox
set MIXER octo_cox
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
@@ -0,0 +1,15 @@
#
# Generic configuration file for caipirinha VTOL version
#
# Roman Bapst <bapstr@ethz.ch>
#
sh /etc/init.d/rc.vtol_defaults
set MIXER caipirinha_vtol
set PWM_OUT 12
set PWM_MAX 2000
set PWM_RATE 400
param set VT_MOT_COUNT 2
param set VT_IDLE_PWM_MC 1080
+14
View File
@@ -0,0 +1,14 @@
#!nsh
#
# Generic configuration file for BirdsEyeView Aerobotics FireFly6
#
# Roman Bapst <romanbapst@yahoo.de>
#
sh /etc/init.d/rc.vtol_defaults
set MIXER firefly6
set PWM_OUT 12345678
param set VT_MOT_COUNT 6
param set VT_IDLE_PWM_MC 1080
+1 -1
View File
@@ -2,4 +2,4 @@
sh /etc/init.d/rc.fw_defaults
set MIXER FMU_AERT
set MIXER AERT
@@ -2,4 +2,4 @@
sh /etc/init.d/rc.fw_defaults
set MIXER FMU_AERT
set MIXER skywalker
@@ -2,4 +2,4 @@
sh /etc/init.d/rc.fw_defaults
set MIXER FMU_AET
set MIXER AET
+2 -2
View File
@@ -2,7 +2,7 @@
sh /etc/init.d/rc.fw_defaults
set MIXER FMU_Q
set MIXER Q
# Provide ESC a constant 1000 us pulse while disarmed
set PWM_OUTPUTS 4
set PWM_OUT 4
set PWM_DISARMED 1000
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.fw_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set FW_AIRSPD_MIN 13
param set FW_AIRSPD_TRIM 15
@@ -36,5 +36,5 @@ fi
set MIXER phantom
# Provide ESC a constant 1000 us pulse
set PWM_OUTPUTS 4
set PWM_OUT 4
set PWM_DISARMED 1000
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.fw_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set FW_AIRSPD_MIN 15
param set FW_AIRSPD_TRIM 20
@@ -28,4 +28,4 @@ then
param set FW_R_RMAX 0
fi
set MIXER FMU_X5
set MIXER X5
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.fw_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set BAT_N_CELLS 2
param set FW_AIRSPD_MAX 15
@@ -44,5 +44,5 @@ fi
set MIXER wingwing
# Provide ESC a constant 1000 us pulse
set PWM_OUTPUTS 4
set PWM_OUT 4
set PWM_DISARMED 1000
+1 -1
View File
@@ -7,4 +7,4 @@
sh /etc/init.d/rc.fw_defaults
set MIXER FMU_FX79
set MIXER FX79
@@ -7,9 +7,9 @@
sh /etc/init.d/rc.fw_defaults
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO: these are the X5 default parameters, update them to the caipi
param set FW_AIRSPD_MIN 15
@@ -31,4 +31,4 @@ then
param set FW_R_RMAX 0
fi
set MIXER FMU_Q
set MIXER Q
+2 -2
View File
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_quad_x
set MIXER quad_x
set PWM_OUTPUTS 1234
set PWM_OUT 1234
+2 -2
View File
@@ -8,7 +8,7 @@ sh /etc/init.d/rc.mc_defaults
#
# Load default params for this platform
#
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# Set all params here, then disable autoconfig
param set MC_ROLL_P 6.0
@@ -24,7 +24,7 @@ then
param set MC_YAWRATE_I 0.2
param set MC_YAWRATE_D 0.0
param set MC_YAW_FF 0.8
param set BAT_V_SCALING 0.00838095238
fi
+1 -1
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/4001_quad_x
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 7.0
param set MC_ROLLRATE_P 0.1
+1 -1
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/4001_quad_x
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO REVIEW
param set MC_ROLL_P 7.0
+1 -1
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/4001_quad_x
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
# TODO REVIEW
param set MC_ROLL_P 7.0
+1 -1
View File
@@ -9,7 +9,7 @@ echo "HK Micro PCB Quad"
sh /etc/init.d/4001_quad_x
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 7.0
param set MC_ROLLRATE_P 0.1
+2 -2
View File
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_quad_+
set MIXER quad_+
set PWM_OUTPUTS 1234
set PWM_OUT 1234
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_hexa_x
set MIXER hexa_x
# Need to set all 8 channels
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
+2 -2
View File
@@ -7,7 +7,7 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_hexa_+
set MIXER hexa_+
# Need to set all 8 channels
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
+2 -2
View File
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_octo_x
set MIXER octo_x
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
+2 -2
View File
@@ -7,6 +7,6 @@
sh /etc/init.d/rc.mc_defaults
set MIXER FMU_octo_+
set MIXER octo_+
set PWM_OUTPUTS 12345678
set PWM_OUT 12345678
+29
View File
@@ -15,6 +15,7 @@
# 10000 .. 10999 Wide arm / H frame
# 11000 .. 11999 Hexa Cox
# 12000 .. 12999 Octo Cox
# 13000 .. 13999 VTOL
#
# Simulation
@@ -220,6 +221,16 @@ then
sh /etc/init.d/10017_steadidrone_qu4d
fi
if param compare SYS_AUTOSTART 10018 18
then
sh /etc/init.d/10018_tbs_endurance
fi
if param compare SYS_AUTOSTART 10019
then
sh /etc/init.d/10019_sk450_deadcat
fi
#
# Hexa Coaxial
#
@@ -237,3 +248,21 @@ if param compare SYS_AUTOSTART 12001
then
sh /etc/init.d/12001_octo_cox
fi
# 13000 is historically reserved for the quadshot
#
# VTOL Caipririnha (Tailsitter)
#
if param compare SYS_AUTOSTART 13001
then
sh /etc/init.d/13001_caipirinha_vtol
fi
#
# VTOL BirdsEyeView FireFly x6 (Tilt-Rotor)
#
if param compare SYS_AUTOSTART 13002
then
sh /etc/init.d/13002_firefly6
fi
+8 -1
View File
@@ -14,4 +14,11 @@ ekf_att_pos_estimator start
fw_att_control start
fw_pos_control_l1 start
bottle_drop start
#
# Start Land Detector
#
land_detector start fixedwing
#
# Misc apps
#
+3 -3
View File
@@ -2,7 +2,7 @@
set VEHICLE_TYPE fw
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
#
# Default parameters for FW
@@ -10,9 +10,9 @@ then
param set NAV_LAND_ALT 90
param set NAV_RTL_ALT 100
param set NAV_RTL_LAND_T -1
param set NAV_ACCEPT_RAD 50
param set NAV_ACC_RAD 50
param set FW_T_HRATE_P 0.01
param set FW_T_RLL2THR 15
param set FW_T_SRATE_P 0.01
param set FW_T_TIME_CONST 5
fi
fi
+68 -25
View File
@@ -3,21 +3,34 @@
# Script to configure control interface
#
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
if [ $MIXER != none -a $MIXER != skip ]
then
#
# Load mixer
# Load main mixer
#
set MIXERSD /fs/microsd/etc/mixers/$MIXER.mix
#Use the mixer file from the SD-card if it exists
if [ -f $MIXERSD ]
if [ $MIXER_AUX == none ]
then
set MIXER_FILE $MIXERSD
else
set MIXER_FILE /etc/mixers/$MIXER.mix
set MIXER_AUX $MIXER.aux
fi
# Use the mixer file from the SD-card if it exists
if [ -f $SDCARD_MIXERS_PATH/$MIXER.main.mix ]
then
set MIXER_FILE $SDCARD_MIXERS_PATH/$MIXER.main.mix
# Try out the old convention, for backward compatibility
else
if [ -f $SDCARD_MIXERS_PATH/$MIXER.mix ]
then
set MIXER_FILE $SDCARD_MIXERS_PATH/$MIXER.mix
else
set MIXER_FILE /etc/mixers/$MIXER.main.mix
fi
fi
if [ $OUTPUT_MODE == mkblctrl ]
then
set OUTPUT_DEV /dev/mkblctrl
@@ -29,52 +42,50 @@ then
then
set OUTPUT_DEV /dev/uavcan/esc
fi
if mixer load $OUTPUT_DEV $MIXER_FILE
then
echo "[init] Mixer loaded: $MIXER_FILE"
echo "[i] Mixer: $MIXER_FILE"
else
echo "[init] Error loading mixer: $MIXER_FILE"
tone_alarm $TUNE_OUT_ERROR
echo "[i] Error loading mixer: $MIXER_FILE"
tone_alarm $TUNE_ERR
fi
unset MIXER_FILE
else
if [ $MIXER != skip ]
then
echo "[init] Mixer not defined"
tone_alarm $TUNE_OUT_ERROR
echo "[i] Mixer not defined"
tone_alarm $TUNE_ERR
fi
fi
if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == io ]
then
if [ $PWM_OUTPUTS != none ]
if [ $PWM_OUT != none ]
then
#
# Set PWM output frequency
#
if [ $PWM_RATE != none ]
then
echo "[init] Set PWM rate: $PWM_RATE"
pwm rate -c $PWM_OUTPUTS -r $PWM_RATE
pwm rate -c $PWM_OUT -r $PWM_RATE
fi
#
# Set disarmed, min and max PWM values
#
if [ $PWM_DISARMED != none ]
then
echo "[init] Set PWM disarmed: $PWM_DISARMED"
pwm disarmed -c $PWM_OUTPUTS -p $PWM_DISARMED
pwm disarmed -c $PWM_OUT -p $PWM_DISARMED
fi
if [ $PWM_MIN != none ]
then
echo "[init] Set PWM min: $PWM_MIN"
pwm min -c $PWM_OUTPUTS -p $PWM_MIN
pwm min -c $PWM_OUT -p $PWM_MIN
fi
if [ $PWM_MAX != none ]
then
echo "[init] Set PWM max: $PWM_MAX"
pwm max -c $PWM_OUTPUTS -p $PWM_MAX
pwm max -c $PWM_OUT -p $PWM_MAX
fi
fi
@@ -83,3 +94,35 @@ then
pwm failsafe -d $OUTPUT_DEV $FAILSAFE
fi
fi
# check if should load secondary mixer
if [ $MIXER_AUX != none ]
then
#
# Load aux mixer
#
set MIXER_AUX_FILE none
if [ -f $SDCARD_MIXERS_PATH/$MIXER_AUX.mix ]
then
set MIXER_AUX_FILE $SDCARD_MIXERS_PATH/$MIXER_AUX.mix
else
if [ -f /etc/mixers/$MIXER_AUX.mix ]
then
set MIXER_AUX_FILE /etc/mixers/$MIXER_AUX.mix
fi
fi
if [ $MIXER_AUX_FILE != none -a $FMU_MODE == pwm ]
then
if fmu mode_pwm
then
mixer load /dev/pwm_output1 $MIXER_AUX_FILE
else
tone_alarm $TUNE_ERR
fi
fi
fi
unset OUTPUT_DEV
+1 -1
View File
@@ -16,5 +16,5 @@ then
set PX4IO_LIMIT 200
fi
echo "[init] Set PX4IO update rate limit: $PX4IO_LIMIT Hz"
echo "[i] Set PX4IO update rate limit: $PX4IO_LIMIT Hz"
px4io limit $PX4IO_LIMIT
+1 -1
View File
@@ -8,7 +8,7 @@ then
if ver hwcmp PX4FMU_V1
then
echo "Start sdlog2 at 50Hz"
sdlog2 start -r 50 -a -b 4 -t
sdlog2 start -r 40 -a -b 3 -t
else
echo "Start sdlog2 at 200Hz"
sdlog2 start -r 200 -a -b 22 -t
+5
View File
@@ -10,3 +10,8 @@ position_estimator_inav start
mc_att_control start
mc_pos_control start
#
# Start Land Detector
#
land_detector start multicopter
+4 -2
View File
@@ -2,7 +2,7 @@
set VEHICLE_TYPE mc
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 7.0
param set MC_ROLLRATE_P 0.1
@@ -41,7 +41,9 @@ then
param set PE_POSNE_NOISE 0.5
param set PE_POSD_NOISE 1.0
param set NAV_ACCEPT_RAD 2.0
param set NAV_ACC_RAD 2.0
param set RTL_RETURN_ALT 30.0
param set RTL_DESCEND_ALT 10.0
fi
set PWM_RATE 400
+9 -1
View File
@@ -52,11 +52,14 @@ then
if lsm303d start
then
fi
if ms5611 -X start
then
fi
fi
if meas_airspeed start
then
echo "[init] Using MEAS airspeed sensor"
else
if ets_airspeed start
then
@@ -67,10 +70,15 @@ else
fi
fi
# Check for flow sensor
if px4flow start
then
fi
if ll40ls start
then
fi
#
# Start sensors -> preflight_check
#
+3 -3
View File
@@ -10,9 +10,9 @@ then
# First sensor publisher to initialize takes lowest instance ID
# This delay ensures that UAVCAN-interfaced sensors would be allocated on lowest instance IDs
sleep 1
echo "[init] UAVCAN started"
echo "[i] UAVCAN started"
else
echo "[init] ERROR: Could not start UAVCAN"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: Could not start UAVCAN"
tone_alarm $TUNE_ERR
fi
fi
+3
View File
@@ -25,6 +25,9 @@ mavlink stream -d /dev/ttyACM0 -s SERVO_OUTPUT_RAW_0 -r 20
usleep 100000
mavlink stream -d /dev/ttyACM0 -s POSITION_TARGET_GLOBAL_INT -r 10
usleep 100000
mavlink stream -d /dev/ttyACM0 -s LOCAL_POSITION_NED -r 30
usleep 100000
mavlink stream -d /dev/ttyACM0 -s MANUAL_CONTROL -r 5
# Exit shell to make it available to MAVLink
exit
+15
View File
@@ -0,0 +1,15 @@
#!nsh
#
# Standard apps for vtol:
# att & pos estimator, att & pos control.
#
attitude_estimator_ekf start
#ekf_att_pos_estimator start
position_estimator_inav start
vtol_att_control start
mc_att_control start
mc_pos_control start
fw_att_control start
fw_pos_control_l1 start
@@ -0,0 +1,39 @@
#!nsh
set VEHICLE_TYPE vtol
if [ $AUTOCNF == yes ]
then
#
#Default controller parameters for MC
#
param set MC_ROLL_P 6.0
param set MC_ROLLRATE_P 0.1
param set MC_ROLLRATE_I 0.0
param set MC_ROLLRATE_D 0.003
param set MC_PITCH_P 6.0
param set MC_PITCHRATE_P 0.2
param set MC_PITCHRATE_I 0.0
param set MC_PITCHRATE_D 0.003
param set MC_YAW_P 4
param set MC_YAWRATE_P 0.2
param set MC_YAWRATE_I 0.0
param set MC_YAWRATE_D 0.0
param set MC_YAW_FF 0.3
#
# Default parameters for FW
#
param set FW_PR_FF 0.3
param set FW_PR_I 0.000
param set FW_PR_IMAX 0.2
param set FW_PR_P 0.02
param set FW_RR_FF 0.3
param set FW_RR_I 0.00
param set FW_RR_IMAX 0.2
param set FW_RR_P 0.02
fi
set PWM_DISARMED 900
set PWM_MIN 1000
set PWM_MAX 2000
+162 -102
View File
@@ -1,71 +1,55 @@
#!nsh
#
# PX4FMU startup script.
#
# NOTE: COMMENT LINES ARE REMOVED BEFORE STORED IN ROMFS.
#
#
# Start CDC/ACM serial driver
#
sercon
#
# Default to auto-start mode.
#
set MODE autostart
set RC_FILE /fs/microsd/etc/rc.txt
set CONFIG_FILE /fs/microsd/etc/config.txt
set EXTRAS_FILE /fs/microsd/etc/extras.txt
set FRC /fs/microsd/etc/rc.txt
set FCONFIG /fs/microsd/etc/config.txt
set TUNE_OUT_ERROR ML<<CP4CP4CP4CP4CP4
set TUNE_ERR ML<<CP4CP4CP4CP4CP4
#
# Try to mount the microSD card.
#
echo "[init] Looking for microSD..."
echo "[i] Looking for microSD..."
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
set LOG_FILE /fs/microsd/bootlog.txt
echo "[init] microSD mounted: /fs/microsd"
echo "[i] microSD mounted: /fs/microsd"
# Start playing the startup tune
tone_alarm start
else
set LOG_FILE /dev/null
echo "[init] No microSD card found"
# Play SOS
tone_alarm error
fi
#
# Look for an init script on the microSD card.
# Disable autostart if the script found.
#
if [ -f $RC_FILE ]
if [ -f $FRC ]
then
echo "[init] Executing init script: $RC_FILE"
sh $RC_FILE
echo "[i] Executing init script: $FRC"
sh $FRC
set MODE custom
else
echo "[init] Init script not found: $RC_FILE"
fi
# if this is an APM build then there will be a rc.APM script
# from an EXTERNAL_SCRIPTS build option
if [ -f /etc/init.d/rc.APM ]
then
if sercon
then
echo "[init] USB interface connected"
fi
echo "[init] Running rc.APM"
# if APM startup is successful then nsh will exit
sh /etc/init.d/rc.APM
echo "[i] Init script not found: $FRC"
fi
unset FRC
if [ $MODE == autostart ]
then
echo "[init] AUTOSTART mode"
#
# Start CDC/ACM serial driver
#
sercon
# Try to get an USB console
nshterm /dev/ttyACM0 &
@@ -116,32 +100,33 @@ then
set HIL no
set VEHICLE_TYPE none
set MIXER none
set MIXER_AUX none
set OUTPUT_MODE none
set PWM_OUTPUTS none
set PWM_OUT none
set PWM_RATE none
set PWM_DISARMED none
set PWM_MIN none
set PWM_MAX none
set MKBLCTRL_MODE none
set MK_MODE none
set FMU_MODE pwm
set MAVLINK_FLAGS default
set MAVLINK_F default
set EXIT_ON_END no
set MAV_TYPE none
set LOAD_DEFAULT_APPS yes
set LOAD_DAPPS yes
set GPS yes
set GPS_FAKE no
set FAILSAFE none
#
# Set DO_AUTOCONFIG flag to use it in AUTOSTART scripts
# Set AUTOCNF flag to use it in AUTOSTART scripts
#
if param compare SYS_AUTOCONFIG 1
then
# Wipe out params
param reset_nostart
set DO_AUTOCONFIG yes
set AUTOCNF yes
else
set DO_AUTOCONFIG no
set AUTOCNF no
fi
#
@@ -159,30 +144,33 @@ then
#
if param compare SYS_AUTOSTART 0
then
echo "[init] No autostart"
echo "[i] No autostart"
else
sh /etc/init.d/rc.autostart
fi
unset MODE
#
# Override parameters from user configuration file
#
if [ -f $CONFIG_FILE ]
if [ -f $FCONFIG ]
then
echo "[init] Config: $CONFIG_FILE"
sh $CONFIG_FILE
echo "[i] Config: $FCONFIG"
sh $FCONFIG
else
echo "[init] Config not found: $CONFIG_FILE"
echo "[i] Config not found: $FCONFIG"
fi
unset FCONFIG
#
# If autoconfig parameter was set, reset it and save parameters
#
if [ $DO_AUTOCONFIG == yes ]
if [ $AUTOCNF == yes ]
then
param set SYS_AUTOCONFIG 0
param save
fi
unset AUTOCNF
set IO_PRESENT no
@@ -219,18 +207,19 @@ then
set IO_PRESENT yes
else
echo "PX4IO update failed" >> $LOG_FILE
tone_alarm $TUNE_OUT_ERROR
tone_alarm $TUNE_ERR
fi
else
echo "PX4IO update failed" >> $LOG_FILE
tone_alarm $TUNE_OUT_ERROR
tone_alarm $TUNE_ERR
fi
fi
unset IO_FILE
if [ $IO_PRESENT == no ]
then
echo "[init] ERROR: PX4IO not found"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: PX4IO not found"
tone_alarm $TUNE_ERR
fi
fi
@@ -251,7 +240,7 @@ then
then
# Need IO for output but it not present, disable output
set OUTPUT_MODE none
echo "[init] ERROR: PX4IO not found, disabling output"
echo "[i] ERROR: PX4IO not found, disabling output"
# Avoid using ttyS0 for MAVLink on FMUv1
if ver hwcmp PX4FMU_V1
@@ -273,6 +262,7 @@ then
set FMU_MODE serial
fi
fi
unset HIL
# waypoint storage
if dataman start
@@ -294,33 +284,31 @@ then
then
if param compare UAVCAN_ENABLE 0
then
echo "[init] OVERRIDING UAVCAN_ENABLE = 1"
echo "[i] OVERRIDING UAVCAN_ENABLE = 1"
param set UAVCAN_ENABLE 1
fi
fi
if [ $OUTPUT_MODE == io -o $OUTPUT_MODE == uavcan_esc ]
then
echo "[init] Use PX4IO PWM as primary output"
if px4io start
then
echo "[init] PX4IO started"
echo "[i] PX4IO started"
sh /etc/init.d/rc.io
else
echo "[init] ERROR: PX4IO start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: PX4IO start failed"
tone_alarm $TUNE_ERR
fi
fi
if [ $OUTPUT_MODE == fmu -o $OUTPUT_MODE == ardrone ]
then
echo "[init] Use FMU as primary output"
if fmu mode_$FMU_MODE
then
echo "[init] FMU mode_$FMU_MODE started"
echo "[i] FMU mode_$FMU_MODE started"
else
echo "[init] ERROR: FMU mode_$FMU_MODE start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: FMU mode_$FMU_MODE start failed"
tone_alarm $TUNE_ERR
fi
if ver hwcmp PX4FMU_V1
@@ -338,36 +326,35 @@ then
if [ $OUTPUT_MODE == mkblctrl ]
then
echo "[init] Use MKBLCTRL as primary output"
set MKBLCTRL_ARG ""
if [ $MKBLCTRL_MODE == x ]
if [ $MK_MODE == x ]
then
set MKBLCTRL_ARG "-mkmode x"
fi
if [ $MKBLCTRL_MODE == + ]
if [ $MK_MODE == + ]
then
set MKBLCTRL_ARG "-mkmode +"
fi
if mkblctrl $MKBLCTRL_ARG
then
echo "[init] MKBLCTRL started"
echo "[i] MK started"
else
echo "[init] ERROR: MKBLCTRL start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: MK start failed"
tone_alarm $TUNE_ERR
fi
unset MKBLCTRL_ARG
fi
unset MK_MODE
if [ $OUTPUT_MODE == hil ]
then
echo "[init] Use HIL as primary output"
if hil mode_port2_pwm8
then
echo "[init] HIL output started"
echo "[i] HIL output started"
else
echo "[init] ERROR: HIL output start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: HIL output start failed"
tone_alarm $TUNE_ERR
fi
fi
@@ -380,11 +367,11 @@ then
then
if px4io start
then
echo "[init] PX4IO started"
echo "[i] PX4IO started"
sh /etc/init.d/rc.io
else
echo "[init] ERROR: PX4IO start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: PX4IO start failed"
tone_alarm $TUNE_ERR
fi
fi
else
@@ -392,10 +379,10 @@ then
then
if fmu mode_$FMU_MODE
then
echo "[init] FMU mode_$FMU_MODE started"
echo "[i] FMU mode_$FMU_MODE started"
else
echo "[init] ERROR: FMU mode_$FMU_MODE start failed"
tone_alarm $TUNE_OUT_ERROR
echo "[i] ERROR: FMU mode_$FMU_MODE start failed"
tone_alarm $TUNE_ERR
fi
if ver hwcmp PX4FMU_V1
@@ -413,25 +400,36 @@ then
fi
fi
if [ $MAVLINK_FLAGS == default ]
if [ $MAVLINK_F == default ]
then
# Normal mode, use baudrate 57600 (default) and data rate 1000 bytes/s
if [ $TTYS1_BUSY == yes ]
then
# Start MAVLink on ttyS0, because FMU ttyS1 pins configured as something else
set MAVLINK_FLAGS "-r 1000 -d /dev/ttyS0"
set MAVLINK_F "-r 1000 -d /dev/ttyS0"
# Exit from nsh to free port for mavlink
set EXIT_ON_END yes
else
# Start MAVLink on default port: ttyS1
set MAVLINK_FLAGS "-r 1000"
set MAVLINK_F "-r 1000"
fi
fi
mavlink start $MAVLINK_FLAGS
mavlink start $MAVLINK_F
unset MAVLINK_F
#
# MAVLink onboard / TELEM2
#
if ver hwcmp PX4FMU_V2
then
if param compare SYS_COMPANION 921600
then
mavlink start -d /dev/ttyS2 -b 921600 -m onboard
fi
fi
# UAVCAN
#
sh /etc/init.d/rc.uavcan
@@ -444,15 +442,16 @@ then
if [ $GPS == yes ]
then
echo "[init] Start GPS"
echo "[i] Start GPS"
if [ $GPS_FAKE == yes ]
then
echo "[init] Faking GPS"
echo "[i] Faking GPS"
gps start -f
else
gps start
fi
fi
unset GPS_FAKE
#
# Start up ARDrone Motor interface
@@ -467,12 +466,12 @@ then
#
if [ $VEHICLE_TYPE == fw ]
then
echo "[init] Vehicle type: FIXED WING"
echo "[i] FIXED WING"
if [ $MIXER == none ]
then
# Set default mixer for fixed wing if not defined
set MIXER FMU_AERT
set MIXER AERT
fi
if [ $MAV_TYPE == none ]
@@ -487,7 +486,7 @@ then
sh /etc/init.d/rc.interface
# Start standard fixedwing apps
if [ $LOAD_DEFAULT_APPS == yes ]
if [ $LOAD_DAPPS == yes ]
then
sh /etc/init.d/rc.fw_apps
fi
@@ -498,37 +497,37 @@ then
#
if [ $VEHICLE_TYPE == mc ]
then
echo "[init] Vehicle type: MULTICOPTER"
echo "[i] MULTICOPTER"
if [ $MIXER == none ]
then
echo "Default mixer for multicopter not defined"
echo "Mixer undefined"
fi
if [ $MAV_TYPE == none ]
then
# Use mixer to detect vehicle type
if [ $MIXER == FMU_quad_x -o $MIXER == FMU_quad_+ ]
if [ $MIXER == quad_x -o $MIXER == quad_+ ]
then
set MAV_TYPE 2
fi
if [ $MIXER == FMU_quad_w ]
if [ $MIXER == quad_w -o $MIXER == sk450_deadcat ]
then
set MAV_TYPE 2
fi
if [ $MIXER == FMU_hexa_x -o $MIXER == FMU_hexa_+ ]
if [ $MIXER == hexa_x -o $MIXER == hexa_+ ]
then
set MAV_TYPE 13
fi
if [ $MIXER == FMU_hexa_cox ]
if [ $MIXER == hexa_cox ]
then
set MAV_TYPE 13
fi
if [ $MIXER == FMU_octo_x -o $MIXER == FMU_octo_+ ]
if [ $MIXER == octo_x -o $MIXER == octo_+ ]
then
set MAV_TYPE 14
fi
if [ $MIXER == FMU_octo_cox ]
if [ $MIXER == octo_cox ]
then
set MAV_TYPE 14
fi
@@ -546,12 +545,58 @@ then
sh /etc/init.d/rc.interface
# Start standard multicopter apps
if [ $LOAD_DEFAULT_APPS == yes ]
if [ $LOAD_DAPPS == yes ]
then
sh /etc/init.d/rc.mc_apps
fi
fi
#
# VTOL setup
#
if [ $VEHICLE_TYPE == vtol ]
then
echo "[init] Vehicle type: VTOL"
if [ $MIXER == none ]
then
echo "Default mixer for vtol not defined"
fi
if [ $MAV_TYPE == none ]
then
# Use mixer to detect vehicle type
if [ $MIXER == caipirinha_vtol ]
then
set MAV_TYPE 19
fi
if [ $MIXER == firefly6_rotors ]
then
set MAV_TYPE 21
fi
fi
# Still no MAV_TYPE found
if [ $MAV_TYPE == none ]
then
echo "Unknown MAV_TYPE"
else
param set MAV_TYPE $MAV_TYPE
fi
# Load mixer and configure outputs
sh /etc/init.d/rc.interface
# Start standard vtol apps
if [ $LOAD_DAPPS == yes ]
then
sh /etc/init.d/rc.vtol_apps
fi
fi
unset MIXER
unset MAV_TYPE
unset OUTPUT_MODE
#
# Start the navigator
#
@@ -562,24 +607,39 @@ then
#
if [ $VEHICLE_TYPE == none ]
then
echo "[init] Vehicle type: No autostart ID found"
echo "[i] No autostart ID found"
fi
# Start any custom addons
if [ -f $EXTRAS_FILE ]
set FEXTRAS /fs/microsd/etc/extras.txt
if [ -f $FEXTRAS ]
then
echo "[init] Starting addons script: $EXTRAS_FILE"
sh $EXTRAS_FILE
echo "[i] Addons script: $FEXTRAS"
sh $FEXTRAS
else
echo "[init] No addons script: $EXTRAS_FILE"
echo "[i] No addons script: $FEXTRAS"
fi
unset FEXTRAS
if [ $EXIT_ON_END == yes ]
then
echo "[init] Exit from nsh"
echo "Exit from nsh"
exit
fi
unset EXIT_ON_END
# Run no SD alarm last
if [ $LOG_FILE == /dev/null ]
then
echo "[i] No microSD card found"
# Play SOS
tone_alarm error
fi
# End of autostart
fi
# There is no further processing, so we can free some RAM
# XXX potentially unset all script variables.
unset TUNE_ERR
@@ -1,61 +1,12 @@
PX4 mixer definitions
=====================
## PX4 mixer definitions ##
Files in this directory implement example mixers that can be used as a basis
for customisation, or for general testing purposes.
Mixer basics
------------
For a detailed description of the mixing architecture and examples see:
http://px4.io/dev/mixing
Mixers combine control values from various sources (control tasks, user inputs,
etc.) and produce output values suitable for controlling actuators; servos,
motors, switches and so on.
An actuator derives its value from the combination of one or more control
values. Each of the control values is scaled according to the actuator's
configuration and then combined to produce the actuator value, which may then be
further scaled to suit the specific output type.
Internally, all scaling is performed using floating point values. Inputs and
outputs are clamped to the range -1.0 to 1.0.
control control control
| | |
v v v
scale scale scale
| | |
| v |
+-------> mix <------+
|
scale
|
v
out
Scaling
-------
Basic scalers provide linear scaling of the input to the output.
Each scaler allows the input value to be scaled independently for inputs
greater/less than zero. An offset can be applied to the output, and lower and
upper boundary constraints can be applied. Negative scaling factors cause the
output to be inverted (negative input produces positive output).
Scaler pseudocode:
if (input < 0)
output = (input * NEGATIVE_SCALE) + OFFSET
else
output = (input * POSITIVE_SCALE) + OFFSET
if (output < LOWER_LIMIT)
output = LOWER_LIMIT
if (output > UPPER_LIMIT)
output = UPPER_LIMIT
Syntax
------
### Syntax ###
Mixer definitions are text files; lines beginning with a single capital letter
followed by a colon are significant. All other lines are ignored, meaning that
@@ -65,6 +16,9 @@ Each file may define more than one mixer; the allocation of mixers to actuators
is specific to the device reading the mixer definition, and the number of
actuator outputs generated by a mixer is specific to the mixer.
For example: each simple or null mixer is assigned to outputs 1 to x
in the order they appear in the mixer file.
A mixer begins with a line of the form
<tag>: <mixer arguments>
@@ -72,8 +26,7 @@ A mixer begins with a line of the form
The tag selects the mixer type; 'M' for a simple summing mixer, 'R' for a
multirotor mixer, etc.
Null Mixer
..........
#### Null Mixer ####
A null mixer consumes no controls and generates a single actuator output whose
value is always zero. Typically a null mixer is used as a placeholder in a
@@ -83,8 +36,7 @@ The null mixer definition has the form:
Z:
Simple Mixer
............
#### Simple Mixer ####
A simple mixer combines zero or more control inputs into a single actuator
output. Inputs are scaled, and the mixing function sums the result before
@@ -122,8 +74,7 @@ discussed above. Whilst the calculations are performed as floating-point
operations, the values stored in the definition file are scaled by a factor of
10000; i.e. an offset of -0.5 is encoded as -5000.
Multirotor Mixer
................
#### Multirotor Mixer ####
The multirotor mixer combines four control inputs (roll, pitch, yaw, thrust)
into a set of actuator outputs intended to drive motor speed controllers.
@@ -0,0 +1,16 @@
#!nsh
# Caipirinha vtol mixer for PX4FMU
#
#===========================
R: 2- 10000 10000 10000 0
#mixer for the elevons
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 10000 10000 0 -10000 10000
S: 1 1 10000 10000 0 -10000 10000
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 10000 10000 0 -10000 10000
S: 1 1 -10000 -10000 0 -10000 10000
@@ -0,0 +1,10 @@
# mixer for the FireFly6 elevons
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 7500 7500 0 -10000 10000
S: 1 1 8000 8000 0 -10000 10000
M: 2
O: 10000 10000 0 -10000 10000
S: 1 0 7500 7500 0 -10000 10000
S: 1 1 -8000 -8000 0 -10000 10000
@@ -0,0 +1,4 @@
# FireFly6 mixer for PX4FMU
#
#===========================
R: 6c 10000 10000 10000 0
@@ -0,0 +1,25 @@
Multirotor mixer for PX4FMU
===========================
This file defines a single mixer for a quadrotor in SK450 DeadCat configuration. All controls are mixed 100%.
R: 4dc 10000 10000 10000 0
Gimbal / payload mixer for last four channels
-----------------------------------------------------
M: 1
O: 10000 10000 0 -10000 10000
S: 0 4 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 5 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 6 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 7 10000 10000 0 -10000 10000
@@ -0,0 +1,64 @@
Mixer for Skywalker Airframe
==================================================
This file defines mixers suitable for controlling a fixed wing aircraft with
aileron, rudder, elevator and throttle controls using PX4FMU. The configuration
assumes the aileron servo(s) are connected to PX4FMU servo output 0, the
elevator to output 1, the rudder to output 2 and the throttle to output 3.
Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch) and 3 (thrust).
Aileron mixer
-------------
Two scalers total (output, roll).
This mixer assumes that the aileron servos are set up correctly mechanically;
depending on the actual configuration it may be necessary to reverse the scaling
factors (to reverse the servo movement) and adjust the offset, scaling and
endpoints to suit.
As there is only one output, if using two servos adjustments to compensate for
differences between the servos must be made mechanically. To obtain the correct
motion using a Y cable, the servos can be positioned reversed from one another.
M: 1
O: 10000 10000 0 -10000 10000
S: 0 0 -10000 -10000 0 -10000 10000
Elevator mixer
------------
Two scalers total (output, roll).
This mixer assumes that the elevator servo is set up correctly mechanically;
depending on the actual configuration it may be necessary to reverse the scaling
factors (to reverse the servo movement) and adjust the offset, scaling and
endpoints to suit.
M: 1
O: 10000 10000 0 -10000 10000
S: 0 1 10000 10000 0 -10000 10000
Rudder mixer
------------
Two scalers total (output, yaw).
This mixer assumes that the rudder servo is set up correctly mechanically;
depending on the actual configuration it may be necessary to reverse the scaling
factors (to reverse the servo movement) and adjust the offset, scaling and
endpoints to suit.
M: 1
O: 10000 10000 0 -10000 10000
S: 0 2 10000 10000 0 -10000 10000
Motor speed mixer
-----------------
Two scalers total (output, thrust).
This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1)
range. Inputs below zero are treated as zero.
M: 1
O: 10000 10000 0 -10000 10000
S: 0 3 0 20000 -10000 -10000 10000
+2 -2
View File
@@ -3,11 +3,11 @@
# Flight startup script for PX4FMU standalone configuration.
#
echo "[init] doing standalone PX4FMU startup..."
echo "[i] doing standalone PX4FMU startup..."
#
# Start the ORB
#
uorb start
echo "[init] startup done"
echo "[i] startup done"
+32 -5
View File
@@ -6,7 +6,7 @@ uorb start
if sercon
then
echo "[init] USB interface connected"
echo "[i] USB interface connected"
# Try to get an USB console
nshterm /dev/ttyACM0 &
@@ -15,14 +15,14 @@ fi
#
# Try to mount the microSD card.
#
echo "[init] looking for microSD..."
echo "[i] looking for microSD..."
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "[init] card mounted at /fs/microsd"
echo "[i] card mounted at /fs/microsd"
# Start playing the startup tune
tone_alarm start
else
echo "[init] no microSD card found"
echo "[i] no microSD card found"
# Play SOS
tone_alarm error
fi
@@ -97,6 +97,33 @@ else
set unit_test_failure_list "${unit_test_failure_list} commander_tests"
fi
if uorb test
then
else
set unit_test_failure 1
set unit_test_failure_list "${unit_test_failure_list} uorb_tests"
fi
if hmc5883 -I start
then
# This is an FMUv3
echo "FMUv3"
ms5611 start
mpu6000 -X start
mpu6000 start
lsm303d -X start
l3gd20 -X start
echo "EVALUATION ONLY SENSORS (not used in production)"
ms5611 -X start
else
# This is an FMUv1 or FMUv2
echo "FMUv2 (or FMUv3 where 'hmc5883 -I start' failed)"
ms5611 start
mpu6000 start
lsm303d start
l3gd20 start
fi
if [ $unit_test_failure == 0 ]
then
echo
@@ -104,4 +131,4 @@ then
else
echo
echo "Some Unit Tests FAILED:${unit_test_failure_list}"
fi
fi
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
# make_color.sh
#
# Author: Simon Wilks (simon@uaventure.com)
#
# A compiler color coder.
#
# To invoke this script everytime you run make simply create the alias:
#
# alias make='<your-firmware-directory>/Tools/make_color.sh'
#
# Color codes:
#
# white "\033[1,37m"
# yellow "\033[1,33m"
# green "\033[1,32m"
# blue "\033[1,34m"
# cyan "\033[1,36m"
# red "\033[1,31m"
# magenta "\033[1,35m"
# black "\033[1,30m"
# darkwhite "\033[0,37m"
# darkyellow "\033[0,33m"
# darkgreen "\033[0,32m"
# darkblue "\033[0,34m"
# darkcyan "\033[0,36m"
# darkred "\033[0,31m"
# darkmagenta "\033[0,35m"
# off "\033[0,0m"
#
OFF="\o033[0m"
WARN="\o033[1;33m"
ERROR="\o033[1;31m"
INFO="\o033[0;37m"
make ${@} 2>&1 | sed "s/make\[[0-9]\].*/$INFO & $OFF/;s/.*: warning: .*/$WARN & $OFF/;s/.*: error: .*/$ERROR & $OFF/"
+1 -1
View File
@@ -103,7 +103,7 @@ class SourceParser(object):
Returns list of supported file extensions that can be parsed by this
parser.
"""
return ["cpp", "c"]
return [".cpp", ".c"]
def Parse(self, contents):
"""
+6 -1
View File
@@ -26,5 +26,10 @@ class SourceScanner(object):
parser.Parse method.
"""
with codecs.open(path, 'r', 'utf-8') as f:
contents = f.read()
try:
contents = f.read()
except:
contents = ''
print('Failed reading file: %s, skipping content.' % path)
pass
parser.Parse(contents)
+5
View File
@@ -73,6 +73,7 @@ parser.add_argument("--version", action="store", help="set a version string")
parser.add_argument("--summary", action="store", help="set a brief description")
parser.add_argument("--description", action="store", help="set a longer description")
parser.add_argument("--git_identity", action="store", help="the working directory to check for git identity")
parser.add_argument("--parameter_xml", action="store", help="the parameters.xml file")
parser.add_argument("--image", action="store", help="the firmware image")
args = parser.parse_args()
@@ -101,6 +102,10 @@ if args.git_identity != None:
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
desc['git_identity'] = str(p.read().strip())
p.close()
if args.parameter_xml != None:
f = open(args.parameter_xml, "rb")
bytes = f.read()
desc['parameter_xml'] = base64.b64encode(zlib.compress(bytes,9)).decode('utf-8')
if args.image != None:
f = open(args.image, "rb")
bytes = f.read()
+76 -35
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved.
# Copyright (C) 2012-2015 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
@@ -227,16 +227,21 @@ class uploader(object):
+ uploader.EOC)
self.__getSync()
# def __trySync(self):
# c = self.__recv()
# if (c != self.INSYNC):
# #print("unexpected 0x%x instead of INSYNC" % ord(c))
# return False;
# c = self.__recv()
# if (c != self.OK):
# #print("unexpected 0x%x instead of OK" % ord(c))
# return False
# return True
def __trySync(self):
try:
self.port.flush()
if (self.__recv() != self.INSYNC):
#print("unexpected 0x%x instead of INSYNC" % ord(c))
return False;
if (self.__recv() != self.OK):
#print("unexpected 0x%x instead of OK" % ord(c))
return False
return True
except RuntimeError:
#timeout, no response yet
return False
# send the GET_DEVICE command and wait for an info parameter
def __getInfo(self, param):
@@ -261,19 +266,38 @@ class uploader(object):
self.__getSync()
return value
def __drawProgressBar(self, label, progress, maxVal):
if maxVal < progress:
progress = maxVal
percent = (float(progress) / float(maxVal)) * 100.0
sys.stdout.write("\r%s: [%-20s] %.1f%%" % (label, '='*int(percent/5.0), percent))
sys.stdout.flush()
# send the CHIP_ERASE command and wait for the bootloader to become ready
def __erase(self):
def __erase(self, label):
print("\n", end='')
self.__send(uploader.CHIP_ERASE
+ uploader.EOC)
# erase is very slow, give it 20s
deadline = time.time() + 20
deadline = time.time() + 20.0
while time.time() < deadline:
try:
self.__getSync()
return
except RuntimeError:
# we timed out, that's OK
continue
#Draw progress bar (erase usually takes about 9 seconds to complete)
estimatedTimeRemaining = deadline-time.time()
if estimatedTimeRemaining >= 9.0:
self.__drawProgressBar(label, 20.0-estimatedTimeRemaining, 9.0)
else:
self.__drawProgressBar(label, 10.0, 10.0)
sys.stdout.write(" (timeout: %d seconds) " % int(deadline-time.time()) )
sys.stdout.flush()
if self.__trySync():
self.__drawProgressBar(label, 10.0, 10.0)
return;
raise RuntimeError("timed out waiting for erase")
@@ -326,33 +350,52 @@ class uploader(object):
return [seq[i:i+length] for i in range(0, len(seq), length)]
# upload code
def __program(self, fw):
def __program(self, label, fw):
print("\n", end='')
code = fw.image
groups = self.__split_len(code, uploader.PROG_MULTI_MAX)
uploadProgress = 0
for bytes in groups:
self.__program_multi(bytes)
#Print upload progress (throttled, so it does not delay upload progress)
uploadProgress += 1
if uploadProgress % 256 == 0:
self.__drawProgressBar(label, uploadProgress, len(groups))
self.__drawProgressBar(label, 100, 100)
# verify code
def __verify_v2(self, fw):
def __verify_v2(self, label, fw):
print("\n", end='')
self.__send(uploader.CHIP_VERIFY
+ uploader.EOC)
self.__getSync()
code = fw.image
groups = self.__split_len(code, uploader.READ_MULTI_MAX)
verifyProgress = 0
for bytes in groups:
verifyProgress += 1
if verifyProgress % 256 == 0:
self.__drawProgressBar(label, verifyProgress, len(groups))
if (not self.__verify_multi(bytes)):
raise RuntimeError("Verification failed")
self.__drawProgressBar(label, 100, 100)
def __verify_v3(self, fw):
expect_crc = fw.crc(self.fw_maxsize)
def __verify_v3(self, label, fw):
print("\n", end='')
self.__drawProgressBar(label, 1, 100)
expect_crc = fw.crc(self.fw_maxsize)
self.__send(uploader.GET_CRC
+ uploader.EOC)
report_crc = self.__recv_int()
self.__getSync()
verifyProgress = 0
if report_crc != expect_crc:
print("Expected 0x%x" % expect_crc)
print("Got 0x%x" % report_crc)
raise RuntimeError("Program CRC failed")
self.__drawProgressBar(label, 100, 100)
# get basic data about the board
def identify(self):
@@ -406,19 +449,16 @@ class uploader(object):
except Exception:
# ignore bad character encodings
pass
print("erase...")
self.__erase()
self.__erase("Erase ")
self.__program("Program", fw)
print("program...")
self.__program(fw)
print("verify...")
if self.bl_rev == 2:
self.__verify_v2(fw)
self.__verify_v2("Verify ", fw)
else:
self.__verify_v3(fw)
self.__verify_v3("Verify ", fw)
print("done, rebooting.")
print("\nRebooting.\n")
self.__reboot()
self.port.close()
@@ -434,8 +474,7 @@ class uploader(object):
self.__send(uploader.MAVLINK_REBOOT_ID0)
except:
return
# Detect python version
if sys.version_info[0] < 3:
@@ -511,8 +550,10 @@ while True:
print("attempting reboot on %s..." % port)
print("if the board does not respond, unplug and re-plug the USB connector.")
up.send_reboot()
# wait for the reboot, without we might run into Serial I/O Error 5
time.sleep(0.5)
# always close the port
up.close()
continue
@@ -524,7 +565,7 @@ while True:
except RuntimeError as ex:
# print the error
print("ERROR: %s" % ex.args)
print("\nERROR: %s" % ex.args)
finally:
# always close the port
-54
View File
@@ -1,54 +0,0 @@
CC=g++
CFLAGS=-I. -I../../src/modules -I ../../src/include -I../../src/drivers \
-I../../src -I../../src/lib -D__EXPORT="" -Dnullptr="0" -lm
all: mixer_test sbus2_test autodeclination_test st24_test sf0x_test
MIXER_FILES=../../src/systemcmds/tests/test_mixer.cpp \
../../src/systemcmds/tests/test_conv.cpp \
../../src/modules/systemlib/mixer/mixer_simple.cpp \
../../src/modules/systemlib/mixer/mixer_multirotor.cpp \
../../src/modules/systemlib/mixer/mixer.cpp \
../../src/modules/systemlib/mixer/mixer_group.cpp \
../../src/modules/systemlib/mixer/mixer_load.c \
../../src/modules/systemlib/pwm_limit/pwm_limit.c \
hrt.cpp \
mixer_test.cpp
SBUS2_FILES=../../src/modules/px4iofirmware/sbus.c \
hrt.cpp \
sbus2_test.cpp
ST24_FILES=../../src/lib/rc/st24.c \
hrt.cpp \
st24_test.cpp
SF0X_FILES= \
hrt.cpp \
sf0x_test.cpp \
../../src/drivers/sf0x/sf0x_parser.cpp
AUTODECLINATION_FILES= ../../src/lib/geo_lookup/geo_mag_declination.c \
hrt.cpp \
autodeclination_test.cpp
mixer_test: $(MIXER_FILES)
$(CC) -o mixer_test $(MIXER_FILES) $(CFLAGS)
sbus2_test: $(SBUS2_FILES)
$(CC) -o sbus2_test $(SBUS2_FILES) $(CFLAGS)
sf0x_test: $(SF0X_FILES)
$(CC) -o sf0x_test $(SF0X_FILES) $(CFLAGS)
autodeclination_test: $(SBUS2_FILES)
$(CC) -o autodeclination_test $(AUTODECLINATION_FILES) $(CFLAGS)
st24_test: $(ST24_FILES)
$(CC) -o st24_test $(ST24_FILES) $(CFLAGS)
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ mixer_test sbus2_test autodeclination_test st24_test sf0x_test
-28
View File
@@ -1,28 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <systemlib/mixer/mixer.h>
#include <systemlib/err.h>
#include <drivers/drv_hrt.h>
#include <px4iofirmware/px4io.h>
#include "../../src/systemcmds/tests/tests.h"
#include <geo/geo.h>
int main(int argc, char *argv[]) {
warnx("autodeclination test started");
if (argc < 3)
errx(1, "Need lat/lon!");
char* p_end;
float lat = strtod(argv[1], &p_end);
float lon = strtod(argv[2], &p_end);
float declination = get_mag_declination(lat, lon);
printf("lat: %f lon: %f, dec: %f\n", lat, lon, declination);
}
-14
View File
@@ -1,14 +0,0 @@
#include <systemlib/mixer/mixer.h>
#include <systemlib/err.h>
#include "../../src/systemcmds/tests/tests.h"
int main(int argc, char *argv[]) {
warnx("Host execution started");
char* args[] = {argv[0], "../../ROMFS/px4fmu_common/mixers/IO_pass.mix",
"../../ROMFS/px4fmu_common/mixers/FMU_quad_w.mix"};
test_mixer(3, args);
test_conv(1, args);
}
+6
View File
@@ -24,6 +24,8 @@ MODULES += drivers/l3gd20
MODULES += drivers/mpu6000
MODULES += drivers/hmc5883
MODULES += drivers/ms5611
#MODULES += drivers/ll40ls
MODULES += drivers/trone
#MODULES += drivers/mb12xx
MODULES += drivers/gps
MODULES += drivers/hil
@@ -60,6 +62,7 @@ MODULES += modules/commander
MODULES += modules/navigator
MODULES += modules/mavlink
MODULES += modules/gpio_led
MODULES += modules/land_detector
#
# Estimation modules (EKF / other filters)
@@ -132,6 +135,9 @@ MODULES += lib/launchdetection
# Hardware test
#MODULES += examples/hwtest
# Generate parameter XML file
GEN_PARAM_XML = 1
#
# Transitional support - add commands from the NuttX export archive.
#
+11 -4
View File
@@ -27,13 +27,15 @@ MODULES += drivers/l3gd20
MODULES += drivers/hmc5883
MODULES += drivers/ms5611
MODULES += drivers/mb12xx
MODULES += drivers/sf0x
# MODULES += drivers/sf0x
MODULES += drivers/ll40ls
# MODULES += drivers/trone
MODULES += drivers/gps
MODULES += drivers/hil
MODULES += drivers/hott/hott_telemetry
MODULES += drivers/hott/hott_sensors
MODULES += drivers/blinkm
# MODULES += drivers/hott
# MODULES += drivers/hott/hott_telemetry
# MODULES += drivers/hott/hott_sensors
# MODULES += drivers/blinkm
MODULES += drivers/airspeed
MODULES += drivers/ets_airspeed
MODULES += drivers/meas_airspeed
@@ -69,6 +71,7 @@ MODULES += modules/navigator
MODULES += modules/mavlink
MODULES += modules/gpio_led
MODULES += modules/uavcan
MODULES += modules/land_detector
#
# Estimation modules (EKF/ SO3 / other filters)
@@ -85,6 +88,7 @@ MODULES += modules/fw_pos_control_l1
MODULES += modules/fw_att_control
MODULES += modules/mc_att_control
MODULES += modules/mc_pos_control
MODULES += modules/vtol_att_control
#
# Logging
@@ -141,6 +145,9 @@ MODULES += modules/bottle_drop
# Hardware test
#MODULES += examples/hwtest
# Generate parameter XML file
GEN_PARAM_XML = 1
#
# Transitional support - add commands from the NuttX export archive.
#
+14 -4
View File
@@ -32,6 +32,7 @@ MODULES += systemcmds/tests
MODULES += systemcmds/nshterm
MODULES += systemcmds/mtd
MODULES += systemcmds/ver
MODULES += systemcmds/top
#
# Testing modules
@@ -50,16 +51,25 @@ MODULES += lib/mathlib/math/filter
MODULES += lib/conversion
#
# Modules to test-build, but not useful for test environment
# Example modules to test-build
#
MODULES += examples/flow_position_estimator
MODULES += examples/fixedwing_control
MODULES += examples/hwtest
MODULES += examples/matlab_csv_serial
MODULES += examples/px4_daemon_app
MODULES += examples/px4_mavlink_debug
MODULES += examples/px4_simple_app
#
# Drivers / modules to test build, but not useful for test environment
#
MODULES += modules/attitude_estimator_so3
MODULES += drivers/pca8574
MODULES += examples/flow_position_estimator
#
# Libraries
# Tests
#
LIBRARIES += lib/mathlib/CMSIS
MODULES += modules/unit_test
MODULES += modules/mavlink/mavlink_tests

Some files were not shown because too many files have changed in this diff Show More