897 Commits

Author SHA1 Message Date
Daniel Agar
0dc8bb9c86
uORB: increase ORB_MULTI_MAX_INSTANCES 4 -> 10
- put more realistic bounds on maximum number of battery instances, gps, etc
2020-09-24 11:01:28 -04:00
Daniel Agar
8579b5dd26
uORB: Subscription add copy/move constructor and assignment 2020-09-23 10:04:54 -04:00
Daniel Agar
94f7b50970 uORB: add Subscription method to change instance 2020-09-03 15:41:33 -04:00
Daniel Agar
19b43b5e9c uORB:: SubscriptionMultiArray fix construction argument
- uORB::SubscriptionInterval construction requires the interval THEN the instance
2020-09-03 07:49:57 +02:00
Daniel Agar
6ff361479c
uORB: introduce SubscriptionMultiArray for working with multi-instances 2020-09-02 12:46:47 -04:00
Daniel Agar
27f23ac290 move initial sensor priority to parameters and purge ORB_PRIORITY
- CAL_ACCx_EN -> CAL_ACCx_PRIO
 - CAL_GYROx_EN -> CAL_GYROx_PRIO
 - CAL_MAGx_EN -> CAL_MAGx_PRIO
2020-08-21 10:12:13 -04:00
Daniel Agar
372866a22b uORB::DeviceNode replace SubscriptionData with uORB::SubscriptionInterval 2020-08-18 20:48:30 -04:00
Daniel Agar
b6a17a6538
new IntrusiveSortedList container used for uORB, WorkQueues, and WorkItems
- new intrusive linked list container (c++ template) that sorts on insertion
 - primarily for convenience inspecting things in the system like uORB or WorkQueues
 - uorb status or top sorted alphabetically 
 - work_queue status threads sorted by priority, then items sorted alphabetically within each
2020-08-04 11:09:41 -04:00
Daniel Agar
c40cf9a626
uORB: remove lost message count per DeviceNode
- update 'uorb status' to print basic info for all advertised DeviceNodes
 - report vehicle_command gaps in commander, navigator, mavlink
2020-08-04 10:34:11 -04:00
Matthias Grob
a6777e2650 Subscription: correct doxygen comment 2020-07-30 09:56:01 -04:00
Daniel Agar
7b46efaa6b logger: record message gaps 2020-07-29 13:36:22 -04:00
Daniel Agar
b8b19f6166
cdev: posix remove std::map usage
- this is to make things a little easier for platforms like QuRT (voxl snapdragon) where there are libstdc++ complications
2020-07-21 10:17:55 -04:00
Daniel Agar
f55ed0992c
accel and gyro calibration refactor and cleanup
- remove all remaining IOCTLs for accel and gyro and handle all calibration entirely in sensors module with parameters
 - sensor_accel and sensor_gyro are now always raw sensor data
 - calibration procedures no longer need to first clear existing values before starting
 - temperature calibration (TC) remove all scale (SCL) parameters
    - gyro and baro scale are completely unused
    - regular accel calibration scale can be used (CAL_ACC*_xSCALE) instead of TC scale
2020-06-17 22:50:09 -04:00
Daniel Agar
31fe7af454 selectively increase optimization -Os -> -O2
- targetted at modules/libraries that benefit without drastically
increasing flash usage
 - ignored on boards with CONSTRAINED_FLASH set
2020-06-04 20:59:52 -04:00
Daniel Agar
51a36f0b61 sensors/vehicle_imu: improve initial sensor interval monitoring
- add perf counters for monitoring
2020-05-31 21:41:37 -04:00
Daniel Agar
e34bdb4be9
move IMU integration out of drivers to sensors hub to handle accel/gyro sync
- IMU integration move from drivers (PX4Accelerometer/PX4Gyroscope) to sensors/vehicle_imu 
 - sensors: voted_sensors_update now consumes vehicle_imu
 - delete sensor_accel_integrated, sensor_gyro_integrated
 - merge sensor_accel_status/sensor_gyro_status into vehicle_imu_status
 - sensors status output minor improvements (ordering, whitespace, show selected sensor device id and instance)
2020-05-30 11:07:54 -04:00
Daniel Agar
aa380f351f uORB: SubscriptionInterval last update shift forward with interval 2020-05-07 13:18:09 -04:00
Daniel Agar
7cf8a7ca64 uORB top readd initial clear screen 2020-05-07 09:31:15 +02:00
Daniel Agar
a2d170d850 uORB: top output improvements
- sleep slightly longer than 1s to capture 1 Hz topics
 - round msg rate calculation
 - add topic size to outpu
 - by default only print topics with subscribers
 - clear previous output (past cursor)
2020-05-07 09:31:15 +02:00
Daniel Agar
466b5db36f
uORB::Publication improvements and cleanup (#14784)
- create common uORB::PublicationBase
 - uORB::PublicationQueued types are now type aliases
 - ORB_PRIO use enum type everywhere to avoid accidental misuse
 - PX4Accelerometer/PX4Gyroscope/etc driver libs explicitly advertise on construction, unadvertise on destruction. This is a workaround for any potential issues that might appear when accel/gyro cdev and uORB indexing doesn't align.
2020-05-04 11:09:30 -04:00
Daniel Agar
5fcd7932e9
mavlink: replace MavlinkOrbSubscription with uORB::Subscription
* uORB orb_stat() and update(uint64_t *time, void *dst) are now obsolete and have been deleted
 * mavlink messages add more advertised checks in streams get_size() check to improve data rate calculation across different scenarios
2020-03-14 12:52:46 -04:00
Daniel Agar
0eca583ecf sensors: move baro aggregation to new sensors/vehicle_air_data 2020-03-12 19:06:34 -04:00
Daniel Agar
9585055e9e
uORB: add bitset for faster orb_exists check and remove uORB::Subscription lazy subscribe hack/optimization
- add PX4 bitset and atomic_bitset with testing
 - add uORB::Subscription constructor to take ORB_ID enum
 - move orb test messages into msg/
2020-03-11 09:06:33 -04:00
Daniel Agar
d7e502ec72 uORB_tests increase stack 2020-02-27 21:12:49 +01:00
Daniel Agar
2410b31662
sensors: move accel filtering to sensors/vehicle_acceleration
I've added a queue depth of 4 for sensor_accel and sensor_gyro. This is initially added because it's not always possible for the `vehicle_acceleration` to keep up with every publication of the primary accelerator as it runs in the same thread as ekf2, various controllers, etc. 

Later this mechanism will be used in a few areas
 - rate limit `vehicle_angular_velocity` and `vehicle_acceleration` without missing any raw data
 - move IMU integration to `vehicle_imu` and out of the actual driver threads, eliminating the need for sensor_accel_integrated and sensor_gyro_integrated
 - integrate raw gyro synchronized with optical flow measurements
2020-01-29 16:13:38 -05:00
Daniel Agar
98042bf58f
uORB: introduce SubscriptionBlocking
- uORB::SubscriptionBlocking is a specialized uORB::Subscription that allows you to do a blocking read
 - this is intended to be an easy to use, hard to misuse replacement for the typical orb fd + poll pattern we've relied on historically
2020-01-22 17:56:28 -05:00
Daniel Agar
de4f594937 DriverFramework purge
The bulk of this change was tightly coupled and needed to be deleted in one pass. Some of the smaller changes were things that broke as a result of the initial purge and subsequently fixed by further eradicating unnecessary platform differences. Finally, I deleted any dead code I came across in the related files I touched while going through everything.

 - DriverFramework (src/lib/DriverFramework submodule) completely removed
 - added dspal submodule in qurt platform (was brought in via DriverFramework)
 - all df wrapper drivers removed
 - all boards using df wrapper drivers updated to use in tree equivalents
 - unused empty arch/board.h on posix and qurt removed
 - unused IOCTLs removed (pub block, priv, etc)
 - Integrator delete methods only used from df wrapper drivers
 - commander: sensor calibration use "NuttX version" everywhere for now
 - sensors: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
 - battery_status: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
 - cdev cleanup conflicting typedefs and names with actual OS (pollevent_t, etc)
 - load_mon and top remove from linux boards (unused)
 - delete unused PX4_MAIN_FUNCTION
 - delete unused getreg32 macro
 - delete unused SIOCDEVPRIVATE define
 - named each platform tasks consistently
 - posix list_devices and list_topics removed (list_files now shows all virtual files)
2020-01-13 14:07:03 -05:00
Daniel Agar
0f3bb94ff7 uORB_test: initialize timings storage
- fixes Coverity CID 341740
2020-01-05 22:59:49 -05:00
Daniel Agar
b4fa915c86 uORB_tests: fix queue simulation and cleanup initializations 2019-12-09 16:50:33 -05:00
Beat Küng
86eb91fc18 uorb: do not open a node exclusively for an advertiser
Exclusive open is not required, but we now need to ensure the queue size
is set atomically.

It avoids a race condition between 2 single-instance advertisers,
where one of them would fail to open the node with -EBUSY.
2019-11-23 10:10:05 -05:00
Beat Küng
6c8048d057 uorb: fix several race conditions during topic initialization
Possible race conditions (they all happen between the check of existence
of a topic and trying to create the node):
- single instance, with multiple advertisers during the first advertise:
  both advertisers see the topic as non-existent and try to advertise it.
  One of them will fail, leading to an error message.
  This is the cause for telemetry_status advert failure seen in SITL in
  rare cases.
- multi-instance: subscription to non-existing instance -> px4_open fails,
  and the subscriber tries to create the node. If during that time a
  publisher publishes that instance, the subscriber will get (instance+1)
  (or fails if the max number of instances is exceeded).
  This is a race that goes pretty much unnoticed.
- multi-instance: 2 publishers can get the same instance (if is_published()
  is false in case both have not published data yet).
  This can also go unnoticed.
  Therefore the patch changes where _advertised is set: it is now set
  directly during the advertisement instead of during publication.
2019-11-23 10:10:05 -05:00
Beat Küng
63b2befeed refactor uorb: rename published to advertised
No semantic change (yet)
2019-11-23 10:10:05 -05:00
Beat Küng
0f6f795aca uORBDeviceNode: use px4::atomic instead of volatile for _generation
_generation is read in a multi-threaded context w/o locking.
2019-11-23 10:10:05 -05:00
Daniel Agar
f271efaf62 local_position_estimator: move to WQ and delete unused SubscriptionPollable 2019-11-22 16:02:54 -05:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Daniel Agar
744f06cc8f clang-tidy: enable readability-delete-null-pointer and fix 2019-10-28 10:50:31 -04:00
Daniel Agar
279df3b1b8 clang-tidy: partially fix hicpp-use-equals-delete 2019-10-27 19:19:07 -04:00
Beat Küng
173337e49c uORBManager: print errno for advertisement failures
Helps with debugging.
2019-10-16 13:13:17 +02:00
Daniel Agar
fd67bd0680 uORB: SubscriptionCallback cleanup naming 2019-09-28 13:43:56 -04:00
Daniel Agar
78ef8aab2d STACK_MAIN increase default 1024 -> 2048 2019-08-30 19:11:51 -07: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
Daniel Agar
7d248e0f45
px4fmu: move to WQ with uORB callback scheduling (#12224) 2019-08-20 20:24:12 -04:00
Daniel Agar
d38dfcfcd3
uORB::Subscription fix initialization but not yet published case
- otherwise uORB::Subscription will erroneously report published after the first successful initialization of an unpublished topic
2019-08-20 10:28:09 -04:00
Daniel Agar
6413525645
uORB::PublicationQueued don't unadvertise on destruction (#12674)
* this is a bit of a hack for vehicle_command and vehicle_command_ack usage
2019-08-09 12:45:02 -04: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
Daniel Agar
e8a11086eb create uORB::PublicationMulti for multi publications 2019-08-08 21:01:56 -04:00
Daniel Agar
0a0c404a08 mavlink receiver move to uORB::Publication 2019-08-08 21:01:56 -04:00
Daniel Agar
8f5b7de498
uORB::Subscription minor API cleanup
* the forceInit() method was combined with the existing subscribe()
 * delete unused last_update()
2019-08-06 10:28:49 -04:00
Daniel Agar
e69398c09f introduce uORB::PublicationQueued and transition most orb_advertise_queue usage 2019-08-04 10:08:09 -04:00
Daniel Agar
136962d125
uORB Subscription callbacks with WorkItem scheduling on publication (#12207) 2019-06-17 16:26:06 +02:00