Title: Reading op mode in CiA 402 profile causes KeyError when not set to a specific mode · Issue #183 · canopen-python/canopen · GitHub
Open Graph Title: Reading op mode in CiA 402 profile causes KeyError when not set to a specific mode · Issue #183 · canopen-python/canopen
X Title: Reading op mode in CiA 402 profile causes KeyError when not set to a specific mode · Issue #183 · canopen-python/canopen
Description: When the current operation mode of a device using the 402 profile is read using mode = thing.op_mode it might be in a mode which is not mapped by class OperationMode. Therefor a KeyError might be thrown. Most prominently this happens to ...
Open Graph Description: When the current operation mode of a device using the 402 profile is read using mode = thing.op_mode it might be in a mode which is not mapped by class OperationMode. Therefor a KeyError might be t...
X Description: When the current operation mode of a device using the 402 profile is read using mode = thing.op_mode it might be in a mode which is not mapped by class OperationMode. Therefor a KeyError might be t...
Opengraph URL: https://github.com/canopen-python/canopen/issues/183
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reading op mode in CiA 402 profile causes KeyError when not set to a specific mode","articleBody":"When the current operation mode of a device using the 402 profile is read using `mode = thing.op_mode` it might be in a mode which is not mapped by `class OperationMode`. Therefor a `KeyError` might be thrown. Most prominently this happens to me when a motor has been without power and has no mode (=0) set yet.\r\n\r\n```python\r\nTraceback (most recent call last):\r\n File \"/home/heiner/heiner-control/heiner_control/canopen/master.py\", line 33, in init\r\n slave.init()\r\n File \"/home/heiner/heiner-control/heiner_control/canopen/axis.py\", line 89, in init\r\n node.op_mode = 'PROFILED POSITION'\r\n File \"/home/heiner/heiner-control/env/lib/python3.7/site-packages/canopen/profiles/p402.py\", line 339, in op_mode\r\n while self.op_mode != mode:\r\n File \"/home/heiner/heiner-control/env/lib/python3.7/site-packages/canopen/profiles/p402.py\", line 301, in op_mode\r\n return OperationMode.CODE2NAME[self.sdo[0x6061].raw]\r\nKeyError: 0\r\n```\r\nTo mitigate a part of this problem, I have added `NO MODE` as a valid mode in in the `OperationMode` class.\r\n","author":{"url":"https://github.com/allesblinkt","@type":"Person","name":"allesblinkt"},"datePublished":"2020-04-24T10:57:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/183/canopen/issues/183"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:22b3c7d5-0580-260c-cb80-9347795efa8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A83E:2B9CDD:8A078C8:BC0A2ED:6A5EA7F4 |
| html-safe-nonce | 57961af1554b171e88be0084eda19c8d3b9290be7ead631044aec82adc9a9413 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODNFOjJCOUNERDo4QTA3OEM4OkJDMEEyRUQ6NkE1RUE3RjQiLCJ2aXNpdG9yX2lkIjoiNjU2NzkxODEyNDU5NTU4NzA2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 26e748ca77dfa094fea3b2948220a21303ef43695c9a50650697a6533c768b1c |
| hovercard-subject-tag | issue:606227805 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/canopen-python/canopen/183/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56916e5cad69b225444956ecddaeb21961999b449d3e735b33fd7a4066c31d2c/canopen-python/canopen/issues/183 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56916e5cad69b225444956ecddaeb21961999b449d3e735b33fd7a4066c31d2c/canopen-python/canopen/issues/183 |
| og:image:alt | When the current operation mode of a device using the 402 profile is read using mode = thing.op_mode it might be in a mode which is not mapped by class OperationMode. Therefor a KeyError might be t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | allesblinkt |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7c7e31acb6a895494e518b880f5ccf39604f7fa9a8f2f3c64145efc3b776256d |
| turbo-cache-control | no-preview |
| go-import | github.com/canopen-python/canopen git https://github.com/canopen-python/canopen.git |
| octolytics-dimension-user_id | 200581454 |
| octolytics-dimension-user_login | canopen-python |
| octolytics-dimension-repository_id | 68737600 |
| octolytics-dimension-repository_nwo | canopen-python/canopen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 68737600 |
| octolytics-dimension-repository_network_root_nwo | canopen-python/canopen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2d2ac9bdd71d5f53f2b731c9330677e38624e301 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width