There's an implicit (apart from the name) dependency between SPI and
SPIUARTDriver which results in a crush on a restart or a shutdown.
By moving the initialization we're making sure that all objects are
deleted in the right order.
_export_path and _duty_path will have been already long time gone by the
time dtors kick in.
Probably better to use OwnPtr around those. But it's better to be done
in a separate PR.
Checking the time on the tcpdump capture, it matches the first fields
from the data:
$ tshark -n -c 4 -r ~/tmp/solo/rc.pcap
1 0.000000 10.1.1.1 → 10.1.1.10 UDP 68 5005 → 5005 Len=26
2 0.019976 10.1.1.1 → 10.1.1.10 UDP 68 5005 → 5005 Len=26
3 0.040046 10.1.1.1 → 10.1.1.10 UDP 68 5005 → 5005 Len=26
4 0.059961 10.1.1.1 → 10.1.1.10 UDP 68 5005 → 5005 Len=26
From the previous commit (first 2 packets):
5fa8 f441 3414 0500 73d7 dc05 dc05 dc05 db05 e803 e803 e803 f401
73f6 f441 3414 0500 74d7 dc05 dc05 dc05 db05 e803 e803 e803 f401
0x0005143441f45fa8 - 0x0005143441f4f673 = 0x4E14 = 19988 (usec)
Which seems to approximately match for the other packets as well. We are
not using the field since we rather get the time when we receive it, but
at least use a better name.
If a thread other than the main one calls Scheduler::delay() we could
end up triggering the call of delay callbacks. Those should only ever
happen on the main thread.
We are setting a termination handler for some signals which are of not
interest. Just ignore them. Ignoring SIGWINCH allows for example to
run on a screen and change the window size later without killing
ardupilot.
RPI-based boards that use RCInput_RPI need more stack space otherwise we
end up with stack corruption. This leads to crash particularly when also
using GPIO_RPI since it may change what that driver is poking on memory.
This increases stack size to 1M which is overkill for most of other
boards with a more controllable stack usage. However this exposes that
on multiple different HWs a single point for stack size decision may not
be the best. This can be improved in future.
While at it, add final and override to mark this as being the overriden
final implementation of this method.
Thanks to Phillip Khandeliants (@khandeliants) for reporting.
While at it, add final and override to mark this as being the overriden
final implementation of this method.
Thanks to Phillip Khandeliants (@khandeliants) for reporting.
Integrate the gyro values pushed by the inertial sensor backend using
bias values sent by EKF.
Use the unblocking RingBuffer to avoid locking the callers.
- avoid trying to close fd when it's -1
- Keep includes sorted
- AP_HAL::panic() doesn't need \n terminator
- %u requires unsigned type
- #pragma once is the first thing on a header
when a library called read() it would clear the new input flag, which
would cause new_input() in the main loop to return false. This could
trigger a false RC failsafe.
When PWM_Sysfs_Base constructor is called, global variable hal may not
have been initialized resulting in NULL dereferencing error.
Move hal dependent stuff from contructor to init method.
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
Several return values in the constructor of the scheduler were ignored
before, while they should be respected.
I found that bug while strac'ing ardupilot as it failed at some later
point.
Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
This allows to terminate the flight stack nicely, ensuring it returns 0
so init system can check by return code if it terminated nicely or if it
was due to a crash.
This allows to wakeup the thread that is sleeping on Poller::poll()
[ which in our case is an epoll_wait() call ]. This is usually achieved
by using a special signal and using the pwait() variant of the sleeping
function (or using signalfd). However integrating the signal in the
Thread class is more complex than simply use the eventfd syscall which
can serve our needs.
Up until now we rely on Thread objects and variants thereof to be allocated
on heap or embedded in another object that's zero'ed on initialization.
However sometimes it's convenient to be able to use them on stack as
will be the case when writting unit tests.
Initialize all relevant fields to allow them to be used on stack. While
at it, prefer C++11 initialization on Poller since it's only setting the
default (invalid) value.
RC_Channel: To nullptr from NULL.
AC_Fence: To nullptr from NULL.
AC_Avoidance: To nullptr from NULL.
AC_PrecLand: To nullptr from NULL.
DataFlash: To nullptr from NULL.
SITL: To nullptr from NULL.
GCS_MAVLink: To nullptr from NULL.
DataFlash: To nullptr from NULL.
AP_Compass: To nullptr from NULL.
Global: To nullptr from NULL.
Global: To nullptr from NULL.
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.
Although the exchange opens opportunities for improvement and
simplification of this class.
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.
Although the exchange opens opportunities for improvement and
simplification of this class.
The constant passed to cflag is BOTHER, meaning the actual baud is set
in the other specific members. Don't define B* constants as they are
misleading here and this is why it doesn't work with e.g.
cfset[io]speed()... that function expect a B* constant which in Linux
is not the speed, but an index to an array with speeds.
Accidentally pushed in commit 298f7bffb9
The order of the motors shouldn't have been changed on version 5 because
it is specific to older versions of the ESC controller firmware