Commit Graph

17 Commits

Author SHA1 Message Date
jihandong
2b8bfc5be7 app/system/uorb: modify unit test to support data persist
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
874ed7654d app/system/uorb: fix listener run_once not work.
And remove dead code.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
f02c5a5d7e system/uorb: support new api
orb_advertise_multi_queue_persist

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
ligd
37f1e453b1 uorb: use another writing method to avoid compiler bug
int func(int b)
{
    int a;

    while (1) {
        ...;

        if (b != 0)
            a = 1000 / b;

        ...;
    }
}

if b == 0, then system crash in Xtensa arch, clang compiler

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
8558e63772 uorb_listener: support set batch latency
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
3a8f4b53fc apps/uorb: fix compile break
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
384c05beb2 app/system/uorb: alloc on heap instead of stack.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
e97b1a79d6 uorb_listener: support subscribe physical sensor before node register
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
5bb4e14aad system/uorb: always let orb_advertise, orb_advertise_queue for instance 0
1.orb_advertise, orb_advertise_queue for instance 0
2.orb_advertise_multi, orb_advertise__multi_queue for specified instance
3.If orb_advertise_multi_queue with instance is NULL, auto increase
instance from existing base.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
53ee04ba3c uorb/listener: add new api: orb_open and orb_close
don't using subscriber to get state to avoid rpmsg access

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
d44dd1c426 uorb_unit_test: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
6fceb913a2 system/uorb: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
9f6d322186 system/uorb: listener, has 'top' command.
Listener can scan device under ORB_SENSOR_PATH, subscribe them and
cotinue printing messages by call their cb.

'-T' can Continuously print updating objects, '-l' means only
print once.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
4ec3f70f1d apps/system/uorb: support orb_get_meta by name string
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
46c98420b7 system/uorb: add builtin sensor topics
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
d8d1e1e761 apps/system/uorb: c unit testcases
testcases:
1. test_single(): single instance, advertise then subscribe.
2. test_multi_inst10(): 10 instance, each 1 subscriber.
3. test_multi(): 2 instances, 2 advertisers, 2 subscribers.
4. test_multi_reversed(): same as test_multi(), but subsribe before
		          advertise.
5. test_unadvertise(): unadvertise upper 4 advertisers.
6. test_multi2(): same as tset_multi(). but multi-thread.
7, test_queue():  topic queue_size = 16.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
3528b5515f apps/system/uorb: c interfaces.
refer to: https://docs.px4.io/v1.12/en/middleware/uorb.html

- orb_open: do real work for advertise() and subscribe(), if thre is
            no user, register topic first, then save meta in driver;
            only first user can successfully set buffer number.
- orb_exists: check topic state, if topic only has subscribers,
	      return "not exists".

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00