Skip to content
micro-ROS temperature publisher demonstration based on Olimex STM32-E407 Board
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md

README.md

micro-ROS temperature publisher demo

This repository provides a micro-ROS publisher demonstrator. In order to reproduce this example, you need:

  • An Olimex STM32-E407 board, with a HIH6130 temperature sensor attached through I2C.

  • A Raspberry Pi 3 that is connected to the Olimex board through a serial connection. This device is the micro-ROS to ROS 2 bridge, which acts as a gateway.

  • ROS 2 running computer, which is able to retrieve the sensor data published by the MCU.

Involved technology

The MCU runs NuttX RTOS with an application that contains the temperature sensor driver and the micro-ROS client. Once the client connects to the micro-Agent that runs in the Raspberry Pi, is able to create a topic and publish the sensor data. The micro-ROS Client is based in the rclc layer.

The Agent that runs in the Raspberry Pi, acts as a bridge among micro-ROS and ROS 2 world, translating the content the MCU has created. The Agent has the capability of using both standard DDS and XRCE-DDS that micro-ROS uses. Thanks to this is able to talk to the micro-ROS client that runs in the MCU.

The Agent goal is to deliver the temperature data in the local network where the ROS 2 running computer is placed. Thanks to this, the computer is able to run ros2 topic echo and retrieve the temperature sensor data.

Demonstration video

You can see the demonstration video here: https://micro-ros.github.io/blog/2019/06/03/micro-ROS_temperature_publisher_demo/

Instructions

Raspberry Pi based bridge

Use Raspberry Pi cross-compiling tool for creating a micro-ROS Agent self-contained workspaces. This allows to communicate with the micro-ROS client that lives at the Olimex board. It also mirrors the node and the data the micro-ROS client creates to the ROS 2 world.

Once you have cross-compiled the agent, copy the folder to a Raspbian-containing SD card.

micro-ROS publisher Docker

This Docker file will allow you to fetch the dependencies and compile the example based on NuttX. Once you are done, you need to upload the created binary under ~/nuttx called nuttx.elf to the board. To do so, please download the next repo (git clone https://github.com/micro-ROS/docker), build an upload the firmware following the next tutorial.

Executing everything

First, connect the Olimex board and the sensor, like this:

  • Olimex D0 -> HIH6130 SDA
  • Olimex D1 -> HIH6130 SCL
  • Olimex +3.3v -> HIH6130 Vdd
  • Olimex GND -> HIH6130 GND

And it should look like this: 20190531_155732

Secondly, connect the Olimex board serial to the Raspberry Pi serial port, like the next image:

  • Olimex TX3 -> RPI RX (PIN 10)
  • Olimex RX3 -> RPI TX (PIN 8)
  • Olimex GND -> RPI GND (PIN 6)

You can see the RPI pinout here.

And should look like this: 20190531_155825

You need to connect your Raspberry Pi to your local network, so the ROS 2 running computer can retrieve the temperature data. Once everything is ready, you need to do the next steps on the each device.

Raspberry Pi:

  • Open a terminal on the Rpi (You can connect by SSH for example).
  • Configure execution enviroment typing the next command: . ~/agent_ws/install/./local_setup.bash
  • Execute the micro-ROS Agent typing the next command: ./agent_ws/install/lib/micro_ros_agent/micro_ros_agent serial /dev/ttyS0

Now the RPI is ready to work as bridge.

Olimex Board:

  • Open a NuttX console. (NuttX tutorials)
  • Execute the app publisher_hih6130.

This will create a node and a topic. Once everything is set-up it will publish the temperature value.

Host PC or any other device on the network.

Note: This PC must have ROS2 crystal.

  • Open a terminal and configure the execution enviroment typing: . ~/ros2_ws/install/local_setup.bash
  • We will check if the topic is being published, by typing: ros2 topic list
  • This should return somenthing like this:
/parameter_events
/rosout
/std_msgs_msg_Int32
  • Finally we will echo the topic content, by typing the next command: ros2 topic echo
  • This should return the next:
data: 28
data: 28
data: 28
data: 28

Resources

  • micro-ROS NuttX fork, use tag v0.0.2-alpha
  • micro-ROS NuttX App fork, use example branch.
  • micro-ROS RPi bridge cross-compiling tool, for cross-compiling micro-ROS Agent and Client, located here.
You can’t perform that action at this time.