{"action":"created","comment":{"url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments/32856706","id":32856706,"diff_hunk":"@@ -0,0 +1,93 @@\n+#!/usr/bin/env python\n+# Copyright (C) 2015 Swift Navigation Inc.\n+# Contact: Fergus Noble <fergus@swiftnav.com>\n+#\n+# This source is subject to the license found in the file 'LICENSE' which must\n+# be be distributed together with this source. All other rights reserved.\n+#\n+# THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND,\n+# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED\n+# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.\n+\n+\"\"\"\n+the :mod:`sbp.client.examples.mavproxybridge` module contains an example of reading SBP\n+messages from a serial port, filtering for observations, and sending them over udp\n+to a mavproxy instance for transmission to an ArduCopter quad.\n+\"\"\"\n+\n+from sbp.client.drivers.pyserial_driver import PySerialDriver\n+from sbp.client.handler import Handler\n+from sbp.observation import SBP_MSG_OBS, SBP_MSG_BASE_POS\n+\n+import socket\n+import struct\n+import time\n+\n+OBS_MSGS = [SBP_MSG_OBS,\n+            SBP_MSG_BASE_POS]\n+\n+DEFAULT_SERIAL_PORT = \"/dev/ttyUSB0\"\n+DEFAULT_SERIAL_BAUD = 1000000\n+\n+DEFAULT_UDP_ADDRESS = \"127.0.0.1\"\n+DEFAULT_UDP_PORT    = 13320\n+\n+def get_args():\n+  \"\"\"\n+  Get and parse arguments.\n+  \"\"\"\n+  import argparse\n+  parser = argparse.ArgumentParser(description=\"Swift Navigation SBP Example.\")\n+  parser.add_argument(\"-s\", \"--serial-port\",\n+                      default=[DEFAULT_SERIAL_PORT], nargs=1,\n+                      help=\"specify the serial port to use.\")\n+  parser.add_argument(\"-b\", \"--baud\",\n+                      default=[DEFAULT_SERIAL_BAUD], nargs=1,\n+                      help=\"specify the baud rate to use.\")\n+  parser.add_argument(\"-a\", \"--address\",\n+                      default=[DEFAULT_UDP_ADDRESS], nargs=1,\n+                      help=\"specify the UDP IP Address to use.\")\n+  parser.add_argument(\"-p\", \"--udp-port\",\n+                      default=[DEFAULT_UDP_PORT], nargs=1,\n+                      help=\"specify the UDP Port to use.\")\n+  return parser.parse_args()\n+\n+def open_socket():\n+  return socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n+\n+def send_udp_callback_generator(udp, address, port):\n+  def send_udp_callback(msg):\n+    s = msg.pack()\n+    udp.sendto(s, (address, port))\n+  return send_udp_callback\n+\n+def register_udp_callbacks(link, udp, address, port, msg_list):\n+  func_list = [send_udp_callback_generator(udp, address, port) for x in msg_list]\n+  for eachfunc, eachmsg in zip(func_list, msg_list):\n+    link.add_callback(eachfunc, msg_type=eachmsg)\n+  return func_list\n+\n+def unregister_udp_callbacks(link, func_list, msg_list):\n+  for eachfunc,eachmsg in zip(func_list, msg_list):\n+    link.remove_callback(eachfunc, eachmsg)\n+\n+def main():\n+  args = get_args()\n+\n+  with PySerialDriver(args.serial_port[0], args.baud[0]) as driver:\n+    with Handler(driver.read, driver.write) as handler:\n+      udp = open_socket()","path":"piksi_tools/udp_bridge.py","position":79,"original_position":79,"commit_id":"090125a0f559c04496ac1da63b3b9d02f8e5d591","original_commit_id":"090125a0f559c04496ac1da63b3b9d02f8e5d591","user":{"login":"mfine","id":60851,"avatar_url":"https://avatars.githubusercontent.com/u/60851?v=3","gravatar_id":"","url":"https://api.github.com/users/mfine","html_url":"https://github.com/mfine","followers_url":"https://api.github.com/users/mfine/followers","following_url":"https://api.github.com/users/mfine/following{/other_user}","gists_url":"https://api.github.com/users/mfine/gists{/gist_id}","starred_url":"https://api.github.com/users/mfine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfine/subscriptions","organizations_url":"https://api.github.com/users/mfine/orgs","repos_url":"https://api.github.com/users/mfine/repos","events_url":"https://api.github.com/users/mfine/events{/privacy}","received_events_url":"https://api.github.com/users/mfine/received_events","type":"User","site_admin":false},"body":"Do we need more robust socket handling with UDP? Most of that sheet is about handling TCP issues, and UDP is kind of super simple (fire and forget). Think it should be ok to leave the socket error handling to a minimum. What do you think?","created_at":"2015-06-19T18:35:50Z","updated_at":"2015-06-19T18:35:50Z","html_url":"https://github.com/swift-nav/piksi_tools/pull/74#discussion_r32856706","pull_request_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments/32856706"},"html":{"href":"https://github.com/swift-nav/piksi_tools/pull/74#discussion_r32856706"},"pull_request":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74","id":38067146,"html_url":"https://github.com/swift-nav/piksi_tools/pull/74","diff_url":"https://github.com/swift-nav/piksi_tools/pull/74.diff","patch_url":"https://github.com/swift-nav/piksi_tools/pull/74.patch","issue_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/74","number":74,"state":"open","locked":false,"title":"New mavlink bridge","user":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"body":"This PR groups the python console, system monitor, and new SBP Relay tab into an \"Advanced\" tab\r\nIt also adds a semi-generic ability to forward SBP messages over UDP either at the command line or whilst running the console.  \r\n\r\nThe forwarding ability is for use with 3dr Pixhawk integration","created_at":"2015-06-19T00:26:19Z","updated_at":"2015-06-19T18:35:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e866a69c55d641d90acb590121d58ff5ca8294f","assignee":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74/commits","review_comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74/comments","review_comment_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/74/comments","statuses_url":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/090125a0f559c04496ac1da63b3b9d02f8e5d591","head":{"label":"denniszollo:new_mavlink_bridge","ref":"new_mavlink_bridge","sha":"090125a0f559c04496ac1da63b3b9d02f8e5d591","user":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"repo":{"id":33337777,"name":"piksi_tools","full_name":"denniszollo/piksi_tools","owner":{"login":"denniszollo","id":11276774,"avatar_url":"https://avatars.githubusercontent.com/u/11276774?v=3","gravatar_id":"","url":"https://api.github.com/users/denniszollo","html_url":"https://github.com/denniszollo","followers_url":"https://api.github.com/users/denniszollo/followers","following_url":"https://api.github.com/users/denniszollo/following{/other_user}","gists_url":"https://api.github.com/users/denniszollo/gists{/gist_id}","starred_url":"https://api.github.com/users/denniszollo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denniszollo/subscriptions","organizations_url":"https://api.github.com/users/denniszollo/orgs","repos_url":"https://api.github.com/users/denniszollo/repos","events_url":"https://api.github.com/users/denniszollo/events{/privacy}","received_events_url":"https://api.github.com/users/denniszollo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denniszollo/piksi_tools","description":"Tools for the Piksi GNSS receiver.","fork":true,"url":"https://api.github.com/repos/denniszollo/piksi_tools","forks_url":"https://api.github.com/repos/denniszollo/piksi_tools/forks","keys_url":"https://api.github.com/repos/denniszollo/piksi_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denniszollo/piksi_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denniszollo/piksi_tools/teams","hooks_url":"https://api.github.com/repos/denniszollo/piksi_tools/hooks","issue_events_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues/events{/number}","events_url":"https://api.github.com/repos/denniszollo/piksi_tools/events","assignees_url":"https://api.github.com/repos/denniszollo/piksi_tools/assignees{/user}","branches_url":"https://api.github.com/repos/denniszollo/piksi_tools/branches{/branch}","tags_url":"https://api.github.com/repos/denniszollo/piksi_tools/tags","blobs_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denniszollo/piksi_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/denniszollo/piksi_tools/languages","stargazers_url":"https://api.github.com/repos/denniszollo/piksi_tools/stargazers","contributors_url":"https://api.github.com/repos/denniszollo/piksi_tools/contributors","subscribers_url":"https://api.github.com/repos/denniszollo/piksi_tools/subscribers","subscription_url":"https://api.github.com/repos/denniszollo/piksi_tools/subscription","commits_url":"https://api.github.com/repos/denniszollo/piksi_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/denniszollo/piksi_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/denniszollo/piksi_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/denniszollo/piksi_tools/contents/{+path}","compare_url":"https://api.github.com/repos/denniszollo/piksi_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denniszollo/piksi_tools/merges","archive_url":"https://api.github.com/repos/denniszollo/piksi_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denniszollo/piksi_tools/downloads","issues_url":"https://api.github.com/repos/denniszollo/piksi_tools/issues{/number}","pulls_url":"https://api.github.com/repos/denniszollo/piksi_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/denniszollo/piksi_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/denniszollo/piksi_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denniszollo/piksi_tools/labels{/name}","releases_url":"https://api.github.com/repos/denniszollo/piksi_tools/releases{/id}","created_at":"2015-04-03T00:05:20Z","updated_at":"2015-04-03T00:05:23Z","pushed_at":"2015-06-19T01:06:52Z","git_url":"git://github.com/denniszollo/piksi_tools.git","ssh_url":"git@github.com:denniszollo/piksi_tools.git","clone_url":"https://github.com/denniszollo/piksi_tools.git","svn_url":"https://github.com/denniszollo/piksi_tools","homepage":null,"size":1043,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"swift-nav:master","ref":"master","sha":"cb374d922647893ec208e45949b35cffabb3d21f","user":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"repo":{"id":33265971,"name":"piksi_tools","full_name":"swift-nav/piksi_tools","owner":{"login":"swift-nav","id":1069835,"avatar_url":"https://avatars.githubusercontent.com/u/1069835?v=3","gravatar_id":"","url":"https://api.github.com/users/swift-nav","html_url":"https://github.com/swift-nav","followers_url":"https://api.github.com/users/swift-nav/followers","following_url":"https://api.github.com/users/swift-nav/following{/other_user}","gists_url":"https://api.github.com/users/swift-nav/gists{/gist_id}","starred_url":"https://api.github.com/users/swift-nav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swift-nav/subscriptions","organizations_url":"https://api.github.com/users/swift-nav/orgs","repos_url":"https://api.github.com/users/swift-nav/repos","events_url":"https://api.github.com/users/swift-nav/events{/privacy}","received_events_url":"https://api.github.com/users/swift-nav/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swift-nav/piksi_tools","description":"Tools for the Piksi GNSS receiver.","fork":false,"url":"https://api.github.com/repos/swift-nav/piksi_tools","forks_url":"https://api.github.com/repos/swift-nav/piksi_tools/forks","keys_url":"https://api.github.com/repos/swift-nav/piksi_tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swift-nav/piksi_tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swift-nav/piksi_tools/teams","hooks_url":"https://api.github.com/repos/swift-nav/piksi_tools/hooks","issue_events_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/events{/number}","events_url":"https://api.github.com/repos/swift-nav/piksi_tools/events","assignees_url":"https://api.github.com/repos/swift-nav/piksi_tools/assignees{/user}","branches_url":"https://api.github.com/repos/swift-nav/piksi_tools/branches{/branch}","tags_url":"https://api.github.com/repos/swift-nav/piksi_tools/tags","blobs_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/{sha}","languages_url":"https://api.github.com/repos/swift-nav/piksi_tools/languages","stargazers_url":"https://api.github.com/repos/swift-nav/piksi_tools/stargazers","contributors_url":"https://api.github.com/repos/swift-nav/piksi_tools/contributors","subscribers_url":"https://api.github.com/repos/swift-nav/piksi_tools/subscribers","subscription_url":"https://api.github.com/repos/swift-nav/piksi_tools/subscription","commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/swift-nav/piksi_tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/swift-nav/piksi_tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/swift-nav/piksi_tools/contents/{+path}","compare_url":"https://api.github.com/repos/swift-nav/piksi_tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swift-nav/piksi_tools/merges","archive_url":"https://api.github.com/repos/swift-nav/piksi_tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swift-nav/piksi_tools/downloads","issues_url":"https://api.github.com/repos/swift-nav/piksi_tools/issues{/number}","pulls_url":"https://api.github.com/repos/swift-nav/piksi_tools/pulls{/number}","milestones_url":"https://api.github.com/repos/swift-nav/piksi_tools/milestones{/number}","notifications_url":"https://api.github.com/repos/swift-nav/piksi_tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swift-nav/piksi_tools/labels{/name}","releases_url":"https://api.github.com/repos/swift-nav/piksi_tools/releases{/id}","created_at":"2015-04-01T18:47:25Z","updated_at":"2015-05-08T20:54:47Z","pushed_at":"2015-06-19T16:32:46Z","git_url":"git://github.com/swift-nav/piksi_tools.git","ssh_url":"git@github.com:swift-nav/piksi_tools.git","clone_url":"https://github.com/swift-nav/piksi_tools.git","svn_url":"https://github.com/swift-nav/piksi_tools","homepage":null,"size":1624,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":37,"forks":10,"open_issues":37,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74"},"html":{"href":"https://github.com/swift-nav/piksi_tools/pull/74"},"issue":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/issues/74"},"comments":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/swift-nav/piksi_tools/statuses/090125a0f559c04496ac1da63b3b9d02f8e5d591"}}}}