{"id":7975,"date":"2024-07-06T17:33:00","date_gmt":"2024-07-06T08:33:00","guid":{"rendered":"https:\/\/www.nkozawa.com\/blog\/?p=7975"},"modified":"2024-07-06T17:33:00","modified_gmt":"2024-07-06T08:33:00","slug":"rotorhazard%e3%81%ae%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%ae%e4%bd%9c%e3%82%8a%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.nkozawa.com\/blog\/archives\/7975","title":{"rendered":"RotorHazard\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u4f5c\u308a\u65b9"},"content":{"rendered":"<p>VTX\u96fb\u6ce2\u3092\u5229\u7528\u3057\u305f\u9ad8\u6a5f\u80fd\u306aFPV\u30ec\u30fc\u30b9\u8a08\u6e2c\u30b7\u30b9\u30c6\u30e0\u3067\u3042\u308bRotorHazard\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f5c\u308b\u3079\u304f\u8abf\u67fb\u4e2d\u3067\u3059\u3002\u7d50\u5c40\u306e\u3068\u3053\u308d\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u3093\u3067\u3082\u4eca\u3072\u3068\u3064\u5206\u304b\u308a\u306b\u304f\u3044\u306e\u3067\u3001\u5b9f\u969b\u306b\u52d5\u304d\u305d\u3046\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8aad\u3093\u3060\u308aRotorHazard\u306e\u30bd\u30fc\u30b9\u3092\u8aad\u3080\u306e\u304c\u624b\u3063\u53d6\u308a\u65e9\u3044\u3067\u3059\u3002<\/p>\n<p>\u30bf\u30a4\u30c8\u30eb\u306b\u306f\u4f5c\u308a\u65b9\u306a\u3069\u3068\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u6700\u4f4e\u9650\u306e\u52d5\u4f5c\u53ef\u80fd\u306a\u30b3\u30fc\u30c9\u3092\u793a\u3057\u3066\u304a\u304f\u306b\u7559\u3081\u307e\u3059\u3002\u4f55\u304b\u3057\u3089\u304a\u4f5c\u6cd5\u7684\u306a\u3053\u3068\u306b\u629c\u3051\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306e\u3067\u4e88\u3081\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u516c\u958b\u3059\u308b\u969b\u306b\u306f\u30de\u30cb\u30e5\u30d5\u30a7\u30b9\u30c8\u3082\u66f8\u3044\u305f\u65b9\u304c\u826f\u3044\u3088\u3046\u3067\u3059\u304c\u3001\u305d\u308c\u3082\u307e\u3060\u672a\u8abf\u67fb\u3067\u3059\u3002<\/p>\n<p><strong>[ \u8a00\u8a9e\u3068\u5b9f\u884c\u74b0\u5883 ]<\/strong><br \/>\n\u30d7\u30e9\u30b0\u30a4\u30f3\u306fPython3\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002RotorHzard\u81ea\u4f53\u304cPython\u3067\u8a18\u8ff0\u3055\u308c\u3066\u304a\u308aPython\u306e\u4eee\u60f3\u74b0\u5883\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3082\u3057pip3\u3067\u65b0\u305f\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5c0e\u5165\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001\u305d\u306e\u4eee\u60f3\u74b0\u5883\u306b\u5165\u3063\u3066pip3\u306e\u5b9f\u884c\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u4eee\u60f3\u74b0\u5883\u306b\u5165\u308b\u306b\u306fRotorHazard\u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u308b\u30e6\u30fc\u30b6\u30fc\u306e\u30db\u30fc\u30e0\u3067<code>source .\/.venv\/bin\/activate<\/code>\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u3067<code>systemctl cat rotorhazard<\/code>\u3092\u5b9f\u884c\u3059\u308c\u3070RotorHazard\u304c\u3069\u3053\u306b\u5c0e\u5165\u3055\u308c\u3066\u3044\u3066\u3069\u306e\u4eee\u60f3\u74b0\u5883\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b\u306f\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>[ \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u4f5c\u6210 ]<\/strong><\/p>\n<pre>\/home\/pi\/RotorHazard\/src\/server\/plugins<\/pre>\n<p>\u4ee5\u4e0b\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u4f5c\u308a\u307e\u3059\u3002\u79c1\u306f\u30c6\u30b9\u30c8\u7528\u306b<\/p>\n<pre>mkdir rh_myTestLog<\/pre>\n<p>\u306a\u3069\u3068\u3057\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u305d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u4e0b\u306b<\/p>\n<pre>__init__.py<\/pre>\n<p>\u3068\u3044\u3046python\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30b3\u30fc\u30c9\u306e\u4e2d\u8eab\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code># my first plugin test\r\n\r\nimport logging\r\nlogger = logging.getLogger(__name__)\r\n\r\nfrom eventmanager import Evt\r\n\r\ndef myTestLog(args):\r\n  node = args['node_index']\r\n  logger.info(\"My test plugin - LAP (\" + str(node) + \")\")\r\n\r\ndef initialize(rhapi):\r\n  rhapi.events.on(Evt.RACE_LAP_RECORDED, myTestLog)<\/code><\/pre>\n<\/div>\n<p>initialize(rhapi)\u304c\u5fc5\u9808\u306e\u95a2\u6570\u3067\u3001\u3053\u3053\u3067\u306f\u4e3b\u306b\u30c8\u30ea\u30ac\u30fc\u3068\u306a\u308b\u30a4\u30d9\u30f3\u30c8\u3092\u767b\u9332\u3057\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u30c9\u30ed\u30fc\u30f3\u304c\u8a08\u6e2c\u70b9\u3092\u901a\u904e\u3057\u3066\u30e9\u30c3\u30d7\u30bf\u30a4\u30e0\u304c\u8a18\u9332\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067myTestLog(args)\u3068\u3044\u3046\u95a2\u6570\u304c\u547c\u3070\u308c\u308b\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002\u30c8\u30ea\u30ac\u30fc\u3068\u306a\u308b\u30a4\u30d9\u30f3\u30c8\u306f<a href=\"https:\/\/github.com\/RotorHazard\/RotorHazard\/blob\/main\/src\/server\/eventmanager.py\">eventmanager.py<\/a>\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3053\u306e\u30b3\u30fc\u30c9\u3092\u53c2\u7167\u3057\u3066\u540d\u524d\u304b\u3089\u5fc5\u8981\u306a\u30a4\u30d9\u30f3\u30c8\u3092\u63a2\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>myTestLog(args)\u306e\u5f15\u6570args\u306b\u306f\u30a4\u30d9\u30f3\u30c8\u306b\u5bfe\u5fdc\u3057\u305f\u30c7\u30fc\u30bf\u304c\u6e21\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306fargs[&#8216;node_index&#8217;]\u306b\u3066\u30e9\u30c3\u30d7\u30bf\u30a4\u30e0\u304c\u8a18\u9332\u3055\u308c\u305f\u30ce\u30fc\u30c9\u306e\u756a\u53f7\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3057\u3066\u305d\u308c\u3092\u30ed\u30b0\u306b\u66f8\u304d\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306eRACE_LAP_RECORDED\u306b\u3069\u3093\u306a\u30c7\u30fc\u30bf\u304c\u4ed8\u3044\u3066\u304f\u308b\u304b\u306f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<a href=\"https:\/\/github.com\/RotorHazard\/RotorHazard\/blob\/main\/src\/server\/RHRace.py\">RHRace.py<\/a>\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><strong>[ \u30c6\u30b9\u30c8 ]<\/strong><br \/>\n\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u66f8\u304d\u8fbc\u3093\u3060\u3089sudo systemctl restart rotorhazard\u306e\u5b9f\u884c\u3042\u308b\u3044\u306f\u30b7\u30b9\u30c6\u30e0\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>RotorHazard\u8d77\u52d5\u3057\u305f\u3089\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u6b63\u5e38\u306b\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u7d44\u307f\u8fbc\u307e\u308c\u308c\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ed\u30b0\u304c\u8a18\u9332\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre>2024-07-06 08:21:47.296: __main__ [INFO] Loaded plugin 'rh_myTestLog'<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>VTX\u96fb\u6ce2\u3092\u5229\u7528\u3057\u305f\u9ad8\u6a5f\u80fd\u306aFPV\u30ec\u30fc\u30b9\u8a08\u6e2c\u30b7\u30b9\u30c6\u30e0\u3067\u3042\u308bRotorHazard\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f5c\u308b\u3079\u304f\u8abf\u67fb\u4e2d\u3067\u3059\u3002\u7d50\u5c40\u306e\u3068\u3053\u308d\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u3093\u3067\u3082\u4eca\u3072\u3068\u3064\u5206\u304b\u308a\u306b\u304f\u3044\u306e\u3067\u3001\u5b9f\u969b\u306b\u52d5\u304d\u305d\u3046\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8aad\u3093\u3060\u308aRot [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[38],"tags":[],"class_list":["post-7975","post","type-post","status-publish","format-standard","hentry","category-quadcopter"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/7975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/comments?post=7975"}],"version-history":[{"count":8,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/7975\/revisions"}],"predecessor-version":[{"id":7983,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/7975\/revisions\/7983"}],"wp:attachment":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/media?parent=7975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/categories?post=7975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/tags?post=7975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}