{"id":493,"date":"2023-03-25T00:40:20","date_gmt":"2023-03-25T00:40:20","guid":{"rendered":"https:\/\/peterklemperer.com\/blog\/?p=493"},"modified":"2023-03-25T01:16:56","modified_gmt":"2023-03-25T01:16:56","slug":"micro-ros-on-the-pololu-3pi2040","status":"publish","type":"post","link":"https:\/\/peterklemperer.com\/blog\/2023\/03\/25\/micro-ros-on-the-pololu-3pi2040\/","title":{"rendered":"Micro ROS on the Pololu 3pi+2040"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Pololu 3pi+2040 is a very capable (and adorable) mobile robotics experimentation platform sporting the powerful Raspberry Pi RP2040 microcontroller. The ROS 2 robot operating system is the standard platform for mobile robotics, providing reliable publisher-subscriber communication, simulation and visualization. While ROS is too complex to run on a microcontroller, a microcontroller adaptation called micro ROS has been developed to provide ROS primitives. A serial bridge provides communication between the target microcontroller and the ROS host. <strong><em>My project is to demonstrate and provide a tutorial for running the Pololu 3pi+2040 with micro ROS communicating with a ROS host.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Major steps of this project include:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Running Micro ROS on a bare Raspberry Pi Pico RP2040 development board<\/li>\n\n\n\n<li>Running Micro ROS on the Pololu 3pi+2040 with basic functionality<\/li>\n\n\n\n<li>Adding sensor telemetry to the Pololu 3pi+2040 micro ROS implementation<\/li>\n\n\n\n<li>Remote motion control of the Pololu 3pi+2040 through micro ROS<\/li>\n\n\n\n<li>Bonus step: wireless control of the Pololu 3pi+2040 using the Pololu Wixel<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This first post will focus on steps 1 &amp; 2, running micro ROS on the RP2040 and then on the 3pi+2040.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Micro ROS on a Raspberry Pi Pico RP2040 dev board<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I can take no credit for adapting Micro ROS to the Raspberry Pi Pico development board. In fact, all I did was follow the instructions from <a href=\"https:\/\/robofoundry.medium.com\/raspberry-pi-pico-ros2-via-micro-ros-actually-working-in-1-hr-9f7a3782d3e3\">RoboFoundry on building and installing micro ROS and the micro ROS host bridge.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The only problem I encountered was when I built the base ROS system. I installed a Ubuntu 20.04 virtual machine on my Intel-based Mac using the UTM hypervisor. I tried using Ubuntu 22.04 but the micro ROS build failed; make sure use 20.04. Then I installed ROS 2 Focal using <a href=\"https:\/\/docs.ros.org\/en\/foxy\/Installation\/Ubuntu-Install-Debians.html\">the instructions directly from ros.org<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Micro ROS on the Pololu 3pi+2040 with basic functionality<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In general I hoped to follow the same instructions from RoboFoundry (linked above), but swapping the Pololu 3pi+2040 for the Raspberry Pi Pico.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Pololu 3pi+2040 can be put into boot loader mode by holding the &#8220;b&#8221; button and pressing reset. I loaded the same pico_micro_ros_example.uf2 image that I generated in step 1. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The only change I had to make to the RobotFoundry instructions above is to build the Micro Ros Agent <a href=\"https:\/\/micro-xrce-dds.docs.eprosima.com\/en\/latest\/installation.html#install-agent\">manually from source using the instructions here.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ros2 topic list<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ros2 topic echo publisher_node<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should see the integer published by the 3pi+ 2040 incrementing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The only two problems I encountered were not adding \/usr\/local\/lib to the ldconfig and having set a ROS_DOMAIN_ID. If you have set one, make sure to unset the ROS_DOMAIN_ID. If you don&#8217;t, the micro ROS publisher will not appear in the topic list. I&#8217;ll have to look into how to set the ROS_DOMAIN_ID intentionally during the firmware generation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next Steps<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s enough for now. Next up I&#8217;ll figure out how to compile in telemetry and motor control to the Pololu 3Pi+ RP2040 image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Pololu 3pi+2040 is a very capable (and adorable) mobile robotics experimentation platform sporting the powerful Raspberry Pi RP2040 microcontroller. The ROS 2 robot operating system is the standard platform for mobile robotics, providing reliable publisher-subscriber communication, simulation and visualization. &hellip; <a href=\"https:\/\/peterklemperer.com\/blog\/2023\/03\/25\/micro-ros-on-the-pololu-3pi2040\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[6,80],"tags":[],"class_list":["post-493","post","type-post","status-publish","format-standard","hentry","category-projects","category-robotics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1VqWo-7X","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":0,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"wp:attachment":[{"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peterklemperer.com\/blog\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}