Loading ...
Sorry, an error occurred while loading the content.

Publishing calculated data

Expand Messages
  • Aaron
    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
    Message 1 of 2 , Jun 28, 2011
    View Source
    • 0 Attachment
      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.

      Thanks.

      -- Aaron
    • Dave Touretzky
      ... Yes. Create a class to hold your data, say, AccelerometerData. Then use erouter- postEvent(...) to post a DataEvent with a generator
      Message 2 of 2 , Jun 28, 2011
      View Source
      • 0 Attachment
        > Is there a way one behavior can publish data in an event which another
        > behavior can detect?

        Yes. Create a class to hold your data, say, AccelerometerData. Then
        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.

        -- Dave
      Your message has been successfully submitted and would be delivered to recipients shortly.