{"id":1463,"date":"2023-11-19T21:19:50","date_gmt":"2023-11-19T13:19:50","guid":{"rendered":"http:\/\/www.autouav.net.cn\/?p=1463"},"modified":"2023-11-21T10:12:24","modified_gmt":"2023-11-21T02:12:24","slug":"sapog%e5%bc%80%e6%ba%90%e9%ab%98%e6%80%a7%e8%83%bd%e7%94%b5%e8%b0%83","status":"publish","type":"post","link":"https:\/\/www.autouav.net.cn\/?p=1463","title":{"rendered":"Sapog\u5f00\u6e90\u9ad8\u6027\u80fd\u7535\u8c03"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/PX4\/sapog#px4-sapog\" target=\"_blank\" rel=\"noopener noreferrer\">Sapog <\/a>firmware is an advanced open source sensorless PMSM\/BLDC motor controller firmware designed for use in propulsion systems of electric unmanned vehicles.<\/p>\n<p>While it can be controlled using traditional PWM input, it is designed to operate over CAN bus using\u00a0<a class=\"router-link-active\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/\">DroneCAN<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1467\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/1.png\" alt=\"\" width=\"586\" height=\"1186\" srcset=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/1.png 586w, https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/1-148x300.png 148w, https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/1-506x1024.png 506w, https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/1-220x445.png 220w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<h2 id=\"hardware-setup\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#hardware-setup\">#<\/a>Hardware Setup<\/h2>\n<p>ESCs are connected to the CAN bus using a Pixhawk standard 4 pin JST GH cable. For more information, refer to the\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/can\/#wiring\">CAN Wiring<\/a>\u00a0instructions. ESC order does not matter.<\/p>\n<h2 id=\"firmware-setup\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#firmware-setup\">#<\/a>Firmware Setup<\/h2>\n<p>ESCs come with an existing build of Sapog installed. If you want to update:<\/p>\n<p>To build the firmware:<\/p>\n<div class=\"language-sh extra-class\">\n<pre class=\"language-sh\"><code><span class=\"token function\">git<\/span> clone --recursive https:\/\/github.com\/PX4\/sapog\r\n<span class=\"token builtin class-name\">cd<\/span> sapog\/firmware\r\n<span class=\"token function\">make<\/span> <span class=\"token assign-left variable\">RELEASE<\/span><span class=\"token operator\">=<\/span><span class=\"token number\">1<\/span>\r\n<\/code><\/pre>\n<\/div>\n<p>This will create a file\u00a0<code>*.application.bin<\/code>. in\u00a0<code>build\/<\/code>. This binary can be flashed through the autopilot over DroneCAN via the sapog bootloader. See\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/#firmware-update\">DroneCAN Firmware Update<\/a>.<\/p>\n<p>Refer to the\u00a0<a href=\"https:\/\/github.com\/PX4\/sapog\" target=\"_blank\" rel=\"noopener noreferrer\">project page\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>to learn more, including how to flash without using the DroneCAN bootloader (i.e. on a not-yet-programmed device) or for development.<\/p>\n<h2 id=\"flight-controller-setup\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#flight-controller-setup\">#<\/a>Flight Controller Setup<\/h2>\n<h3 id=\"enabling-dronecan\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#enabling-dronecan\">#<\/a>Enabling DroneCAN<\/h3>\n<p>Connect the ESCs to the Pixhawk CAN bus. Power up the entire vehicle using a battery or power supply (not just the flight controller over USB) and enable the DroneCAN driver by setting the parameter\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/advanced_config\/parameter_reference.html#UAVCAN_ENABLE\">UAVCAN_ENABLE<\/a>\u00a0to &#8216;3&#8217; to enable both dynamic node ID allocation and DroneCAN ESC output.<\/p>\n<h3 id=\"automatic-esc-enumeration-using-qgroundcontrol\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#automatic-esc-enumeration-using-qgroundcontrol\">#<\/a>Automatic ESC Enumeration using QGroundControl<\/h3>\n<p>This section shows how to enumerate any\u00a0<a href=\"https:\/\/github.com\/PX4\/sapog#px4-sapog\" target=\"_blank\" rel=\"noopener noreferrer\">Sapog-based\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>-based ESCs &#8220;automatically&#8221; using\u00a0<em>QGroundControl<\/em>.<\/p>\n<div class=\"custom-block tip\">\n<p class=\"custom-block-title\">\u63d0\u793a<\/p>\n<p>You can skip this section if there is only one ESC in your setup, because the ESC index is already set to zero by default.<\/p>\n<\/div>\n<p>To enumerate the ESC:<\/p>\n<ol>\n<li>Power the vehicle with a battery and connect to\u00a0<em>QGroundControl<\/em><\/li>\n<li>Navigate to\u00a0<strong>Vehicle Setup &gt; Power<\/strong>\u00a0in QGC.<\/li>\n<li>Start the process of ESC auto-enumeration by pressing the\u00a0<strong>Start Assignment<\/strong>\u00a0button, as shown on the screenshot below.<img decoding=\"async\" class=\"medium-zoom-image\" src=\"https:\/\/www.autouav.net.cn\/wp-content\/uploads\/2023\/11\/qgc_uavcan_settings.5a8e6fc6.jpg\" alt=\"QGC - DroneCAN ESC auto-enumeration\" \/>\n<p>You will hear a sound indicating that the flight controller has entered the ESC enumeration mode.<\/li>\n<li>Manually turn each motor in the correct direction of its rotation (as specified in the\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/airframes\/airframe_reference.html\">Airframe Reference<\/a>), starting from the first motor and finishing with the last motor. Each time you turn a motor, you should hear a confirmation beep.\n<div class=\"custom-block note\">\n<p class=\"custom-block-title\">\u6ce8\u89e3<\/p>\n<\/div>\n<\/li>\n<\/ol>\n<p>Make sure to turn each of the motors in the correct direction, as the ESC will automatically learn and remember the direction (i.e. motors that spin clockwise during normal operation must also be turned clockwise during enumeration). :::<\/p>\n<ol start=\"5\">\n<li>After the last motor is enumerated, the confirmation sound should change to indicate that the enumeration procedure is complete.<\/li>\n<li>Reboot PX4 and the Sapog ESCs to apply the new enumeration IDs.<\/li>\n<\/ol>\n<h3 id=\"manual-esc-enumeration-using-sapog\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#manual-esc-enumeration-using-sapog\">#<\/a>Manual ESC Enumeration using Sapog<\/h3>\n<div class=\"custom-block tip\">\n<p class=\"custom-block-title\">\u63d0\u793a<\/p>\n<p>We recommend automated\u00a0<a href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#automatic-esc-enumeration-using-qgroundcontrol\">Sapog ESC Enumeration using QGroundControl<\/a>\u00a0shown above rather than manual enumeration (as it is easier and safer).<\/p>\n<\/div>\n<p>You can manually configure the ESC index and direction using the\u00a0<a href=\"https:\/\/dronecan.github.io\/GUI_Tool\/Overview\/\" target=\"_blank\" rel=\"noopener noreferrer\">DroneCAN GUI Tool\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>. This assigns the following Sapog configuration parameters for each enumerated ESC:<\/p>\n<ul>\n<li><code>esc_index<\/code><\/li>\n<li><code>ctl_dir<\/code><\/li>\n<\/ul>\n<div class=\"custom-block note\">\n<p class=\"custom-block-title\">\u6ce8\u89e3<\/p>\n<p>See\u00a0<a href=\"https:\/\/files.zubax.com\/products\/io.px4.sapog\/Sapog_v2_Reference_Manual.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Sapog reference manual\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>for more information about the parameters.<\/p>\n<\/div>\n<h3 id=\"px4-configuration\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#px4-configuration\">#<\/a>PX4 Configuration<\/h3>\n<p>Assign motors to outputs using the\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/config\/actuators.html#actuator-testing\">Acutator<\/a>\u00a0configuration screen.<\/p>\n<h2 id=\"troubleshooting\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#troubleshooting\">#<\/a>Troubleshooting<\/h2>\n<p>See\u00a0<a class=\"\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/#troubleshooting\">DroneCAN Troubleshooting<\/a><\/p>\n<h2 id=\"further-information\"><a class=\"header-anchor\" href=\"http:\/\/docs.px4.io\/main\/zh\/dronecan\/sapog.html#further-information\">#<\/a>Further Information<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/PX4\/sapog#px4-sapog\" target=\"_blank\" rel=\"noopener noreferrer\">PX4\/Sapog\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>(Github)<\/li>\n<li><a href=\"https:\/\/files.zubax.com\/products\/io.px4.sapog\/Sapog_v2_Reference_Manual.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Sapog v2 Reference Manual<span class=\"sr-only\">(opens new window)<\/span><\/a><\/li>\n<li><a href=\"https:\/\/kb.zubax.com\/display\/MAINKB\/Using+Sapog-based+ESC+with+PX4\" target=\"_blank\" rel=\"noopener noreferrer\">Using Sapog based ESC with PX4\u00a0<span class=\"sr-only\">(opens new window)<\/span><\/a>(Zubax KB)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Sapog firmware is an advanced open source sensorless PMSM\/BLDC motor controller firmware designed fo&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-1463","post","type-post","status-publish","format-standard","hentry","category-25"],"_links":{"self":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1463"}],"version-history":[{"count":3,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1463\/revisions"}],"predecessor-version":[{"id":1468,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/1463\/revisions\/1468"}],"wp:attachment":[{"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.autouav.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}