Commit Graph

327 Commits

Author SHA1 Message Date
Daniel Agar fb7521eb5e cmake px4_base -> px4_parse_function_args 2019-09-15 14:36:38 -04:00
Beat Küng 43fdcd7876 px4_middleware: remove that header and move px4::init to px4_init.h
delete include:
for i in $(grep -rl 'px4_middleware.h' src platforms); do sed -i '/#include <px4_middleware.h/d' $i; done
2019-08-30 07:59:44 +02:00
Beat Küng f32abe8534 src/platforms: move remaining source files to platforms/common 2019-08-30 07:59:44 +02:00
Beat Küng f8e0441e7b src/platforms/common: move to platforms/common
Script to update include paths:
for i in $(grep -rl 'include <px4_work_queue' src platforms); do sed -i 's/#include <px4_work_queue/#include <px4_platform_common\/px4_work_queue/' $i; done
2019-08-30 07:59:44 +02:00
Beat Küng 5d0e72040c src/platforms/posix: move to platforms/posix/src/px4/common and src/drivers/driver_framework_wrapper 2019-08-30 07:59:44 +02:00
Beat Küng fa8165a1c3 platforms/posix/src: move to platforms/posix/src/px4/common 2019-08-30 07:59:44 +02:00
Beat Küng f3fccf53f6 src/drivers/{kinetis,stm32}: move to arch-specific directories 2019-08-30 07:59:44 +02:00
Beat Küng ab43a83bed platform: restructure (NuttX) architecture-specific code
updated: tone_alarm, px4io_serial, px4_micro_hal
2019-08-30 07:59:44 +02:00
roangel e50dd7c364 replay: close replay log file after replay is finished, then exit (#11264) 2019-08-28 08:13:50 +02:00
Julian Kent d70b024ec7
GTest functional tests that include parameters and uORB messaging (#12521)
* Add kdevelop to gitignore

* Add test stubs

* Rename px4_add_gtest to px4_add_unit_gtest

* Add infrastructure to run functional tests

* Add example tests with parameters and uorb messages

* Fix memory issues in destructors in uORB manager and CDev

* Add a more real-world test of the collision prevention
2019-08-09 15:10:09 +02:00
Anthony Lamping 5d986f2030 posix: add argument to change the CWD (#12482) 2019-08-01 12:25:35 -04:00
Julian Oes 35074aaffd posix: remove segfault handler
I could not get a core dump without removing the segfault handler, hence
this change.
2019-06-05 08:16:19 +02:00
Julian Oes f3620f7018 Remove all leftover PX4_BACKTRACE calls 2019-06-05 08:16:19 +02:00
Beat Küng 6e2b70cbcd posix: restore original SEGV signal handler upon first entry of our handler
The current SEGV handling on posix is not useful: as soon as our handler
is left, it's triggered again, infinitely.
This patch changes to restore the original handler, so the OS can create
a core dump, etc.
2019-05-29 08:30:52 +02:00
Julian Oes 7b9562e3b1 hysteresis: move out of systemlib, move to gtest
This moves the hysteresis test out of the systemlib and makes it its own
small library. Since it still depends on hrt_absolute_time this does not
link yet. My attempt to get all link dependencies together failed.
2019-05-27 09:57:50 +02:00
Daniel Agar e9ca5d5aba PX4 general work queue 2019-05-24 12:58:55 -04:00
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
Julian Oes c24f6ef943 platforms: lockstep_scheduler ain't no submodule 2018-12-22 10:32:18 +01:00
Julian Oes 357870377a platforms: try to get submodule checked out 2018-12-22 10:32:18 +01:00
Julian Oes e41518a08b platforms: clean up various build/linking issues
This makes sure lockstep is only built for SITL builds and fixes the
existing builds.
2018-12-22 10:32:18 +01:00
Julian Oes 843033d530 platforms: remove unused function 2018-12-22 10:32:18 +01:00
Julian Oes 98ae0186e9 px4_sem: use px4_sem on all POSIX system
This uses the "fake" px4_sem based on mutex and condition_variable on
all POSIX system, not just macOS and Cygwin. This means that we can
change px4_sem_timedwait under the hood and inject the simulated time.
2018-12-22 10:32:18 +01:00
Julian Oes 3e6e1f5c2b POSIX: use lockstep_scheduler to fake time
This integrates the lockstep_scheduler, so that the system time is set
by the mavlink HIL_SENSOR message.

This means that the speed factor is removed and the speed is entirely
given by the simulator.
2018-12-22 10:32:18 +01:00
Julian Oes f0ce300744 platforms: move latency_buckets to perf.c 2018-12-22 10:32:18 +01:00
Julian Oes fa8ac612ab POSIX: use C++ for drv_hrt (file was renamed) 2018-12-22 10:32:18 +01:00
Julian Oes 5df333fa96 POSIX: include lockstep_scheduler in build 2018-12-22 10:32:18 +01:00
Julian Oes fa31d95fd8 Renamed drv_hrt.c to drv_hrt.cpp 2018-12-22 10:32:18 +01:00
Julian Oes db6de38b19 Work in progress to support a speed factor in SITL
These contains some rough changes trying to get SITL to speed up by a
SPEED_FACTOR.

This platform time code probably requires some more thought and refactor
but this gets a demo at 4x working.
2018-12-22 10:32:18 +01:00
Julian Oes 5b9dea5604 Replacing usleep with px4_usleep
This is a step towards isolating time from the system.
2018-12-22 10:32:18 +01:00
TSC21 870c513aad readd CMAKE_RUNTIME_OUTPUT_DIRECTORY install for the posix build 2018-12-13 02:09:31 +00:00
TSC21 a6121e1655 Cmake build: do not change CMAKE_RUNTIME_OUTPUT_DIRECTORY if building with catkin 2018-12-13 02:09:31 +00:00
James Goppert c7eb21be86 Fix catkin/ROS build paths. 2018-12-13 02:09:31 +00:00
Kārlis Seņko c1d50d35d3 Move common shmem parameter declarations to shmem.h. 2018-12-11 09:21:15 -05:00
Daniel Agar fd8fe29ef3 vscode update targets and gdb debugging 2018-12-05 15:58:41 -05:00
Daniel Agar 1f8c0e79e8 cmake toolchains force cache cpu flags and don't append
- these flags were accumlating on top of each other anytime cmake had to reconfigure
2018-12-04 19:45:46 -05:00
Daniel Agar dbee6380ee cmake move custom upload helpers to boards/ 2018-12-04 19:45:46 -05:00
Daniel Agar 1efad64f0c bebop move flow driver to board directory 2018-12-04 01:06:54 -05:00
Daniel Agar d4e06e517a delete drv_gpio.h, modules/gpio_led, and fmu GPIO ioctls 2018-12-03 16:30:39 +01:00
Daniel Agar 48df19c8df move dyn_hello to examples and restore testing 2018-11-26 14:40:14 -08:00
Daniel Agar e45e7aa8a6 move posix/tests/hello to examples/hello and include everywhere 2018-11-26 14:40:14 -08:00
Daniel Agar c3448c19c4 make vcdevtest a generic cdev test 2018-11-26 14:40:14 -08:00
Daniel Agar 3e0a3559a9 cmake use standard mechanisms for settings flags 2018-11-26 14:40:14 -08:00
Daniel Agar 11be2b8873 cmake split px4_base into px4_add_module, px4_add_library, px4_add_common_flags 2018-11-26 14:40:14 -08:00
Daniel Agar fa0fe4cac6 cmake remove need for platform px4_add_board_os
- explicitly set TOOLCHAIN on all NuttX targets
2018-11-26 14:40:14 -08:00
Daniel Agar abb3817d31 boards new split VENDOR_MODEL naming convention 2018-11-26 14:40:14 -08:00
Daniel Agar f692ad04d0 boards organization 2018-11-26 14:40:14 -08:00
Mara Bos 3c660acca8 Add unit test for dynamically loading modules on posix. 2018-11-24 01:58:09 +01:00
Mara Bos d13836eb1e Add dynamic modules on Posix.
You can now add `DYNAMIC` as an option to `px4_add_module`, which will
cause that module to no longer be compiled into the px4 executable, but
instead produce a separate shared library file, which can be loaded and
executed with the new `dyn` command:

    pxh> dyn ./hello.px4mod start

This will load the shared object file `hello.px4mod` if it wasn't
already loaded, and execute its main function with the given arguments.
2018-11-24 01:58:09 +01:00
Mara Bos e9fb17c51a Always use FILE* for standard output.
The threads running commands for clients through the Posix daemon used
to write to a char buffer through snprintf (etc.) which was then written
directly to the file descriptor, whereas in the other case printf
(etc.) was used to write to stdout (FILE*). Both versions used some
macro's and repeated code to have the same output.

This change unifies these two cases by using a FILE* in both cases. The
(line) buffering is done by the standard C library's implementation
(just like with stdout), and px4_log.c now uses the same code in all
cases (using fprintf, etc.) for printing (colored) output.
2018-11-23 12:15:41 +01:00
Daniel Agar 75c1396ed7 cmake sitl_tests silence debug message 2018-11-21 18:13:21 +01:00
Matthias Grob be16baaa3c sitl_tests: exclude uorb test from Windows build
Because it was always failing from the beginning on and
we want to make sure no other tests break in the meantime
by running the currently passing tests also on Windows CI.
2018-11-21 14:25:11 +01:00
Daniel Agar 26bac9594f add simple SITL shutdown test 2018-11-16 16:43:19 -05:00
Daniel Agar 4278dd8fb4 posix px4_layer fix style 2018-11-16 09:53:28 -05:00
dkang 4901f8a1dc
add execption check after malloc 2018-11-16 08:15:26 +01:00
Mara Bos c882ca9389 On Posix: Don't shutdown (half) the connection from the client.
This triggered POLLHUP too early on Mac.
2018-11-14 17:36:29 +01:00
Mara Bos 9594ebf72e Use unix sockets instead of pipes for posix daemon. (#10766)
Unlike pipes, unix sockets provide bi-directional
communication with each connected client.

- No need to generate a unique uuid per client anymore.

- The client doesn't have to create its own pipe anymore.

- Since there is no risk of multiple client's writes getting mixed up,
  messages don't need to fit in a single write anymore, removing the
  limit on command length.

- Since the server can detect a connection closing, the client no longer
  needs to handle signals. When the client is killed, the connection is
  automatically closed, which will cause the server to kill the related
  px4 thread.
  Since this does not rely on handling signals and the client sending an
  additional message, this is much more reliable.

- Client is no longer a singleton.

- The protocol is simplified. Standard output is directly written to the
  socket back to the client, without wrapping it in any protocol
  message.

- Because of the simple protocol, one could now even use netcat to run a
  px4 command:

    $ echo hello | netcat -UN /tmp/px4-sock-0

Also removes a few race conditions.
2018-11-13 14:31:22 -05:00
Daniel Agar 246b879aea require MODULE_NAME 2018-11-10 13:52:34 -05:00
Mara Bos 10c20b38ad Fix many format strings.
Fixes these invalid format strings:
- A `%d` for a pointer (replaced it by `%p`)
- A 0x%08x (and a 0x%0x8!) for a pointer (replaced by %p)
- 2 cases of `%d` for a `ssize_t` (replaced it by `%zi`)
- 1 case of a %u for an `int` (replaced by %i)
- 3 cases of %d for a `long` (replaced by %ld)
- 19 cases of `%d`, `%i`, `%u` or `%lu` for a `size_t` (replaced it by `%zu`)
- An unused formatting argument (removed it)
- A missing `%d` (added it)
- A missing `%s` (added it)
- 2 cases of `%llu` for a `uint64_t` (replaced it by `"%" PRIu64`)
- 6 cases of giving a string directly as format string (replaced it by `("%s", string)`)
- 2 cases of %*-s, which should probably have been %-*s.
  (Looks like NuttX accepts (the invalid) %*-s, but other platforms don't.)
- A %04x for a `uint32_t` (replaced by "%04" PRIx32)
2018-10-27 12:44:51 +02:00
TSC21 d3c1d5f019 sitl_gazebo: build with SEND_VISION_ESTIMATION_DATA set 2018-10-09 11:57:30 -04:00
David Sidrane ed9223edaf board_identity:Added common no-arch specific board_identity API
This common code can be used byt posix based boars to provide
   the board_identity API.
2018-10-03 10:30:10 +02:00
David Sidrane 347ac48eab posix:Added PX4 GUID API board_get_px4_guid_formated 2018-10-03 10:30:10 +02:00
Beat Küng b972651a06 posix shell: use /bin/sh instead of bash
This uses the systems default shell:
- Ubuntu: dash
- Fedora: bash

Since bash is invoked via /bin/sh, it operates in POSIX mode:
  https://tiswww.case.edu/php/chet/bash/POSIX

- remove '# Ignore the expand_aliases command in zshell.'
  Not needed because the shell operates in POSIX mode
- [[ is bashism -> use [
- autostart_files=( $autostart_file_match )
  is not supported in dash, so use 'ls'
- shellcheck runs the dash flavor, since dash is a minimalistic shell.

Tested on dash & bash.
2018-09-27 23:39:20 +02:00
Bart Slinger ea96501e8c bebop 2: upload entire bin directory content 2018-09-26 21:34:22 +02:00
Bart Slinger adad22f879 make set function work in sh 2018-09-26 21:34:22 +02:00
Bart Slinger 4df88122cb Bebop 2: use sh instead of bash 2018-09-26 21:34:22 +02:00
Matthias Grob fbd175c0c9 posix-shell server: switch pipe flag to read/write
to make it non-blocking and ommit opening the same
named pipe multiple times inside the same process
which seems to be not supported in cygwin.
2018-09-18 18:24:07 +02:00
Lukas Woodtli c1a58bda17 Add address sanitizer to SITL pipeline
- Environment variables for building with asan
- Docker argument for leak sanitizer
- Regex for tests to fail on sanitizer error

Signed-off-by: Lukas Woodtli <woodtli.lukas@gmail.com>
2018-09-16 09:40:53 +02:00
Roman 5847ab4607 posix main.cpp: better reporting e.g. when there are permission problems
- if somebody tries to use the shell with insufficient permissions he will be told so

Signed-off-by: Roman <bapstroman@gmail.com>
2018-09-14 14:43:08 +02:00
Daniel Agar 060463e8a7
parameters lib convert to c++ (#10267) 2018-09-04 09:18:28 -04:00
Beat Küng e26bfd2e79 SITL: remove config_sitl_rcS_dir
Not needed anymore
2018-08-31 14:21:56 -04:00
Beat Küng 4e6139d9fb Posix: add '#pragma GCC poison exit'
Generally exit() should not be used on Posix, because it exits the whole
program instead of only the task.
2018-08-31 18:11:58 +02:00
Daniel Agar 8ddb99971f tests template skip mavlink except for mavlink test 2018-08-30 11:13:24 -04:00
Bram Strack van Schijndel 918c397ae7 fixup! [Bebop 2] don't strip and upload to /data/ftp/internal_000 2018-08-30 09:48:26 +02:00
Bram Strack van Schijndel b678f8bc5b [Bebop 2] don't strip and upload to /data/ftp/internal_000 2018-08-30 09:48:26 +02:00
Daniel Agar 658b957888
Jenkins build and archive all packages (#10332) 2018-08-29 12:31:14 -04:00
Daniel Agar 72792cef43
posix-configs shell scripts use /bin/sh to maximize compatibility (#10292)
- fix ocpoc line endings
2018-08-25 11:02:37 -04:00
Daniel Agar 01744a9efc Jenkins px4fmu-v2 hardware test 2018-08-14 23:12:26 -04:00
Beat Küng 9d66bcefd3 posix main: print script failure as an error instead of a warning 2018-08-13 21:50:14 -04:00
Beat Küng 1318e614ad SITL: handle 'make posix_sitl_shell' via unified rcS
The command is now: 'make posix none_shell'
which means: don't start a simulator and run a minimal shell only.
2018-08-13 21:50:14 -04:00
Beat Küng ab7f68f2ad ekf2 replay: refactor to use unified rcS scripts 2018-08-13 21:50:14 -04:00
Beat Küng e5ed05766d px4_daemon server: fix startup race condition
The FIFO was created in the server thread, and the PX4 main thread could
already have continued and started to execute the bash script.
In that case the client tried to open the FIFO but it did not exist yet.

Client error:
ERROR [px4_daemon] pipe open fail
ERROR [px4_daemon] Could not send commands
2018-08-13 14:26:41 +02:00
Beat Küng 52168f9665 px4_daemon client: improve error output 2018-08-13 14:26:41 +02:00
Beat Küng ffffcaeb0f px4-alias.sh_in: move to platforms/posix/src/px4-alias.sh_in 2018-08-08 21:09:39 +02:00
Beat Küng 23b12f02e7 cmake: fix install target (add bin dir which includes the symlinks and px4-alias.sh) 2018-08-08 21:09:39 +02:00
Beat Küng 5363aff879 fixes for integration and unit tests
Move ros logs dir so that .ulg files are not in the same directory
(mission_test.py:: get_last_log() fails otherwise)
2018-08-08 21:09:39 +02:00
Beat Küng 0edd7c93e1 posix main: check for ROS argument 2018-08-08 21:09:39 +02:00
Beat Küng a5de82aaa8 cmake: add documentation for px4_posix_generate_alias and px4_posix_generate_symlinks 2018-08-08 21:09:39 +02:00
Beat Küng ec09379813 px4_daemon: fixes for clang-tidy
Also ignore the warning:
error: calling 'system' uses a command processor [cert-env33-c,-warnings-as-errors]
2018-08-08 21:09:39 +02:00
Beat Küng efb202106f bbblue: required changes for posix shell 2018-08-08 21:09:39 +02:00
Beat Küng e6d71680ab px4_daemon server: fix packet reading
By reading sizeof(packet), it could have happened that 2 packets at once
were read, and the second one was then ignored.
This makes sure that only one packet at a time is read.

The other 2 changes are for efficiency.
2018-08-08 21:09:39 +02:00
Beat Küng 1f0655302c px4_daemon: fix locking
It was not enough to lock individual accesses to the maps.
For example it could happen that a thread was started and exited very
quickly, before the pthread_t item was inserted into the map, such
that when the cleanup method was called, the thread and pipe fd were not
found (and fd=0=stdin was closed).
2018-08-08 21:09:39 +02:00
Beat Küng 5b171bd614 px4_daemon: fixes for packet length computation
The enum change from uint8_t to an int avoids uninitialized bytes,
which led to valgrind warnings (no error though).
2018-08-08 21:09:39 +02:00
Beat Küng d90ac975a7 posix shell: required updates for RPi, bepob, ocpoc, eagle & exxcelsior
- RPi works
- the rest is not tested, and requires a bit more
  (such as uploading the bin/ directory)
2018-08-08 21:09:39 +02:00
Beat Küng d05b268d19 posix shell: allow to run multiple instances 2018-08-08 21:09:39 +02:00
Beat Küng 7822e5b5c3 posix shell: lots of cleanup and fixes
- move posix-configs/SITL/init/{rcS,10016_iris,6011_typhoon_h480} to ROMFS/px4fmu_common/init.d-posix
  allows for easier unification, only one symlink is required.
  - rcS: add AUTOCNF support. Update scripts to match with behavior of PX4
    master (parameter values, some sitl driver got removed)
- add alias to allow 'set variable value' syntax in scripts to px4-alias.sh
- use px4_getopt
- use separate argument for the test_data directory
- append PATH from within the px4 binary: this simplifies the usage
  w/o the sitl_run.sh script.
- add 'source px4-alias.sh' to all existing sitl startup scripts
- move sitl mixers to ROMFS/px4fmu_common/mixers-sitl
  makes it easier to use existing mixers and sitl-specific ones.
- remove unused rcS_gazebo_delta_wing
2018-08-08 21:09:39 +02:00
Beat Küng 413c09e20e posix main: some cleanup & fixes
- argv[0] can have the form ./px4-commander
- create eeprom directory
- fix fpe signal handler
2018-08-08 21:09:39 +02:00
Julian Oes 0c5c741b1a add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming

Commits:

tag_to_version.py: fix Python3 error

subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.

cmake: remove folder src/firmware

The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.

The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.

qshell: support for return value

Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.

adb_upload: create folders before pushing

Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.

posix: spawn PX4 modules in bash

This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.

Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.

This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.

SITL: use new client shell in SITL

This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.

More cleanup will be necessary for the rest of the SITL startup scripts.

Snapdragon: use new shell to start all modules

Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.

Snapdragon: fix the airframe description

pxh: argv needs to end with a nullptr

The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.

px4_posix_tasks: variable cleanup

The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.

Snapdragon: move some drivers to 4100 config

These drivers are supported by the community, so they go into the 4100
config.

Snapdragon: update 210qc platform

px4_daemon: use doxygen comments

apps.h_in: fix string printf: use .c_str()

px4_daemon: \b -> \n in printf

px4_daemon: handle error in generate_uuid (close the file on error)

posix main: some clarifications in comment (it's the symlinks not the script aliases)

cmake: remove new install command again

This one was probably wrong and untested. Installing needs revisiting.

POSIX: remove argument USES_TERMINAL

POSIX: copy init and mixer files for SITL

Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.

adb_upload.sh: remove leftover commented printf

POSIX main: just the pointer instead of memmove

POSIX main: remove chroot

chroot is removed because it hasn't been used anywhere and seems
untested.

px4_daemon: remove client pipe when cleaning up

px4_daemon: fail if the client pipe already exists

The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.

history: limit the number of history entries

This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).

px4_daemon: add a threadsafe map and use it

px4_daemon: whitespace

px4_daemon: fix client parsing

Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.

The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.

posix: changes sitl_run.sh and main.cpp cleanup

This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.

Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.

px4_log: cleanup log levels, now they make sense

Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.

dataman: fix path for bash shell

logger: fix paths for bash shell

mavlink: fix paths for bash shell

param: fix path for bash shell

inav: fix paths for bash shell

sdlog2: fix paths for bash shell

ROMFS: add forgotten mixer to list

SITL init: more models, more options

- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
  PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
  PX4_LOGGER.

rcS: fix string comparison

listener: use template file

Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.

px4_log: add PX4_INFO_RAW for raw printfs

This allows to do custom formatting but is still transported over
sockets to clients.

topic_listener: use PX4_INFO_RAW instead of printf

commander: use PX4_INFO_RAW for status

listener: rewrite to classes and factory

posix: fix some argument warnings

generate_listener.py: by accident changed shebang

listener: big refactor of the generator

Hopefully this makes it easier to read and change in the future.

rcS: manually take over rebase changes

listener: remove leftover try

listener: properly clean up topic instance

rcS: take over some vehicle specific changes

posix-configs: vehicle specifics to separate files

posix-configs: remove leftover lines

uORBDevices: new PX4_INFO_RAW instead of printf

px4_log: just use printf on NuttX

listener: use less binary space, strip on NuttX

generate_listener.py: remove commented code

cmake: fix syntax error from merge

px4_daemon: fixes after rebase of apps.h/cpp fix

px4_daemon: namespace missing

posix: only create stub for fsync on QURT

unitests: reduce dependencies of param test

This makes the unit test compile and link again after the bash changes.

QURT: some compile fixes after a rebase

SITL: arg change for sitl_run.sh to use rcS_test

This allows to use a custom startup file for testing.

SITL: add the folder test_data

SITL: implement shutdown command as systemcmd

The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.

px4fmu_test: same IO_pass mixer as px4fmu_default

px4fmu_test: use normal quad x mixer

There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged

POSIX: cleanup, dir and symlink fixes

This cleans up the logic behind the symlinking and creating directories.

POSIX: correct arg order in usage info

tests: fix paths for SITL tests

POSIX: printf fix

sitl_run.sh: try to make this run on Mac as well

cmake: try to make jenkins happier

Path cleanup, the bin is no longer in src/firmware

POSIX: fix symlink logic

SITL: prefix all exported env variables

cmake: fix path for ROS tests

integrationtests: fix log path

launch: try to make tets with ROS working again

px4_defines: fix after wrong merge deconflicting

px4_defines: get paths for POSIX correct

cmake: fix cmake arguments

This was fine with cmake 3.6 but did not work with cmake 3.2.2

cmake: use cp instead of cmake -E copy

cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.

ROMFS: fix build error after rebase

cmake: fix paths in configs

launch: use `spawn_model` again

cmake: various fixes after big rebase

param: path fixes after rebase

posix platform: fixes after rebase

test_mixer: fix screwed up rebase
2018-08-08 21:09:39 +02:00
Bob-F cc3727bfbd skip creation of self-pointing link 2018-08-06 13:32:36 +02:00
Bob-F e056aa3204 Roll back change that handles absent test_data directory 2018-08-06 13:32:36 +02:00
Bob-F 082ef85773 handled a document issue and the case of absent test_data directory 2018-08-06 13:32:36 +02:00
Bob-F 627ea3b23e update according to pull request review comments 2018-08-06 13:32:36 +02:00
Bob-F 2ece14bad1 Port PX4 to BeagleBone Blue Board using library librobotcontrol instead of a submodule 2018-08-06 13:32:36 +02:00
Daniel Agar b1d3bb0403
stop ignoring Wmissing-field-initializers and fix (#9912) 2018-07-22 12:45:52 -04:00
Dennis Mannhart 9c7c60ddc8 remove mc_pos_control_tests 2018-07-20 09:26:18 +02:00
vkotaru 96920e0370 AUTOPILOT_HOST address for Raspberrypi2/3 included in posix CMakeLists.txt 2018-07-18 22:31:32 +02:00
Daniel Agar 8599495082 uORB add ORB_COMMUNICATOR define to enable remote uORB 2018-07-01 16:03:03 +00:00
Daniel Agar 11d348ec4f microbench split into hrt, math, matrix, uorb 2018-07-01 09:25:22 +00:00
Daniel Agar 3ba97297d5 tests simple timing microbenchmark 2018-07-01 09:25:22 +00:00
Beat Küng 036b59f3de posix main: convert c to a char when extending add_string 2018-06-13 16:19:34 +02:00
Beat Küng 4eda0ed782 posix main shell: fix getchar() return value and check for EOF to avoid busy loop 2018-06-13 16:19:34 +02:00
Elia Tarasov 981db0e21d add iris_vision sitl model 2018-06-10 21:26:44 -04:00
Daniel Agar 3e843ba2d2 posix main add SIGSEGV handler 2018-05-28 08:40:05 +02:00
Anthony Lamping 780d147c01 cmake: package don't use bin and share dirs 2018-05-25 01:32:26 -04:00
Anthony Lamping ef5de4de87 cmake: package create tarball 2018-05-25 01:32:26 -04:00
Anthony Lamping 0e80210f33 cmake: package px4 with sitl_gazebo plugins for jenkins ROS tests 2018-05-25 01:32:26 -04:00
Beat Küng 9772380779 posix main: avoid declaring px4_main_t, include the correct header instead 2018-05-09 07:59:46 +02:00
Daniel Agar 5de5d6ea49 Jenkins simple mission code coverage build 2018-05-05 19:49:50 -04:00
Daniel Agar 8404889098 delete unused ADCSIM
- set BOARD_NUMBER_BRICKS to 0 for boards without analog power bricks
2018-04-29 21:48:54 -04:00
Daniel Agar ea3acb7121 cmake remove circular linking and reorganize
- px4_add_module now requires MAIN
 - px4_add_library doesn't automatically link
2018-04-29 21:48:54 -04:00
Daniel Agar 735c5544ae tests add ctlmath and use float FLT_EPSILON 2018-04-09 02:23:26 -04:00
Roman 2886fe8da3 posix-configs: added sitl startup script for gazebo quad tiltrotor model
Signed-off-by: Roman <bapstroman@gmail.com>
2018-02-22 15:10:22 -05:00
Daniel Agar 102c0ead53 cmake consolidate px4 executable builds and upload 2018-02-01 09:00:13 -05:00
Daniel Agar 2ff81393bc move posix, nuttx, qurt components into platforms 2018-01-31 17:17:07 +01:00
Nicolas de Palezieux f600cfbb9f Add support for testing precision landing in SITL simulation 2018-01-15 10:27:23 +01:00
Matthias Grob be8adbfdf3 Cygwin: refactored & simplified some of the OS define logic 2018-01-05 14:47:33 -05:00
Matthias Grob 70de169f15 Cygwin: Enable build of SITL jMAVsim under Windows using the Cygwin Unix-like environment
Most of the incompatitbilities are luckily similar to the darwin build.
- New target OS __PX4_CYGWIN added because in other build environments on Windows defines will very likely be completely different
- added all necessary exeptions to the defines
- disabled priorities completely because on Windows they are defined 1-32 and with all the arbitrary +40 -40 priority settings there were a lot of problems
  not only did some threads/"virtual tasks" not start because of out of bound priorities but also the resulting scheduling was totally random and inadequate
  with default priorities it ran toally fine during my first tests, should be rethought when windows is used onboard in the future
2018-01-05 14:47:33 -05:00
Daniel Agar f2cd5e3e9f move src/firmware/ to platforms 2018-01-05 14:21:31 -05:00
Daniel Agar 678e2c415d move cmake/${OS} to platforms 2018-01-05 14:21:31 -05:00