this allows Linux boards to trigger an external script on GPIO
writes. This can be hooked up to relays with either RC options or
mavlink or mission items to trigger actions that can be scripted
this is the first step to using AP_RCProtocol for most (or all) RC
input on Linux boards. It also fixes a major bug on Disco where the
old SBUS decoder didn't use strict enough timing checks to filter out
bad frames when video capture is running. That led to erratic flight
mode changes and sometimes loss of control.
This allows to use any device to send RCInput to Disco via network.
Particularly this is useful when paired to additional changes on
SkyController 2 so it can be used to control Ardupilot.
This was tested with https://github.com/lucasdemarchi/dema-rc running
on SkyController 2.
This should at most be behind a flag. If the device is being used by
other process/drivers, it's a problem with that specific user/distro:
don't penalize everybody else. Besides, changing the mode is not atomic
and nothing guarantees the other side doesn't get scheduled and change
it back before we get to run.
Do not create one thread per chardev (i.e. bus + kernel's chip select).
Since the shared resources are actually the bus controller and the bus
lines, it makes sense to have 1 thread per bus, otherwise it will just
get locked again on the mutex in the kernel side.
../../libraries/AP_HAL_Linux/Scheduler.cpp: In member function ‘void Linux::Scheduler::_debug_stack()’:
../../libraries/AP_HAL_Linux/Scheduler.cpp:127:47: warning: format ‘%zu’ expects a matching ‘size_t’ argument [-Wformat=]
_uart_thread.get_stack_usage());
^
The open coded version has the same problem fixed by Thread abstraction:
the order of the calls matters and it's easy to call in the wrong order.
Here pthread_attr_setschedparam() and pthread_attr_setschedpolicy()
should be swapped, like in 62c2f737d5 (AP_HAL_Linux: fix setting RT priorities.)
Minlure is a port of ArduPilot to Minnow Board connected to daughter
board. Very few of those were produced and nobody is flying with it.
It served its purpose and all the the improvements to ArduPilot remain
regardless of it not being supported anymore. Now it's just adding
maintenance work with no clear benefit, so pull the plug.
By the time we create the storage we hadn't still initialized the
buffer. Remove the writes during storage creation since ftruncate() will
take care of the file size aspect and MAX storage write chunk is taken
care by Linux according to the media/fs that is there.
In some point in past it may have been ttyS2, but right now on kernel
4.16+ the UART is on ttyS5. We could do like is done for I2C and search
on sysfs, but it requires additional changes.
Apparently this code came in part from libuavcan that defines this
struct Control. They also had the same issue detailed on
https://github.com/UAVCAN/libuavcan/issues/116.
The solution here is much simpler though: stick to the design of cmsg()
even if it's C. As per cmsg(3), use a union together with CMSG_SPACE().
Use a const variable instead of a define so we don't polute the
environment with a define specific to this function.
Also remove tabs and replace with proper coding style.
This adds a counter here to only loop to a maximum number of iterations.
Now we avoid situations in which we would be stuck processing packets here.
This also adds some other meaningful defines
Removes compile-time selection of RCInput driver for ocpoc_zynq.
PPM and SBUS input are now colocated on the ocpoc board, and it
only needs to run RCInput_ZYNQ. Pulse input is also inverted
to accommodate SBUS input, which has no effect on PPM input.
On kernels 4.7+ duty_cycle should always be less than period.
Otherways, we'll get a EINVAL.
It makes sense to set duty_cycle to 0, as
duty_cycle doesn't really make sense without a proper period.
A proper way to handle these errors might be to call pwm_adjust_config
in every pwmchip backend but it's unrealistic to hope that all vendors
will do it quickly.
If we are the controlling terminal for a tty device we will receive a
SIGHUP when the device disappears. Currently what happens is that we
simply stop the whole process. We don't want to fall off the sky due
to a bad device. This can happen for any reason, but it's more likely
if the UART is behind a USB connection.
These messages are only valid in a small subset of Linux boards (those
based on BBB and variants). The ToneAlarm class should actually be
split allowing different implementations, but for now let's just disable
the message.
It's not being sold, there are just a few (different) engineering
samples built and there are no plans for this to go forward for people
that were pushing it.
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.