{"action":"created","issue":{"url":"https://api.github.com/repos/machinekit/machinekit/issues/581","labels_url":"https://api.github.com/repos/machinekit/machinekit/issues/581/labels{/name}","comments_url":"https://api.github.com/repos/machinekit/machinekit/issues/581/comments","events_url":"https://api.github.com/repos/machinekit/machinekit/issues/581/events","html_url":"https://github.com/machinekit/machinekit/issues/581","id":70608001,"number":581,"title":"HAL Python API using operators for netting","user":{"login":"strahlex","id":1467368,"avatar_url":"https://avatars.githubusercontent.com/u/1467368?v=3","gravatar_id":"","url":"https://api.github.com/users/strahlex","html_url":"https://github.com/strahlex","followers_url":"https://api.github.com/users/strahlex/followers","following_url":"https://api.github.com/users/strahlex/following{/other_user}","gists_url":"https://api.github.com/users/strahlex/gists{/gist_id}","starred_url":"https://api.github.com/users/strahlex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strahlex/subscriptions","organizations_url":"https://api.github.com/users/strahlex/orgs","repos_url":"https://api.github.com/users/strahlex/repos","events_url":"https://api.github.com/users/strahlex/events{/privacy}","received_events_url":"https://api.github.com/users/strahlex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-24T07:06:37Z","updated_at":"2015-04-24T08:32:56Z","closed_at":null,"body":"I have played around with the HAL Python API in the last weeks to implement my Halanduino configuration. So far I like the Python API as I am finally able to create functions and classes. There is just one thing I would ilke to address: netting or connecting pins to signals\r\n\r\nTake a look at this peace of code for example. It is not very visual in my opionion I can not tell which directions the pins have just by looking at the code.\r\n\r\n```python\r\nsigFeedback = name + '-feedback'\r\nhal.net(sigFeedback, pid + '.feedback')\r\nhal.net(sigFeedback, 'kalman.angle')\r\n```\r\nSo I have come up with the idea to use Pythons operators to address this issue:\r\n\r\n```python\r\ntestSig = hal.Signal('test2')\r\noutPin = hal.Pin('and2.test.out')\r\ntestSig <<= outPin  # link out pin to signal\r\ntestSig >>= hal.Pin('and2.test.in0')  # link in pin to signal\r\ntestSig += hal.Pin('and2.test.in1')  # link any pin to signal\r\ntestSig -= outPin  # unlink pin from signal\r\n```\r\nWhat do you think about this idea? Does it make sense?"},"comment":{"url":"https://api.github.com/repos/machinekit/machinekit/issues/comments/95852391","html_url":"https://github.com/machinekit/machinekit/issues/581#issuecomment-95852391","issue_url":"https://api.github.com/repos/machinekit/machinekit/issues/581","id":95852391,"user":{"login":"strahlex","id":1467368,"avatar_url":"https://avatars.githubusercontent.com/u/1467368?v=3","gravatar_id":"","url":"https://api.github.com/users/strahlex","html_url":"https://github.com/strahlex","followers_url":"https://api.github.com/users/strahlex/followers","following_url":"https://api.github.com/users/strahlex/following{/other_user}","gists_url":"https://api.github.com/users/strahlex/gists{/gist_id}","starred_url":"https://api.github.com/users/strahlex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strahlex/subscriptions","organizations_url":"https://api.github.com/users/strahlex/orgs","repos_url":"https://api.github.com/users/strahlex/repos","events_url":"https://api.github.com/users/strahlex/events{/privacy}","received_events_url":"https://api.github.com/users/strahlex/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T08:32:56Z","updated_at":"2015-04-24T08:32:56Z","body":"Quickly tested it > automatically connecting pins is definitely possible and a 10 liner in Python. The only downside I see is that component and signal names need to be generated. Easiest way would be to use a continous number or alphanumeric sequence. This makes following possible:\r\n```python\r\ntestSig <<= outPin & outPin2  # outPin and outPin2 are automatically connecto to and2 component and the out pin of this component is connected to testSig\r\n```"}}