I am currently using a raspberry pi pico and a raspberry pi 4, So far I have established a connection between the two using micro-ros-agent I have also successfully built and ran the example provided here https://ubuntu.com/blog/getting-started-with-micro-ros-on-raspberry-pi-pico

so I wanted to try it out on a simple servo how do I do it as there is no servo.h library here to use.

  • $\begingroup$ google Raspberry Pi servo example $\endgroup$
    – jsotola
    Dec 21, 2021 at 21:57

1 Answer 1

  1. Install ROS2 on both the Raspberry Pi Pico and the Raspberry Pi 4.

  2. Connect the Raspberry Pi Pico and the Raspberry Pi 4 with a USB cable.

  3. Install the micro-ros-agent package on both devices.

  4. Create a ROS2 workspace and source the ROS2 environment on both devices.

  5. On the Raspberry Pi 4, create a ROS2 package for your servo.

  6. Write a ROS2 node to control your servo. This node should subscribe to the desired servo angle topic and publish the actual servo angle topic.

  7. On the Raspberry Pi Pico, create a micro-ROS package for your servo.

  8. Write a micro-ROS node to control your servo. This node should handle the servo hardware commands needed to move the servo to the desired angles.

  9. Connect the servo to the Raspberry Pi Pico and configure the GPIO pins.

  10. Build and run the micro-ROS node on the Raspberry Pi Pico, and the ROS2 node on the Raspberry Pi 4.

  11. Publish the desired servo angle on the ROS2 topic, and your servo should move to the desired angle.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.