How to connect Teensy 3.2 with Micro-ROS and ROS 2 Foxy

Connection diagram of Teensy 3.2 with Host PC running ros2 and micro-ros-agent.

1. Installing ROS2 and micro-ROS in the host computer: These first few steps are the same as in the micro-ROS installation page as in this link

$ sudo apt install docker.io
$ sudo docker run -it --net=host -v /dev:/dev --privileged ros:foxy
#Source the ROS 2 installation
#source /opt/ros/foxy/setup.bash
$ source /opt/ros/$ROS_DISTRO/setup.bash
# Create a workspace and download the micro-ROS tools
$ mkdir microros_ws
$ cd microros_ws
$ git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup
# Update dependencies using rosdep
$ sudo apt update && rosdep update
$ rosdep install --from-path src --ignore-src -y
# Install pip
$ sudo apt-get install python3-pip

# Build micro-ROS tools and source them
$ colcon build
$ source install/local_setup.bash
# Download micro-ROS-Agent packages
$ ros2 run micro_ros_setup create_agent_ws.sh
# Build step
$ ros2 run micro_ros_setup build_agent.sh
$ source install/local_setup.bash
$ ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0

2. Installation of Arduino IDE, Teensyduino and setting up the patch for using the Teensy with micro-ROS and ROS 2 foxy:

1. Download the Linux udev rules and copy the file to /etc/udev/rules.d. 
https://www.pjrc.com/teensy/00-teensy.rules
2. type the following command in a terminal
$ sudo cp 00-teensy.rules /etc/udev/rules.d/
3. Download and extract one of Arduino's Linux packages.
Note: Arduino from Linux distro packages is not supported.
4. Download the corresponding Teensyduino installer.5. Run the installer in a termincal by adding execute permission and then execute it.
$ chmod 755 TeensyduinoInstall.linux64
$ ./TeensyduinoInstall.linux64
# for me it was $ export ARDUINO_PATH=/home/manzur/arduino-1.8.13/
$ export ARDUINO_PATH=[Your Arduino + Teensiduino path]
$ cd $ARDUINO_PATH/hardware/teensy/avr/$ curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/foxy/extras/patching_boards/platform_teensy.txt > platform.txt

3. Program the Teensy

1. Go to link to release section and download the last release of micro-ROS library for Arduino. Place the file inside /home/$USERNAME/Arduino/libraries/ as shown below.

4. Running micro-ros-agent in ROS 2 Foxy

#source /opt/ros/foxy/setup.bash
$ source /opt/ros/$ROS_DISTRO/setup.bash
$ ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0
$ ros2 topic list

References

  1. https://micro.ros.org//docs/tutorials/core/first_application_linux/
  2. https://github.com/micro-ROS/micro_ros_arduino/tree/foxy
  3. https://hub.docker.com/_/ros
  4. https://www.pjrc.com/teensy/td_download.html
  5. https://github.com/micro-ROS/micro_ros_setup/issues
  6. https://github.com/micro-ROS/micro_ros_arduino/issues

--

--

--

Robot enthusiast, maker, DIY and Open-source advocacy

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why move from gnome to i3 (window manager) in ubuntu?

Three Random Topics…

How to Write a Perfect Essay on Computer Programming

Kubernetes Horizontal Pod Autoscaling

Photo of the outside wall of an old apartment building showing many windows that are unevenly spaced

Sentiment Analysis of Youtube Comments for The Matrix Resurrections — Official Trailer 1

Things nobody ever taught me about CSS.

“overrequest” and “refine” JSON facet bucket counts in Solr

Tips For Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manzur Murshid

Manzur Murshid

Robot enthusiast, maker, DIY and Open-source advocacy

More from Medium

Guess Number Higher or Lower

ESP 32-Project 4: External Sensor

Project 4: ESP 32’s External Sensor

There’s a chance that GPU shipment will soon grow in the coming months as ABF substrate shortages…