Skip to content

Latest commit

 

History

History
147 lines (96 loc) · 3.4 KB

README.org

File metadata and controls

147 lines (96 loc) · 3.4 KB

led_system_ros

Repository Information

Author
Peter Polidoro
License
BSD

Setup

Docker on host machine

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
     ca-certificates \
     curl \
     gnupg \
     lsb-release -y
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
sudo groupadd docker
sudo usermod -aG docker $USER

Pull Docker Images

docker pull microros/micro-ros-agent:humble
docker pull microros/micro_ros_static_library_builder:humble

Arduino

Arduino IDE

Download Arduino IDE 1.8.19

https://www.arduino.cc/en/software

Download Teensyduino, install, and patch

mkdir -p ~/MicroRosArduinoIde && cd "$_"
mv ~/Downloads/arduino-1.8.19-linux64.tar.xz .
tar -xf arduino-1.8.19-linux64.tar.xz
wget -c https://www.pjrc.com/teensy/td_156/TeensyduinoInstall.linux64
chmod 755 TeensyduinoInstall.linux64
./TeensyduinoInstall.linux64
# Select ~/MicroRosArduinoIde/arduino-1.8.19/ to install Teensduino
# Select None additional libraries to install
export ARDUINO_PATH=~/MicroRosArduinoIde/arduino-1.8.19
cd $ARDUINO_PATH/hardware/teensy/avr/
curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/main/extras/patching_boards/platform_teensy.txt > platform.txt

Download precompiled micro-ROS library

cd ~/MicroRosArduinoIde
wget -c https://github.com/micro-ROS/micro_ros_arduino/archive/refs/tags/v2.0.5-humble.tar.gz
rm -rf ~/Arduino/libraries/micro_ros_arduino
tar -zxf v2.0.5-humble.tar.gz -C ~/Arduino/libraries/

Build precompiled micro-ROS library

cd ~/MicroRosArduinoIde
git clone -b humble [email protected]:micro-ROS/micro_ros_arduino.git
cd micro_ros_arduino
docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:humble
cd ~/Arduino/libraries
ln -s ~/MicroRosArduinoIde/micro_ros_arduino

Run Arduino IDE and upload

./MicroRosArduinoIde/arduino-1.8.19/arduino
  • Plug in Teensy 4.0
  • Select Tools:Port:/dev/ttyACM0
  • Navigate to File:Examples:INCOMPATIBLE:micro_ros_arduino:micro-ros_subscriber
  • Upload

PlatformIO

mkdir -p ~/tmp && cd "$_"
git clone https://github.com/micro-ROS/micro_ros_platformio
cd ~/tmp/micro_ros_platformio/examples/micro-ros_publisher/
pio run -e teensy40 --target upload

Zephyr

Run Agent Docker Container

docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:humble serial --dev /dev/ttyACM0 -v6

Test

Run ROS Container

docker run -it --rm --net=host ros:humble

Inside ROS Container

ros2 topic list
ros2 topic pub -1 /micro_ros_arduino_subscriber std_msgs/msg/Int32 "data: 1"
ros2 topic pub -1 /micro_ros_arduino_subscriber std_msgs/msg/Int32 "data: 0"