< >
Home » ROS2与arduino指南 » ROS2与arduino入门教程-安装Teensyduino

ROS2与arduino入门教程-安装Teensyduino

ROS2与arduino入门教程-安装Teensyduino

说明:

  • 介绍如何安装teensyduino支持teensy板子

Teensyduino安装步骤:

  • 新建目录
mkdir ~/tools/teensy-micros
  • 下载rules
cd ~/tools/teensy-micros
wget https://www.pjrc.com/teensy/49-teensy.rules
  • 下载arduino和解压
wget https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz
tar -zxJf arduino-1.8.13-linux64.tar.xz
  • 下载teensyduino
wget https://www.pjrc.com/teensy/td_153/TeensyduinoInstall.linux64
chmod 755 TeensyduinoInstall.linux64
./TeensyduinoInstall.linux64
  • 根据界面提示安装,选择刚才下载arduino目录
  • 安装完成既支持teensy烧录固件

增加micros支持:

cd ~/tools/teensy-micros
wget  https://github.com/micro-ROS/micro_ros_arduino/archive/v0.0.4.zip
  • 打开arduino IDE
~/tools/teensy-micros/arduino-1.8.13/arduino 
  • 进入上传库压缩包界面,Sketch -> Include library -> Add .ZIP Library...
  • 打Teensyduino补丁
#export ARDUINO_PATH=[Your Arduino + Teensiduino path]
export ARDUINO_PATH=~/tools/teensy-micros/arduino-1.8.13/
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

测试:

  • 选择刷固件,File->micro_ros_arduino->micro-ros_publisher

  • 点击刷固件箭头,完成刷固件

  • 在pc端,运行agent

  • PC端,使用ros2的版本foxy

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0 -v6
  • 效果如下:
 data:
0000: 81 00 00 00 0B 01 05 00 06 00 06 00 80
[1609296063.242358] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 07 00 00 00 80
[1609296064.203405] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x50E95322, len: 16, data:
0000: 81 80 07 00 07 01 08 00 00 11 00 05 03 00 00 00
[1609296064.203475] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0B 01 05 00 07 00 07 00 80
[1609296064.203492] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0B 01 05 00 07 00 07 00 80
[1609296064.203571] debug    | DataWriter.cpp     | write                    | [** <<DDS>> **]        | client_key: 0x00000000, len: 4, data:
0000: 03 00 00 00
[1609296064.203724] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
[1609296064.203760] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
[1609296064.203776] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
[1609296064.204683] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0B 01 05 00 07 00 07 00 80
[1609296064.204905] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x50E95322, len: 13, data:
0000: 81 00 00 00 0A 01 05 00 08 00 00 00 80
  • 在PC端,新开终端,执行
ubuntu@AiROS2-NUC:~$ ros2 topic list
/micro_ros_arduino_node_publisher
/parameter_events
/rosout
  • 在PC端,新开终端,执行
ubuntu@AiROS2-NUC:~$ ros2 topic echo /micro_ros_arduino_node_publisher
data: 105
---
data: 106
---
data: 107
---
data: 108
---
data: 109
---
data: 110
---

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2与arduino入门教程