Publishing calculated data
- Is there a way one behavior can publish data in an event which another behavior can detect? I have a orientation calculator working off an accelerometer and I would like to publish this so another behavior can read it and filter it and publish filtered data.
Another way of doing this I suppose would be to make a subclass of the orientation class which is called filtered orientation I suppose. Of these two solutions which do you think would work best in this system?
The end goal is to have the chest of the KHR2 keep itself level while walking (moving the hip servos) and I need to filter out accelerometer readings.
> Is there a way one behavior can publish data in an event which anotherYes. Create a class to hold your data, say, AccelerometerData. Then
> behavior can detect?
use erouter->postEvent(...) to post a DataEvent<AccelerometerData> with
a generator ID of userEGID.
Your receiving behavior can simply do an erouter->addListener(this, EventBase::userEGID)
to pick up the events.