Table of Contents

Control your robot using micro-ROS and NVIDIA Jetson kit

ROS is an open-source framework that simplifies the development of complex robotic applications. It utilizes a distributed architecture that facilitates communication between various software components within a robot’s system.

Introduction

ROS is an open-source framework that simplifies the development of complex robotic applications. It utilizes a distributed architecture that facilitates communication between various software components within a robot’s system.

 

ROS2 is a popular framework for developing robotics systems, which utilizes a flexible middleware called Data Distribution Service (DDS), providing improved support for real-time and distributed systems. However, it can be challenging to use on small, low-power devices due to its resource requirements.

Micro-ROS offers a lightweight and efficient implementation of ROS2, which can run on microcontrollers, making it suitable for resource-constrained environments such as embedded systems and mobile robots. It is an extension of ROS2 that enables developers to deploy the framework on microcontrollers.

In this article, we will explore some examples of how to control robot wheels using micro-ROS on MCU and the Robot Operating System.

For Installation of ROS2.

For more details about micro-ROS click here.

Watch the below given video to understand the process

Interface MCU with ROS2 based device

MCUs and ROS2 essentially communicate via the Micro-ROS Agent, which is a ROS 2 node that wraps the Micro XRCE-DDS Agent. The node acts as a server between the DDS Network and Micro-ROS nodes inside the MCU. It receives and sends messages from Micro-ROS nodes and keeps track of the Micro-ROS nodes, exposing them to the ROS 2 network. The node interacts with the DDS Global Data Space on behalf of the Micro-ROS nodes.

Click here to check list of Micro-ROS supported hardware.

Here, we are using an ESP32 development board to control robot movement through motor drivers and an NVIDIA Jetson kit to send Command Velocity. With the ESP32, we are effectively controlling wheel’s RPM, Direction, and Ticks. The direction is determined by the output of the Hall sensor, which is connected to our hub motor.

Meanwhile, the wheel’s RPM is calculated based on the command velocity that is transmitted from our Differential node, which is running on the Jetson board. Lastly, the number of ticks is tracked by counting the number of interrupts that are received from the Hall sensor, which is also used to determine the direction of the wheel.

The general steps to integrate Micro ROS porting on ESP32 with Nvidia Jetson Orin are mentioned below. The specific details may vary depending on your platform and the application you are developing.
Setup your development environment

  1. Install the required software for both ESP32 and Jetson Orin development. This includes the ESP-IDF development framework and the Jetpack SDK for Orin.
  2. Build Micro ROS Agent on the Jetson Orin: Build Micro ROS on the Jetson Orin using the appropriate instructions for your platform.
  3. Build and flash the Micro ROS client application on the ESP32: The Micro ROS client application is the code that runs on the ESP32 and communicates with the Jetson Orin. Build and flash the Micro ROS client application onto the ESP32.
  4. Test the Micro ROS integration: Verify that the Micro ROS integration is working as expected by running a test application on the Jetson Orin and the ESP32.
  5. Develop your own Micro ROS applications: Once the Micro ROS integration is working, you can start developing your own applications that use Micro ROS to communicate between the ESP32 and the Jetson Orin.

Here we have used Arduino IDE to build ESP32 application. There are several steps to build, one can refer Esp32 board install on Arduino IDE, And Library build for micro-ROS in Arduino.

Software Architecture

 

 

 

The software mainly contains following two major blocks

1.NVDIA AGX Orin Robotics Computer

  • The Jetson AGX Orin is equipped with cutting-edge hardware that includes an NVIDIA Ampere architecture GPU (Graphics Processing Unit), Arm Cortex-A78AE CPUs (Central Processing Units), and next-generation deep learning and vision accelerators. Its high-speed interfaces and optimal memory bandwidth, along with support for multimodal sensors, make it possible to seamlessly run multiple concurrent AI (Artificial Intelligence) applications. This makes the Jetson AGX Orin an ideal platform for running advanced AI workloads in a variety of applications.

2.ESP32 micro controller

  • A feature rich MCU (Micro Controller Unit) with integrated Wi-Fi and Bluetooth connectivity that is suitable for a wide range of applications.
    • The NVIDIA AGX Orin is designed to perform high computational tasks such as image/video processing and running AI/ML pipelines.
    • Meanwhile, the ESP32 is intended for low-level hardware control tasks, such as commanding motor drivers for wheel movements or controlling hardware LEDs.

Communication of ESP32, Robot motors and ROS2

• Communication between the NVIDIA AGX Orin and ESP32 takes place over the UART peripheral by exchanging standard ROS (Robotics Operating System) messages.
• The hub motor is connected to motor drivers, and the hall sensor, direction, and enable pins of the driver are connected to ESP32 GPIOs.
• The NVIDIA AGX Orin has a General-Purpose Operating System (GPOS) based computer running Ubuntu with ROS middleware available.
• Micro-ROS Agent running on AGX Orin is a ROS 2 node that wraps the Micro XRCE-DDS Agent. It receives and send messages from Micro-ROS nodes and It handles the ROS communication between AGX Orin and ESP32.
• We have also created a custom message for ROS2 and ESP applications, which is published from the differential node. The ESP32 subscribes to this message and handles the wheel RPM according to the data received.

Robot Movement

• As mentioned earlier, the ESP32 handles driving the robot wheels using their associated motor drivers. The command to drive the robot is generated by the differential ROS node running inside the Orin device, which operates on the principle of a Differential Wheeled Robot.
• The differential node receives a command velocity message from any of the driver applications (e.g., Tele-op twist keyboard, Navigation stack, etc.). The command velocity message expresses velocity in free space, broken into its linear and angular parts. The differential node derives the left and right wheel velocity and sends them as ROS topics to the ESP32.
• Upon receiving the velocity messages, the ESP32 applies the required PWM (Pulse-Width Modulation) value to the associated motor drives, which drives the wheels.

Conclusion

To summarize, the successful porting of Micro-ROS to MCUs and its integration with ROS-based Linux OS represents a significant advancement in the field of robotics development. This development enables the creation of highly modular and scalable systems that can perform complex tasks by distributing the workload across multiple nodes. By leveraging the powerful tools and libraries provided by the ROS ecosystem, developers can build robust robotic systems that can run on low-power and resource-constrained devices.
The combination of low-power microcontrollers and high-performance computing platforms provides a flexible and powerful platform for building complex robotic systems. With the integration of Micro-ROS, the potential for further innovation in the field of robotics is limitless.


Authors

Ruchi Patel

Embedded Engineer, EInfochips (An arrow company)
Ruchi is an experienced Embedded Engineer at EInfochips Pvt Ltd., where she has been working for the past 1.5 years. She completed her B. Tech degree in Electronics Engineering from Birla Vishwakarma Mahavidyalaya. Ruchi has experience in developing firmware and has worked on a variety of microcontrollers. She has been focused on using microcontrollers with micro-ROS to develop efficient and robust robotic systems.+

 

Meet Gandhi

Senior Engineer, EInfochips (An arrow company)

Meet Gandhi is a skilled embedded software engineer associated with Einfochips Pvt Ltd. He is having 6+ years of experience building innovative solutions to complex problems. With expertise in Embedded Software development, Meet Gandhi is dedicated to delivering high-quality software that meets both technical and business requirements. A lifelong learner, Meet Gandhi is passionate about staying up-to-date with the latest trends and technologies in the field.

Explore More

Talk to an Expert

Subscribe
to our Newsletter
Stay in the loop! Sign up for our newsletter & stay updated with the latest trends in technology and innovation.

Our Work

Innovate

Transform.

Scale

Partnerships

Device Partnerships
Digital Partnerships
Quality Partnerships
Silicon Partnerships

Company

Products & IPs

Services