Commit Graph

750 Commits

Author SHA1 Message Date
Beat Küng 0f2b31b41e uorb: inline orb_advertise (directly calls orb_advertise_multi)
reduces the stack depth
2016-11-06 14:48:20 +01:00
Beat Küng 3029555016 uORBUtils: remove #include <string>
Avoid including <string> which can cause problems on NuttX
2016-10-24 10:22:48 +02:00
Beat Küng 1bdad65849 uorb: reduce RAM usage by avoiding string copies
The lifetime of the string is guaranteed because we never delete
DeviceNode objects and the strings in question are already on the heap.

This frees roughly 2.2KB of RAM on Pixracer
2016-10-23 15:25:20 +02:00
Beat Küng c50e4a6e21 uORB::DeviceNode: reduce the size of some members
The limits the maximum queue size to 255, which I think is ok for the
forseable future.

sizeof(uORB::DeviceNode) is reduces from 128 to 112 on NuttX, and with
~80 instances, this saves over 1KB of RAM.
2016-10-23 15:25:20 +02:00
Beat Küng 76733ce54b uorb tests: move orb metadata struct definition into cpp file
If they're in the header and the header is used in multiple .cpp, there
are multiple definitions. Oddly it did not lead to an error, but there
were multiple structs of the same topic but with different adresses.
This lead to a metadata mismatch, when running eg:
uorb_tests
uorb_tests latency_test
2016-09-30 13:50:51 +02:00
Beat Küng 549d456ec7 uorb devices: set errno on write error 2016-09-30 13:50:51 +02:00
Beat Küng 1d111cb254 px4_getpid: return the taskmap index instead of pthread_self()
this makes it consistent with other functions, like px4_task_spawn_cmd()
and px4_task_kill()
2016-09-30 13:50:51 +02:00
Julian Oes 8ff237c69f Remove size optimization for individual modules
It makes more sense to set the optimization flags on a platform basis
instead of individually for each module. This allows for different
optimization options for SITL, NuttX, Snapdragon, etc.
2016-09-30 08:11:51 +02:00
Beat Küng 92d160c431 uorb devices: fix for QuRT which has no poll() 2016-09-28 15:31:52 +02:00
Beat Küng 219ab519e3 uorb devices: rename queue_size() & meta() to avoid member shadowing 2016-09-28 15:31:52 +02:00
Beat Küng d1850f5112 uorb top: measure the elapsed time to give more accurate results 2016-09-28 15:31:52 +02:00
Beat Küng 52dde93a31 uorb: merge nuttx & posix files 2016-09-28 15:31:52 +02:00
Beat Küng f601428e82 uorb: add ifdef's where necessary to mitigate diffs between nuttx & posix
now the files are equal
2016-09-28 15:31:52 +02:00
Beat Küng f5654511b8 uorb: more syntax changes to remove diff between nuttx & posix files 2016-09-28 15:31:52 +02:00
Beat Küng 83c5323c3a uorb: remove syntax differences between posix & nuttx src file 2016-09-28 15:31:52 +02:00
Beat Küng fbd7aac4b5 uorb: add 'top' command for a live view of topic updates 2016-09-28 15:31:52 +02:00
Beat Küng 33fdb072df uORBMain: disable message logging to the ulog on Snapdragon 2016-09-01 09:59:17 +02:00
Beat Küng 528ca931af logger: only add data message to the log if orb_copy succeeds, when adding a new instance 2016-08-24 21:24:35 +02:00
Beat Küng df53fb0fde logging: publish a message for PX4_{WARN,ERR} & store them to the ulog file
- ulog file message rate limited to 50Hz
- queuing with size 2
- this replaces the mavlink log message in the ulog
  (but the mavlink warnings & errors still go to the ulog)
2016-08-24 21:24:35 +02:00
Beat Küng aefd217fc0 uorb subscription: remove _interval & use orb_get_interval() instead 2016-08-24 21:24:35 +02:00
Lorenz Meier 630cebeabc Relax uORB test for Darwin CI system 2016-08-07 14:05:03 +02:00
Lorenz Meier 207a04bba0 Fix uORB tests for Mac OS 2016-08-07 14:05:03 +02:00
Beat Küng c0e3ab632e orb: proper locking for DeviceNode::{add,remove}_internal_subscriber 2016-08-06 20:44:23 +02:00
Beat Küng b86cf2b017 orb status: print information about lost messages 2016-08-06 20:44:23 +02:00
Beat Küng 7280f71cef orb: rm static from DeviceMaster::_node_map & use the non-static getDeviceNode in uORB::Manager
Reasons:
- DeviceMaster::_node_map does not need to be shared among instances,
  because there is at most 1 instance per Flavor and different Flavors
  have non-intersecting device paths.
- Keeping it static would also require a static lock
- DeviceMaster::_node_map was not locked at all when used from
  uORB::Manager

So this fixes two synchronization issues:
- Different DeviceMaster objects could access the same static data in
  parallel
- getDeviceNode() called from uORB::Manager did not use any locking at all
2016-08-06 20:44:23 +02:00
Beat Küng 45a0a7c5ab refactor orb: uORB::Manager is responsible for the DeviceMaster objects
This has the following benefits:
- Manager can ensure that there is at most one instance of DeviceMaster
  per Flavor
- The Manager needs access to (static) data of DeviceMaster already.
  This will make it easier to access this data in a non-static way, and
  does not introduce new dependencies.
2016-08-06 20:44:23 +02:00
Julian Oes 5a262ec6bc uorb: came across a wrong comment 2016-07-29 17:44:50 +02:00
Lorenz Meier 6ab9dc0acf Testing cleanup from Daniel Agar 2016-07-29 13:49:14 +02:00
James Goppert a4ef364f80 Added innovation logging to LPE. (#5124) 2016-07-22 19:19:30 -04:00
James Goppert 9fcf121380 LPE: Don't use home as local origin (#5067) 2016-07-17 10:16:17 -04:00
Beat Küng ee58f0d11d encoders.msg: remove this topic, it's never published (#5074) 2016-07-15 14:59:52 -07:00
Beat Küng ffcefd9047 orb: read & apply publisher rules from file (currently disabled via #ifdef)
If enabled, orb reads a rules file (./rootfs/orb_publisher.rules) on
startup. This can contain rules about which module is allowed to publish
which topic. It is completely transparent, so a publisher does not know
if he's not allowed to publish, and publications will look as if they
succeeded.

To test, add
#define ORB_USE_PUBLISHER_RULES
to uORBManager.hpp
2016-07-07 12:51:42 +02:00
Beat Küng e7f31393bc orb: reduce size of SubscriberData struct (#4771)
- priority field uses only the lower 8 bits, so we can merge with the
  update_reported flag
- orb_set_interval is not used often, so make the necessary data an
  optional pointer and alloc only when needed.

Memory savings:
- pixracer (w. ekf2): 7.3kB
- pixhawk: 5.3kB
2016-06-22 15:28:23 +02:00
Julian Oes 6b1bcef644 uORBManager: removed printfs 2016-06-07 22:10:56 +02:00
Beat Küng f5310ca51e orb: avoid unnecessary string duplication of objname 2016-06-06 23:27:16 +02:00
Beat Küng 5125fc3a81 uORBDevices::SubscriberData: remove unused member poll_priv 2016-06-06 23:27:16 +02:00
Beat Küng e709048fb8 orb: add orb_get_interval to API 2016-06-06 23:27:16 +02:00
Beat Küng 069dd01cb0 logger: subscribe to mavlink_log messages and write them to the log 2016-06-02 07:32:49 +02:00
Beat Küng 43d734ef43 orb: consistently use unsigned int for queue_size 2016-06-02 07:24:44 +02:00
Beat Küng 392c32d316 uORBTest_UnitTest.cpp: fix style 2016-06-02 07:24:44 +02:00
Beat Küng 79b3766544 orb: add unit tests for queuing, including tests with poll & notify interface
Both succeed under Posix & NuttX (Pixracer)
2016-06-02 07:24:44 +02:00
Beat Küng 5b1273e334 orb: add optional queuing of messages
This adds two uORB API calls:
- orb_advertise_queue
- orb_advertise_multi_queue

Both add a queue_size parameter to define a maximum number of buffered
item. The existing orb calls use all a queue size of one and thus their
behavior is unchanged. If a writer publishes too fast, the oldest elements
from the queue are silently dropped.
The returned timestamp is always the one from the latest message in the
queue.

Queue size can be set via ioctl during advertisement phase. After that it
cannot be changed anymore.
2016-06-02 07:24:44 +02:00
Lorenz Meier 7398164fcc Updated PX4 use / API of low level GPIO and other hardware-centric system facilities 2016-05-28 14:56:17 +02:00
Daniel Agar 1ecdb0f6fb adjust stack sizes 2016-05-19 21:49:34 +02:00
Beat Küng fd0f52bebd orb macros: cleanup some unused code (#4576) 2016-05-19 11:08:37 +02:00
Daniel Agar 3de7fbb0a9 logger and uORBTest_UnitTest astyle 2016-05-14 11:27:07 +02:00
Beat Küng eabc43d78c orb structs: add padding bytes to align the structs where necessary
This is required for the logger, we just manually add the padding bytes
what would otherwise be done by the compiler. Additionally we reorder
the fields by type, so that padding is only necessary for nested types.
2016-05-14 11:27:07 +02:00
Daniel Agar 69c1ce1714 WIP logger serialization 2016-05-14 11:27:07 +02:00
Daniel Agar 9a0e962cbf uorb autogeneration 2016-05-14 11:27:07 +02:00
Daniel Agar eb29b33620 use gcc attributes to align and pack 2016-05-14 11:27:07 +02:00