Beat Küng
f58079bc5d
pxh.cpp: fix invalid reference if words is empty
...
This can happen for example if 'line' is a space.
2019-05-24 11:06:41 -04:00
Julian Oes
7a768dbab3
lockstep_scheduler: always use the same code
...
This define was not set anyway, and in my opinion we should
not use different code for tests anyway.
2019-05-20 12:39:02 -04:00
Julian Oes
52099f5792
cmake: include lockstep_scheduler test
...
This makes sure we add the lockstep_scheduler_test even if the
ENABLE_LOCKSTEP_SCHEDULER is not set to yes. This means the
lockstep_scheduler is not used for SITL but the CMakeLists.txt file
still used and the test added.
2019-05-20 12:39:02 -04:00
Julian Oes
8d8799097d
lockstep_scheduler: convert test to gtest
2019-05-20 12:39:02 -04:00
Daniel Agar
162405479b
device drivers lib add linux spi support
2019-05-20 12:18:56 -04:00
Matthias Grob
cbd230e34e
Testing: Clean up unit_test target because test_results does all tests now
2019-05-09 09:42:46 +02:00
Matthias Grob
542f61f04b
testing build: add possibility to filter tests with ctest regex
2019-05-09 09:42:46 +02:00
Matthias Grob
5a90382cb8
sitl_tests: add prefix "sitl-" for regex test filtering
2019-05-09 09:42:46 +02:00
Matthias Grob
5020dfdc3d
Testing: switch unit tests to BUILD_TESTING
2019-05-09 09:42:46 +02:00
Beat Küng
2448a84c36
SITL: add if750a model
2019-05-03 13:32:48 +02:00
Daniel Agar
b9516d7e38
mixer move test_mixer_multirotor into cmake
2019-04-07 16:12:17 -04:00
Nico van Duijn
b7784a1439
Add MAVLink stream and cmake sitl target
2019-04-02 08:17:13 +02:00
Daniel Agar
b35d048566
cmake enable -Wcast-align and disable per module
2019-03-16 11:47:15 -04:00
Julian Oes
b54ca67de9
lockstep_scheduler: check if mutex is still valid
...
It turns out that we can fix the unit tests of the lockstep_scheduler
just by checking if `passed_lock` is not `nullptr`.
Without this check, the unit tests segfaulted.
2019-03-15 13:38:11 +01:00
Daniel Agar
edad4c40c3
containers add IntrusiveQueue and testing
2019-03-14 09:22:19 +01:00
Beat Küng
505b1aca2c
lockstep_scheduler: work around a potential dead-lock for canceled threads
2019-03-08 12:22:45 -05:00
Beat Küng
e999075ac7
lockstep_scheduler: fix system_sleep -> system_usleep
...
The effect was that threads that tried to exit were unnecessarily kept
running.
This did not cause problems except for increased resource usage.
2019-03-08 12:22:45 -05:00
Beat Küng
08298ab3d0
drv_hrt: make lockstep_scheduler a pointer
...
This solves a potential dead-lock when trying to shutdown: a call to exit()
stops all threads and calls all destructors for static objects.
The destructor of LockstepScheduler takes a lock. However this is not
safe, as the lock could already be taken (by any thread).
2019-03-08 12:22:45 -05:00
Daniel Agar
e2bf4b1894
List container improvements and testing
...
- support range based for loops
- add remove() method to remove a node
- add clear() to empty entire list and delete nodes
- add empty() helper
2019-03-01 21:01:04 -05:00
Daniel Agar
e4b3c8bcc6
tests enable bezier and search_min
2019-02-22 16:23:57 -05:00
Daniel Agar
7a1c8ea8cb
Update platforms/posix/src/lockstep_scheduler/CMakeLists.txt
...
Co-Authored-By: MaEtUgR <maetugr@gmail.com >
2019-02-04 21:31:06 +01:00
Matthias Grob
ffb8bb6066
lockstep_scheduler: correct cmake target includes
2019-02-04 21:31:06 +01:00
Matthias Grob
bda60ecfd6
posix main: hotfix for px4 application not exiting anymore
...
Some threads do not exit and are still running when
trying to exit SITL running under Windows in Cygwin.
This problem was introduced with:
- posix shell #10173 because of strating a child process
for the startup script and mixing up the signal handling
(only Ctrl+C broken)
- lockstep #10648 because of simulator threads not
stopping gracefully anymore with timing race conditions
(no graceful exit possible anymore)
I leave the SIGINT handler on its default implementation for
Cygwin which kills the process and all its threads when pressing
Ctrl+C.
This hotfix at least allows the usage of Ctrl+C again instead
of forcing the user to use the task manager to shut down
px4.exe going crazy on CPU load instead of exiting
everytime.
2019-01-28 09:38:49 +01:00
Beat Küng
74a3c378b2
drv_hrt: inline hrt_elapsed_time
...
GCC did not do that.
2019-01-25 07:53:37 +01:00
Daniel Agar
2ffb49b734
delete px4_includes.h header and update boards/ to use syslog
2019-01-23 18:25:18 -05:00
Lorenz Meier
3a7deefe6e
IO firmware: Run critical timing operations as atomic
...
This is required as we might be in interrupt context on this bare-metal target.
2019-01-22 23:52:57 +01:00
Lorenz Meier
c6718a5bca
Posix: Add initial stub for atomic HRT
...
The actual implementation is not atomic, as the value on the application layer would be limited.
2019-01-22 23:52:57 +01:00
Daniel Agar
320d2e9383
create PX4 platform layer initialization helper ( #11269 )
...
- starts requirements for PX4 modules (hrt, param, etc)
2019-01-22 14:13:20 -05:00
Beat Küng
4bc59092f4
lockstep_scheduler cmake: spaces -> tabs
2019-01-14 11:08:48 +01:00
Beat Küng
2a47715385
refactor lockstep_scheduler: fix class member naming convention
2019-01-14 11:08:48 +01:00
Beat Küng
828e31d3a9
lockstep_scheduler: optimize performance
...
- use a linked-list instead of std::vector. Insertion and removal are now
O(1)
- avoid malloc and use a thread_local instance of TimedWait.
It gets destroyed when the thread exits, so we have to add protection
in case a thread exits too quickly. This in turn requires a fix to the
unit-tests.
2019-01-14 11:08:48 +01:00
Beat Küng
ecbe2a3e0b
drv_hrt posix: improve performance for hrt_absolute_time()
...
Previously hrt_absolute_time() was at around 5% of the total CPU usage, now
it's around 0.35%.
2019-01-14 11:08:48 +01:00
Beat Küng
ccefc640ac
drv_hrt posix: remove unused code and remove locking from hrt_absolute_time
2019-01-14 11:08:48 +01:00
Beat Küng
5f0e6d70c5
lockstep_scheduler: use a static lock in usleep_until
...
less function calls
2019-01-14 11:08:48 +01:00
Beat Küng
e8cbc49f7a
lockstep_scheduler: remove timed_waits_iterator_invalidated_
...
Not required, since the lock is held during the whole loop iteration.
2019-01-14 11:08:48 +01:00
Beat Küng
8cdb65eed9
lockstep_scheduler: simplify LockstepScheduler::cond_timedwait & reduce locking
...
- the loop is not needed
- we optimize for the fast case and lock only if really needed
2019-01-14 11:08:48 +01:00
Beat Küng
318499f56e
lockstep_scheduler: inline get_absolute_time()
...
This is a small method that is used a lot.
2019-01-14 11:08:48 +01:00
karliss
6a33b797ac
drv_hrt restore dsp_offset and remove unused qurt code ( #11139 )
...
- Fixes #11134
2019-01-03 14:58:53 -05:00
Julian Oes
032e64aaf2
px4_sem: set errno, return -1 on any error
...
- Don't duplicate the ret variable to err.
- Return -1 on any error, 0 otherwise.
- Set errno to return value of pthread_cond_timedwait.
2019-01-01 20:35:42 +01:00
Julian Oes
23653f9f39
lockstep_scheduler: fix return value, remove errno
...
The API of cond_timedwait was wrong. It used return -1 and set errno
instead of returning the error as specified for pthread_cond_timedwait
which it tries to mock.
2019-01-01 20:35:42 +01:00
Lorenz Meier
0d0a556847
Fix usage of errno in POSIX semaphore error handling
...
Previous commit 98ae0186e9 changed the err variable to errno, which is not the return value we are looking for.
2019-01-01 20:35:42 +01:00
Julian Oes
8486b2b917
tests: properly disable shutdown test for Cygwin
2018-12-22 10:32:18 +01:00
Julian
0601214806
tests: disable shutdown and hysteresis for Cygwin
...
It seems that the hysteresis test fails every now and then, presumably
due to timing issues. The tests needs some improvements, e.g. isolating
it from the system time.
2018-12-22 10:32:18 +01:00
Julian Oes
ffb73f6496
platforms: fix redefinition for QURT
2018-12-22 10:32:18 +01:00
Julian Oes
14e5ebbbbc
platforms: fix clock build for macOS (yet again)
2018-12-22 10:32:18 +01:00
Julian Oes
06c5037025
platforms: use CLOCK_MONOTONIC
...
For the non-lockstep case we want to use CLOCK_MONOTONIC if possible.
2018-12-22 10:32:18 +01:00
Julian Oes
547dd8511b
platforms: use define for lockstep scheduler
...
Instead of using the define __PX4_POSIX_SITL it makes more sense to have
a define just to determine if the lockstep scheduler should be used.
2018-12-22 10:32:18 +01:00
Julian Oes
5280a4aba1
platforms: prevent wrap-arounds in px4_sleep
...
@bkueng found that the old implementation was likely to wrap-around
given seconds is only a uint32_t. We now cast it directly to uint64_t
and therefore should fix this problem.
2018-12-22 10:32:18 +01:00
Julian Oes
4efe4b0d15
platforms: reorg after rebase on new board config
...
The new board config changed everything, so I needed to move the
lockstep_scheduler repo.
2018-12-22 10:32:18 +01:00
Julian Oes
6d273f3bd8
px4_layer: modernize warnings
2018-12-22 10:32:18 +01:00