{"action":"created","issue":{"url":"https://api.github.com/repos/hybridgroup/gobot/issues/244","labels_url":"https://api.github.com/repos/hybridgroup/gobot/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/hybridgroup/gobot/issues/244/comments","events_url":"https://api.github.com/repos/hybridgroup/gobot/issues/244/events","html_url":"https://github.com/hybridgroup/gobot/issues/244","id":115700596,"number":244,"title":"Fill Out Bebop Events, GPS Support?","user":{"login":"cathalgarvey","id":1167837,"avatar_url":"https://avatars.githubusercontent.com/u/1167837?v=3","gravatar_id":"","url":"https://api.github.com/users/cathalgarvey","html_url":"https://github.com/cathalgarvey","followers_url":"https://api.github.com/users/cathalgarvey/followers","following_url":"https://api.github.com/users/cathalgarvey/following{/other_user}","gists_url":"https://api.github.com/users/cathalgarvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cathalgarvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathalgarvey/subscriptions","organizations_url":"https://api.github.com/users/cathalgarvey/orgs","repos_url":"https://api.github.com/users/cathalgarvey/repos","events_url":"https://api.github.com/users/cathalgarvey/events{/privacy}","received_events_url":"https://api.github.com/users/cathalgarvey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-07T23:54:24Z","updated_at":"2015-11-11T06:34:21Z","closed_at":null,"body":"Hi folks,\r\n\r\nGobot support figured highly in my purchasing decision to get a Bebop, and I'm having fun already getting to know Gobot and imagining ways to paste my Bebop to Arduino or microcomputer hacks.\r\n\r\nLooking through the Bebop code in Gobot versus other frameworks, including some by HybridGroup, I see that it doesn't have much support yet for onboard events? For example, the \"flying\" event is fired by Gobot presumptively after sending the TakeOff instruction, whereas it seems (from perusal of the...difficult...official API documentation) that the device itself issues events when its state changes from \"Taking off\" to \"Hovering\" to \"Flying\" to \"Landing\" to \"Emergency\".\r\n\r\nLikewise, the official API makes it very difficult to understand, but I gather the device either regularly, or on request, issues sensor updates including GPS, accelerometer, etcetera. GPS in particular would be *very* valuable, because it would allow one to write homing code to help the device navigate through flight-paths.\r\n\r\nI would happily help contribute these features, if there were somewhere to go learn about the low-level Bebop API that Gobot is reimplementing. Which of the defined magic Bytes are commands sent *to* the drone, and which are tokens designating what kind of data is being received *from* the drone? How does one write code to issue an instruction including arguments, and how does one receive and post (all?) events to the Gobot event handler? If I could get this kind of information I'd happily run off and try to implement this stuff myself, but the official API is very oddly laid out and the documentation stops short of anything but the basics, much less GPS.\r\n\r\nThanks again for Gobot, looking forward to helping or at least making use of it. :)"},"comment":{"url":"https://api.github.com/repos/hybridgroup/gobot/issues/comments/155681346","html_url":"https://github.com/hybridgroup/gobot/issues/244#issuecomment-155681346","issue_url":"https://api.github.com/repos/hybridgroup/gobot/issues/244","id":155681346,"user":{"login":"cathalgarvey","id":1167837,"avatar_url":"https://avatars.githubusercontent.com/u/1167837?v=3","gravatar_id":"","url":"https://api.github.com/users/cathalgarvey","html_url":"https://github.com/cathalgarvey","followers_url":"https://api.github.com/users/cathalgarvey/followers","following_url":"https://api.github.com/users/cathalgarvey/following{/other_user}","gists_url":"https://api.github.com/users/cathalgarvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cathalgarvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathalgarvey/subscriptions","organizations_url":"https://api.github.com/users/cathalgarvey/orgs","repos_url":"https://api.github.com/users/cathalgarvey/repos","events_url":"https://api.github.com/users/cathalgarvey/events{/privacy}","received_events_url":"https://api.github.com/users/cathalgarvey/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T06:34:21Z","updated_at":"2015-11-11T06:34:21Z","body":"OK, good news: I tracked down and killed a bunch of bugs, implemented an incomplete but acceptable set of telemetry class handlers, and tested on my drone in live flight, and I've got telemetry working. :)\r\n\r\nThere's a lot of it: It spams a load of information about attitude/altitude/gps, though GPS is either broken or simply returns dummy values (500,500,500) in indoor mode. Altitude only reports greater than nil in flight. Attitude appears to work even when inactive.\r\n\r\nI don't suggest a pull yet, and am not issuing a PR, because the Land() method seems not to be working anymore, which is odd because I don't recall touching it! When I get that working I'll issue a PR?\r\n\r\nBefore I do, if you have a chance to check out the coding arrangement I've got going it might avoid questions later.\r\n\r\nBasic strategy: Dataframes go to a dispatcher, which looks up commandProject in a map, then looks up commandClass in the returned sub-map, and issues the frame to the handler. Handlers mostly use a switch to pick the right code by commandId, and dispatch, passing back (found bool, commandName string, err error) for error messaging context. Dispatching of all telemetry is done in its own goroutine but when it comes to messaging to the global cue it happens through a 10-length channel, discarding overflow, so if the telemetry channel isn't read the messages (and goroutines) are discarded.\r\n\r\nThe incoming telemetry is pulled by a goroutine that's spun up at Bebop starttime and posted to the Gobot event cue, though the event names could do with an overhaul to namespace them and make them clearer.\r\n\r\nHope you like it! :)"}}