{"action":"created","issue":{"url":"https://api.github.com/repos/dronekit/dronekit-python/issues/420","labels_url":"https://api.github.com/repos/dronekit/dronekit-python/issues/420/labels{/name}","comments_url":"https://api.github.com/repos/dronekit/dronekit-python/issues/420/comments","events_url":"https://api.github.com/repos/dronekit/dronekit-python/issues/420/events","html_url":"https://github.com/dronekit/dronekit-python/pull/420","id":115209992,"number":420,"title":"Update attribute_observer examples and docs","user":{"login":"hamishwillee","id":5368500,"avatar_url":"https://avatars.githubusercontent.com/u/5368500?v=3","gravatar_id":"","url":"https://api.github.com/users/hamishwillee","html_url":"https://github.com/hamishwillee","followers_url":"https://api.github.com/users/hamishwillee/followers","following_url":"https://api.github.com/users/hamishwillee/following{/other_user}","gists_url":"https://api.github.com/users/hamishwillee/gists{/gist_id}","starred_url":"https://api.github.com/users/hamishwillee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamishwillee/subscriptions","organizations_url":"https://api.github.com/users/hamishwillee/orgs","repos_url":"https://api.github.com/users/hamishwillee/repos","events_url":"https://api.github.com/users/hamishwillee/events{/privacy}","received_events_url":"https://api.github.com/users/hamishwillee/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-05T04:58:16Z","updated_at":"2015-11-09T05:22:30Z","closed_at":"2015-11-06T02:02:42Z","pull_request":{"url":"https://api.github.com/repos/dronekit/dronekit-python/pulls/420","html_url":"https://github.com/dronekit/dronekit-python/pull/420","diff_url":"https://github.com/dronekit/dronekit-python/pull/420.diff","patch_url":"https://github.com/dronekit/dronekit-python/pull/420.patch"},"body":"This updates the main examples and API ref for attribute observers and for message listeners. There are a couple of outstanding questions around listeners, and I understand @tcr3dr is going to rename some of the attribute observer methods.\r\n\r\nThis also updates the migration guide with information about attribute observers and message listeners (the information is \"high level\" and refers back to the relevant guide sections)\r\n\r\nAt time of writing it does not \r\n\r\n- update drone_delivery"},"comment":{"url":"https://api.github.com/repos/dronekit/dronekit-python/issues/comments/154932637","html_url":"https://github.com/dronekit/dronekit-python/pull/420#issuecomment-154932637","issue_url":"https://api.github.com/repos/dronekit/dronekit-python/issues/420","id":154932637,"user":{"login":"hamishwillee","id":5368500,"avatar_url":"https://avatars.githubusercontent.com/u/5368500?v=3","gravatar_id":"","url":"https://api.github.com/users/hamishwillee","html_url":"https://github.com/hamishwillee","followers_url":"https://api.github.com/users/hamishwillee/followers","following_url":"https://api.github.com/users/hamishwillee/following{/other_user}","gists_url":"https://api.github.com/users/hamishwillee/gists{/gist_id}","starred_url":"https://api.github.com/users/hamishwillee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamishwillee/subscriptions","organizations_url":"https://api.github.com/users/hamishwillee/orgs","repos_url":"https://api.github.com/users/hamishwillee/repos","events_url":"https://api.github.com/users/hamishwillee/events{/privacy}","received_events_url":"https://api.github.com/users/hamishwillee/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T05:22:30Z","updated_at":"2015-11-09T05:22:30Z","body":"Hi @mikerob \r\n\r\n'm trying to run the example, but hit two snags:\r\n\r\n> 1) I think there's a typo:\r\n  def raw_imu_callback(self,rawimu): \r\n      print self.raw_imu\r\n\r\n >  I think the \"def\" should be \"self,raw_imu\", shouldn't it?\r\n\r\nNo, this is an argument so it can be whatever you like. However in an example it should probably be attr_name to make it clear what this value will return with. I've pushed a change to #426 for this.\r\n\r\n> 2) When I run it, it says \"\r\n  File \"create_attribute.py\", line 79, i n\r\n  @vehicle.message_listener('RAW_IMU')\r\n  AttributeError: 'Vehicle' object has no attribute 'message_listener'\r\n\r\nI suspect that the API changed underneath you so that the examples no longer match the docs - the decorator is now ``on_message``. This all builds against PR #426 following testing today. Sorry about that - lot of change going on as we improve the API coming up to our first \"proper\" DKPY2 release.\r\n\r\n> 3) Question: In this example, you created a new object (raw_imu) within vehicle, so you end up with vehicle.raw_imu.xacc etc, whereas other attributes are stored as _heartbeat, _mount_pitch etc.\r\n\r\n>  Is the eventual intent to move to objects with Vehicle? I'm coding up RADIO_STATUS now, so would like to do it the \"right\" way.\r\n\r\nYou should not take the example as \"exactly\" the same way as you implement something that is part of the API - instead you should copy the patterns in the existing __init__.py :-) \r\n\r\nThe reason the example is different is that \r\n1. I wrote this without looking at the code internals. \r\n1. I am trying to show how the API works, while the internal code is trying to create a proper separation of public and private interfaces. \r\n1. I am not sure how much I can duplicate the internal process - for example whether I can create a private property in an external file. \r\n\r\n\r\n@tcr3dr Depending on strategy discussions we probably should consider if we need to adopt the same sort of pattern for the example as we use internally (if that is possible - not sure you can declare the properly in the same way) even though it might not make so much sense. If only so that when people copy they copy the right thing. The obvious alternative is to write a \"how to add an attribute \"properly\" doc.. \r\n\r\n"}}