diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-07-04 15:46:53 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-07-04 15:46:53 +0200 |
commit | d72e9929aa7f3066c3c8c6a09df7a9690b3cdbc5 (patch) | |
tree | fc5468f1e05588c7733b2b371f1f485c21ad6d2d /src/modules/controllib/block/UOrbPublication.hpp | |
parent | b01673d1d8717b645747b7630382d666c6377c49 (diff) | |
download | px4-firmware-d72e9929aa7f3066c3c8c6a09df7a9690b3cdbc5.tar.gz px4-firmware-d72e9929aa7f3066c3c8c6a09df7a9690b3cdbc5.tar.bz2 px4-firmware-d72e9929aa7f3066c3c8c6a09df7a9690b3cdbc5.zip |
Fixes to fixed wing control example, fixes to the way the control lib publishes estimates
Diffstat (limited to 'src/modules/controllib/block/UOrbPublication.hpp')
-rw-r--r-- | src/modules/controllib/block/UOrbPublication.hpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/controllib/block/UOrbPublication.hpp b/src/modules/controllib/block/UOrbPublication.hpp index a36f4429f..0a8ae2ff7 100644 --- a/src/modules/controllib/block/UOrbPublication.hpp +++ b/src/modules/controllib/block/UOrbPublication.hpp @@ -60,11 +60,15 @@ public: List<UOrbPublicationBase *> * list, const struct orb_metadata *meta) : _meta(meta), - _handle() { + _handle(-1) { if (list != NULL) list->add(this); } void update() { - orb_publish(getMeta(), getHandle(), getDataVoidPtr()); + if (_handle > 0) { + orb_publish(getMeta(), getHandle(), getDataVoidPtr()); + } else { + setHandle(orb_advertise(getMeta(), getDataVoidPtr())); + } } virtual void *getDataVoidPtr() = 0; virtual ~UOrbPublicationBase() { @@ -99,10 +103,6 @@ public: const struct orb_metadata *meta) : T(), // initialize data structure to zero UOrbPublicationBase(list, meta) { - // It is important that we call T() - // before we publish the data, so we - // call this here instead of the base class - setHandle(orb_advertise(getMeta(), getDataVoidPtr())); } virtual ~UOrbPublication() {} /* |